diff options
author | Craig Hesling <hesling@chromium.org> | 2021-07-27 02:50:38 -0400 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-07-27 21:44:16 +0000 |
commit | 2f2f68b2b0cdfa0c783871388f69fd2fb18f7fef (patch) | |
tree | 825ff491c606bbe9ccaccf27acb9703b4f7df22f /util/stm32mon.c | |
parent | 1aa97a5b62acf1b3a6bad23331cae1c7e4fbea5b (diff) | |
download | chrome-ec-2f2f68b2b0cdfa0c783871388f69fd2fb18f7fef.tar.gz |
util/stm32mon: Fix cmd_lookup_name
Previously, the bootloader commands would be printed like
the following, where the RP (0x82) and RU (0x92) commands would not
be identified:
Bootloader v3.1, commands : GETCMD GETVER GETID READMEM GO WRITEMEM \
EXTERASE WP WU 82 92
I believe this is because |cmd| and |cmd_lookup_table[i].cmd| were being
"integer promoted" to accommodate all values. This would result in
both values being converted to 32bit ints. This means that the char
|cmd| could be sign extended and maintain a negative value and
|cmd_lookup_table[i].cmd| would maintain a large unsigned value.
Now, all the commands are recognized:
Bootloader v3.1, commands : GETCMD GETVER GETID READMEM GO WRITEMEM \
EXTERASE WP WU RP RU
BRANCH=none
BUG=none
TEST=make proj-bloonchipper -j
./util/flash_ec --board=bloonchipper
Signed-off-by: Craig Hesling <hesling@chromium.org>
Change-Id: I07ad35fe7e6b69c57f7f69bce3c694c2f887beef
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3054820
Reviewed-by: Patryk Duda <patrykd@google.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'util/stm32mon.c')
-rw-r--r-- | util/stm32mon.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/util/stm32mon.c b/util/stm32mon.c index ff72e2f75e..1ab8c54a8b 100644 --- a/util/stm32mon.c +++ b/util/stm32mon.c @@ -87,7 +87,7 @@ const struct { CMD_LOOKUP_ENTRY(RU), }; -const char *cmd_lookup_name(char cmd) +const char *cmd_lookup_name(uint8_t cmd) { int i; for (i = 0; i < ARRAY_SIZE(cmd_lookup_table); i++) { |