diff options
author | Dave Parker <dparker@chromium.org> | 2013-01-16 14:29:37 -0800 |
---|---|---|
committer | Dave Parker <dparker@chromium.org> | 2013-01-22 14:42:59 -0800 |
commit | df50d228d1d8f0e6bb6035fd5089b4f2d93674d6 (patch) | |
tree | 0a22acf679b18da933035307ad5b2837808ca011 | |
parent | f30d218b24e6f84a2a4baad2f1569cd8d745027c (diff) | |
download | chrome-ec-df50d228d1d8f0e6bb6035fd5089b4f2d93674d6.tar.gz |
Cherry-Pick: Add 'unprotect' flag for flashing link ec.
BRANCH=link
BUG=chromium-os:37967
TEST=Remove write protect, reflash without 'unprotect', flag
and verify the write protect flag is stil enabled with
flashrom -p internal:bus=lpc --wp-status. Power down,
then reflash with the --unprotect flag. Now verify the
write protect status flag is disabled.
Original-Change-Id: Ie05b5dc85dd31d29ab43a392fe948a52d547fff3
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41477
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Conflicts:
util/flash_ec
Change-Id: Id25104f40cfcccc4c53cbf1b8d02346f7f1322c6
Reviewed-on: https://gerrit.chromium.org/gerrit/41663
Reviewed-by: Walter Murphy <wmurphy@google.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Dave Parker <dparker@chromium.org>
Tested-by: Dave Parker <dparker@chromium.org>
-rw-r--r-- | chip/lm4/openocd/lm4x_cmds.tcl | 6 | ||||
-rwxr-xr-x | util/flash_ec | 16 |
2 files changed, 20 insertions, 2 deletions
diff --git a/chip/lm4/openocd/lm4x_cmds.tcl b/chip/lm4/openocd/lm4x_cmds.tcl index 00bec7f7b5..beb9fdbfde 100644 --- a/chip/lm4/openocd/lm4x_cmds.tcl +++ b/chip/lm4/openocd/lm4x_cmds.tcl @@ -31,6 +31,12 @@ proc flash_bds { } { flash_lm4 ../../../build/bds/ec.bin 0 262144 } +proc unprotect_link { } { + reset halt + flash erase_sector 0 254 255 + reset +} + # Boot a software using internal RAM only proc ramboot_lm4 {path} { diff --git a/util/flash_ec b/util/flash_ec index 417a823fd5..854700b099 100755 --- a/util/flash_ec +++ b/util/flash_ec @@ -14,6 +14,8 @@ DEFINE_string image "" \ "Full pathname of the EC firmware image to flash." DEFINE_boolean ro "${FLAGS_FALSE}" \ "Write only the read-only partition" +DEFINE_boolean unprotect "${FLAGS_FALSE}" \ + "Clear the protect flag." # Parse command line FLAGS_HELP="usage: $0 [flags]" @@ -90,6 +92,10 @@ function flash_daisy() { die "no stm32mon util found." fi + if [ "${FLAGS_unprotect}" = ${FLAGS_TRUE} ] ; then + die "--unprotect not supported for this board." + fi + info "Using serial flasher : ${STM32MON}" dut_control uart1_en:on @@ -107,12 +113,18 @@ function flash_link() { IMG_SIZE=262144 OCD_CFG="servo_v2_slower.cfg" OCD_PATH="${SRC_ROOT}/platform/ec/chip/lm4/openocd" - OCD_CMDS="init ; flash_lm4 ${IMG} 0 262144 ; exit" + OCD_CMDS="init ; flash_lm4 ${IMG} 0 262144 ;" + if [ "${FLAGS_unprotect}" = ${FLAGS_TRUE} ] ; then + info "Clearing write protect flag." + OCD_CMDS="${OCD_CMDS} unprotect_link;" + fi + OCD_CMDS="${OCD_CMDS} shutdown;" dut_control jtag_buf_on_flex_en:on dut_control jtag_buf_en:on - sudo openocd -s "${OCD_PATH}" -f "${OCD_CFG}" -c "${OCD_CMDS}" + sudo openocd -s "${OCD_PATH}" -f "${OCD_CFG}" -c "${OCD_CMDS}" || \ + die "Failed to program ${IMG}" } IMG="$(ec_image)" |