summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorDave Parker <dparker@chromium.org>2013-01-16 14:29:37 -0800
committerChromeBot <chrome-bot@google.com>2013-01-17 13:44:24 -0800
commit3182778dbb72b1250e1275523fa5bd01c6d7e968 (patch)
tree6f6d7f072d19834f6f15ed2626d5fac5e434dd15 /util
parentb24b745f81541554ed7719fdaba9073b4ec40bd9 (diff)
downloadchrome-ec-3182778dbb72b1250e1275523fa5bd01c6d7e968.tar.gz
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. 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>
Diffstat (limited to 'util')
-rwxr-xr-xutil/flash_ec19
1 files changed, 15 insertions, 4 deletions
diff --git a/util/flash_ec b/util/flash_ec
index 194270d1fc..4031250fd3 100755
--- a/util/flash_ec
+++ b/util/flash_ec
@@ -16,6 +16,8 @@ DEFINE_boolean ro "${FLAGS_FALSE}" \
"Write only the read-only partition"
DEFINE_string offset "0" \
"Offset where to program the image from."
+DEFINE_boolean unprotect "${FLAGS_FALSE}" \
+ "Clear the protect flag."
# Parse command line
FLAGS_HELP="usage: $0 [flags]"
@@ -32,8 +34,8 @@ cleanup() {
fi
# reset the EC
- dut_control cold_reset:on
- dut_control cold_reset:off
+ dut_control cold_reset:on
+ dut_control cold_reset:off
}
trap cleanup EXIT
@@ -106,6 +108,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
@@ -122,13 +128,18 @@ function flash_daisy() {
function flash_link() {
OCD_CFG="servo_v2_slower.cfg"
OCD_PATH="${SRC_ROOT}/platform/ec/chip/lm4/openocd"
- OCD_CMDS="init ; flash_lm4 ${IMG} ${FLAGS_offset}; shutdown;"
+ OCD_CMDS="init; flash_lm4 ${IMG} ${FLAGS_offset};"
+ 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}" || \
- die "Failed to program ${IMG}"
+ die "Failed to program ${IMG}"
}
IMG="$(ec_image)"