diff options
author | Craig Hesling <hesling@chromium.org> | 2020-02-04 11:30:18 -0800 |
---|---|---|
committer | Philip Chen <philipchen@chromium.org> | 2020-02-10 19:35:48 +0000 |
commit | a00a1179f0c0c091f114701df8fbdf51ff13f635 (patch) | |
tree | e86db423df7da7737d6a3352215fb560e7aa877e | |
parent | 37a8704df83c088bc7839bec909cfab5e1dbd6da (diff) | |
download | chrome-ec-a00a1179f0c0c091f114701df8fbdf51ff13f635.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>
(cherry picked from commit d80fac9814428aa69e24e9553f0f3815745f8f38)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2047625
Reviewed-by: Philip Chen <philipchen@chromium.org>
Commit-Queue: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@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 28e869b152..e1768ebdb8 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}" |