diff options
author | Craig Hesling <hesling@chromium.org> | 2021-02-09 18:26:07 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-02-11 23:45:27 +0000 |
commit | 4f7ea935164b33ca3e2b2d520d3b1252d359b50b (patch) | |
tree | 0584b0be995ad6746cae46bb16d6ff45bc2b9b1a /util | |
parent | 47ab212df40129517432c0e6215e4ff510cc829a (diff) | |
download | chrome-ec-4f7ea935164b33ca3e2b2d520d3b1252d359b50b.tar.gz |
flash_fp_mcu: Add check for drivers that change nrst and boot0
This helps identifying driver/device-tree configs that are tampering
with the nrst and boot0 pin states.
BRANCH=none
BUG=b:179530529
TEST=Deploy to coachz with driver that reset nrst and boot0 pins
Signed-off-by: Craig Hesling <hesling@chromium.org>
Change-Id: Ia5d603f8ce49022e48b7b1d623c3b2da6926a6ee
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2686579
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Diffstat (limited to 'util')
-rw-r--r-- | util/flash_fp_mcu | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/util/flash_fp_mcu b/util/flash_fp_mcu index 78841c5256..b1217b171a 100644 --- a/util/flash_fp_mcu +++ b/util/flash_fp_mcu @@ -75,7 +75,7 @@ get_uartid() { exit 1 } -# Usage: gpio <unexport|export|in|out|0|1> <signal> [signal...] +# Usage: gpio <unexport|export|in|out|0|1|get> <signal> [signal...] gpio() { local cmd="$1" shift @@ -93,6 +93,10 @@ gpio() { local value="${cmd}" echo "${value}" > "/sys/class/gpio/gpio${signal}/value" ;; + get) + local value="${cmd}" + cat "/sys/class/gpio/gpio${signal}/value" + ;; *) echo "Invalid gpio command: ${cmd}" >&2 exit 1 @@ -255,6 +259,16 @@ flash_fp_mcu_stm32() { fi sleep 0.5 + # We do not expect the drivers to change the pin state when binding. + # If you receive this warning, the driver needs to be fixed on this board + # and this flash attempt will probably fail. + if [[ $(gpio get "${gpio_boot0}") -ne 1 ]]; then + echo "WARNING: One of the drivers changed BOOT0 pin state on bind attempt." + fi + if [[ $(gpio get "${gpio_nrst}") -ne 0 ]]; then + echo "WARNING: One of the drivers changed NRST pin state on bind attempt." + fi + local attempt=0 local cmd_exit_status=1 local cmd="stm32mon ${stm32mon_flags}" |