diff options
author | Randall Spangler <rspangler@chromium.org> | 2013-05-24 15:40:32 -0700 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-06-03 14:32:39 -0700 |
commit | a47bda8042f988929d6f981944e75146cbab2dd5 (patch) | |
tree | 9e661d70c10ebacb3589da8809ae4273be25e2f0 /util | |
parent | b490e866dc14b55a99e53d14ade4543daeba157a (diff) | |
download | chrome-ec-a47bda8042f988929d6f981944e75146cbab2dd5.tar.gz |
Make flash_ec capable of writing to an incorrectly-protected STM32
If EC-RO protects itself via the WRPx option bytes, flash_ec will fail
to reprogram it. And if EC-RO is broken/unbootable, it won't be able
to clear the WRPx option bytes itself when it sees the write protect
GPIO is not asserted.
Add the -u flag to stm32mon so that it will automatically attempt to
unprotect the flash via the option bytes.
BUG=chrome-os-partner:19723
BRANCH=none
TEST=enable write protect GPIO. Then from console, 'flashwp enable'.
Then from the chroot:
./util/flash_ec --board=pit --ro --image=build/pit/ec.RO.flat
That should successfully reflash the board.
Change-Id: Ic356d29104294d04d5e2a36dc75fd0206b89bd34
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/56659
Diffstat (limited to 'util')
-rwxr-xr-x | util/flash_ec | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/util/flash_ec b/util/flash_ec index 32301315f0..4ee207dfd1 100755 --- a/util/flash_ec +++ b/util/flash_ec @@ -152,8 +152,8 @@ function flash_daisy() { fi if [ "${FLAGS_unprotect}" = ${FLAGS_TRUE} ] ; then - # Unprotect exists, but isn't needed because it's implicit - # in writing the entire image + # Unprotect exists, but isn't needed because erasing pstate is + # implicit in writing the entire image die "--unprotect not supported for this board." fi @@ -169,10 +169,8 @@ function flash_daisy() { ec_enable_boot0 # Reset the EC ec_reset - # TODO: add -u flag to unprotect the flash so that writes will succeed - # on a chip which has temporarily protected itself via the WRPx option - # bytes. - ${STM32MON} -d ${EC_UART} -e -w ${IMG} + # Unprotect flash, erase, and write + ${STM32MON} -d ${EC_UART} -u -e -w ${IMG} } function flash_link() { @@ -197,8 +195,8 @@ function flash_slippy() { OCD_PATH="${SRC_ROOT}/platform/ec/chip/lm4/openocd" OCD_CMDS="init; flash_lm4 ${IMG} ${FLAGS_offset};" if [ "${FLAGS_unprotect}" = ${FLAGS_TRUE} ] ; then - # Unprotect exists, but isn't needed because it's implicit - # in writing the entire image + # Unprotect exists, but isn't needed because erasing pstate is + # implicit in writing the entire image die "--unprotect not supported for this board." fi OCD_CMDS="${OCD_CMDS} shutdown;" |