summaryrefslogtreecommitdiff
path: root/util/flash_fp_mcu
diff options
context:
space:
mode:
authorCraig Hesling <hesling@chromium.org>2019-11-18 11:34:12 -0800
committerCommit Bot <commit-bot@chromium.org>2020-02-08 01:01:43 +0000
commit9bf11ed2f7761f8a826782c09f7ad8d1a1531c80 (patch)
treee3ba092f765d080c325a514e8279a50c96f9bde6 /util/flash_fp_mcu
parentd80fac9814428aa69e24e9553f0f3815745f8f38 (diff)
downloadchrome-ec-9bf11ed2f7761f8a826782c09f7ad8d1a1531c80.tar.gz
flash_fp_mcu: Simplify flags building
This does not change the behavior of flash_fp_mcu. It simply removes two unnecessary variables and simplifies the flag building logic. 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: Icf96d837ed1c8a00e881fb79b42b8f8ccd893ca5 Signed-off-by: Craig Hesling <hesling@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2036602 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Commit-Queue: Tom Hughes <tomhughes@chromium.org> Tested-by: Tom Hughes <tomhughes@chromium.org>
Diffstat (limited to 'util/flash_fp_mcu')
-rw-r--r--util/flash_fp_mcu20
1 files changed, 10 insertions, 10 deletions
diff --git a/util/flash_fp_mcu b/util/flash_fp_mcu
index 0817b5402b..88b123f804 100644
--- a/util/flash_fp_mcu
+++ b/util/flash_fp_mcu
@@ -121,34 +121,34 @@ flash_fp_mcu_stm32() {
local file="${5}"
local spiid
- local STM32MON_READ_FLAGS=" -p -s ${spidev} -r"
- local STM32MON_WRITE_FLAGS="-p -s ${spidev} -e -w"
- local stm32mon_flags="--retries ${STM32MON_CONNECT_RETRIES}"
+
+ local stm32mon_flags="-p --retries ${STM32MON_CONNECT_RETRIES} -s ${spidev}"
if [[ "${FLAGS_remove_flash_write_protect}" -eq "${FLAGS_TRUE}" ]]; then
- STM32MON_READ_FLAGS=" -u ${STM32MON_READ_FLAGS}"
- STM32MON_WRITE_FLAGS="-u ${STM32MON_WRITE_FLAGS}"
+ stm32mon_flags+=" -u"
fi
if [[ "${FLAGS_remove_flash_read_protect}" -eq "${FLAGS_TRUE}" ]]; then
- STM32MON_READ_FLAGS=" -U ${STM32MON_READ_FLAGS}"
- STM32MON_WRITE_FLAGS="-U ${STM32MON_WRITE_FLAGS}"
+ stm32mon_flags+=" -U"
fi
if [[ "${FLAGS_read}" -eq "${FLAGS_TRUE}" ]]; then
+ # Read from FPMCU to file
if [[ -e "${file}" ]]; then
echo "Output file already exists: ${file}"
exit 1
fi
- stm32mon_flags+=" ${STM32MON_READ_FLAGS}"
+ stm32mon_flags+=" -r ${file}"
else
+ # Write to FPMCU from file
if [[ ! -f "${file}" ]]; then
echo "Invalid image file: ${file}"
exit 1
fi
- stm32mon_flags+=" ${STM32MON_WRITE_FLAGS}"
+ stm32mon_flags+=" -e -w ${file}"
fi
+
check_hardware_write_protect_disabled
spiid="$(get_spiid)"
@@ -189,7 +189,7 @@ flash_fp_mcu_stm32() {
local attempt=0
local cmd_exit_status=1
- local cmd="stm32mon ${stm32mon_flags} ${file}"
+ local cmd="stm32mon ${stm32mon_flags}"
for attempt in $(seq ${FLAGS_retries}); do
# Reset sequence to enter bootloader mode