diff options
author | Craig Hesling <hesling@chromium.org> | 2020-02-04 11:30:18 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-02-08 01:01:42 +0000 |
commit | d80fac9814428aa69e24e9553f0f3815745f8f38 (patch) | |
tree | 0d60a6d4b37ecb613a395099a308c0996b9d6b38 | |
parent | 80c42a77f0e8f2f553b969e1ef20436495228f08 (diff) | |
download | chrome-ec-d80fac9814428aa69e24e9553f0f3815745f8f38.tar.gz |
flash_fp_mcu: Factor out retries into constants
This does not change the default behavior of flash_fp_mcu.
It does, however, allow the number of retries to be overridden using
env variables.
BRANCH=nocturne,hatch
BUG=b:143374692,b:144729003
TEST=# Nocturne
flash_fp_mcu /opt/google/biod/fw/*.bin
TEST=# Ensure PS crrev.com/c/1921705 is applied.
# Run http://go/bit/hesling/5791510394044416
Change-Id: Ieba0cec022f3463b529655ecc204753db7404f7d
Signed-off-by: Craig Hesling <hesling@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2036601
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Commit-Queue: Tom Hughes <tomhughes@chromium.org>
Tested-by: Tom Hughes <tomhughes@chromium.org>
-rw-r--r-- | util/flash_fp_mcu | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/util/flash_fp_mcu b/util/flash_fp_mcu index 086b742e8e..0817b5402b 100644 --- a/util/flash_fp_mcu +++ b/util/flash_fp_mcu @@ -5,6 +5,9 @@ . /usr/share/misc/shflags +readonly DEFAULT_RETRIES=${DEFAULT_RETRIES:-4} +readonly STM32MON_CONNECT_RETRIES=${STM32MON_CONNECT_RETRIES:-6} + DEFINE_boolean 'read' "${FLAGS_FALSE}" 'Read instead of write' 'r' # Both flash read and write protection are removed by default, but you # can optionally enable them (for testing purposes). @@ -12,7 +15,7 @@ DEFINE_boolean 'remove_flash_read_protect' "${FLAGS_TRUE}" \ 'Remove flash read protection while performing command' 'U' DEFINE_boolean 'remove_flash_write_protect' "${FLAGS_TRUE}" \ 'Remove flash write protection while performing command' 'u' -DEFINE_integer 'retries' 4 'Specify number of retries' 'R' +DEFINE_integer 'retries' "${DEFAULT_RETRIES}" 'Specify number of retries' 'R' FLAGS_HELP="Usage: ${0} [flags] ec.bin" # Process commandline flags @@ -120,7 +123,7 @@ flash_fp_mcu_stm32() { local STM32MON_READ_FLAGS=" -p -s ${spidev} -r" local STM32MON_WRITE_FLAGS="-p -s ${spidev} -e -w" - local stm32mon_flags="--retries 6" + local stm32mon_flags="--retries ${STM32MON_CONNECT_RETRIES}" if [[ "${FLAGS_remove_flash_write_protect}" -eq "${FLAGS_TRUE}" ]]; then STM32MON_READ_FLAGS=" -u ${STM32MON_READ_FLAGS}" |