diff options
author | Robert Zieba <robertzieba@google.com> | 2022-03-18 09:19:30 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-03-23 00:06:17 +0000 |
commit | b74166ddf34d79b3c7ab2f014283442500740a9c (patch) | |
tree | 259da15ba08916d79d63df062f982e9b12296dde /util | |
parent | bf17d0d799acb78e9824a7089a7b342d8f4bc822 (diff) | |
download | chrome-ec-b74166ddf34d79b3c7ab2f014283442500740a9c.tar.gz |
util/flash_ec: Add better error message when WP is on
Currently when flashing npcx ECs this tool will fail with "Failed to
load monitor binary" when WP is enabled. This commit adds logic to check
if WP is enabled and give a more informative error message when flashing
fails because of that.
BRANCH=none
BUG=b:210645611
TEST=Ran flash_ec with WP on and verified that the correct error message
is displayed
Signed-off-by: Robert Zieba <robertzieba@google.com>
Change-Id: I08aa69ef3d7bc94fe3958d8d3bc58a967e4902b3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3536607
Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'util')
-rwxr-xr-x | util/flash_ec | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/util/flash_ec b/util/flash_ec index ba7753f141..2581d35c5f 100755 --- a/util/flash_ec +++ b/util/flash_ec @@ -1496,8 +1496,26 @@ function flash_npcx_uut() { if [[ "${FLAGS_verbose}" = ${FLAGS_TRUE} ]]; then echo "${UUT_MON[*]}" fi + + local monitor_res=0 print_or_run timeout -k 10 -s 9 "${FLAGS_timeout}" \ - "${UUT_MON[@]}" || die "Failed to load monitor binary." + "${UUT_MON[@]}" || monitor_res=$? + + if [[ ${monitor_res} != 0 ]]; then + # Try to determine if WP is enabled + local dut_res=0 + local wp_state + wp_state=$(dut-control fw_wp_state) || dut_res=$? + + if [[ ${dut_res} = 0 ]]; then + if echo "${wp_state}" | grep "on"; then + die "Failed to load monitor binary, WP is enabled" + fi + fi + + die "Failed to load monitor binary." + fi + info "Programming EC firmware image." local UUT_WR=( "${NPCX_UUT}" "${UUT_ARGS[@]}" \ |