diff options
author | Craig Hesling <hesling@chromium.org> | 2021-07-27 03:28:27 -0400 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-07-27 21:44:16 +0000 |
commit | c7e06191a4042367afe69293a0650234864ec697 (patch) | |
tree | d654bb41e1ed6b6492ef70b6ed068046c1f0bd3c /util/stm32mon.c | |
parent | 2f2f68b2b0cdfa0c783871388f69fd2fb18f7fef (diff) | |
download | chrome-ec-c7e06191a4042367afe69293a0650234864ec697.tar.gz |
util/stm32mon: Fix Readout Unprotect for STM32F412
After sending CMD_RU, the MCU will send one ACK immediately and then
another one when it is finished erasing all of flash.
We currently only wait MAX_RETRY_COUNT (3) timeouts for that seconds
ACK, which is not enough for the STM32F412 most fo the time. This means
that it requires two invocations of stm32mon to flash a protected chip.
* First unprotects and erases, then stm32mon aborts
* Second sees an erased and unprotected chip which flashes correctly.
We only need a few more attempts. It happens to be that
MAX_ACK_RETRY_COUNT is designed for this type of situation where we
are waiting for a long ACK. It provides 5 vs the old 3.
BRANCH=none
BUG=b:143374692
TEST=./test/run_device_tests.py --flasher=servo_micro --tests \
flash_write_protect
# FPMCU is now readout protected
./test/run_device_tests.py --flasher=servo_micro --tests \
flash_write_protect
# This should succeed the first time stm32mon is run, not the second.
TEST=# Tried flash_fp_mcu on dratini(F412/SPI) and bard(H732/SPI).
Signed-off-by: Craig Hesling <hesling@chromium.org>
Change-Id: I225fa7560fd485e5df601378998f2853b351324c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3054464
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 1ab8c54a8b..a437949168 100644 --- a/util/stm32mon.c +++ b/util/stm32mon.c @@ -1117,7 +1117,7 @@ int command_erase(int fd, uint16_t count, uint16_t start) int command_read_unprotect(int fd) { int res; - int retries = MAX_RETRY_COUNT; + int retries = MAX_ACK_RETRY_COUNT; printf("Unprotecting flash read...\n"); |