summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominic Chen <ddchen@chromium.org>2014-08-09 20:36:37 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-08-15 21:07:35 +0000
commit67281b98079458a2d2424bdbf2e6350a8042306f (patch)
treeb56b2f08c705b26a74645fcf60d07de5189c3034
parentfd9eed96fd5d5d0f1f69f23ac1ef25e034d6e04d (diff)
downloadchrome-ec-67281b98079458a2d2424bdbf2e6350a8042306f.tar.gz
flash_ec: add support for closed-case debugging
Passing the "--usb" argument will now utilized case-closed debugging for flashing the EC. Currently this is only supported for the samus LM4-based board. BRANCH=none BUG=none TEST=verify that when the case-closed debugging flag is set, the alternate openocd config file is used for samus, and an error is thrown for all other boards Change-Id: I0642bc2e9c2657cd8dbd83ee6e282365275d665a Signed-off-by: Dominic Chen <ddchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/211744 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rwxr-xr-xutil/flash_ec18
1 files changed, 17 insertions, 1 deletions
diff --git a/util/flash_ec b/util/flash_ec
index 495dd2eb5a..7070b70407 100755
--- a/util/flash_ec
+++ b/util/flash_ec
@@ -53,6 +53,10 @@ BOARDS_LM4=(
squawks
)
+BOARDS_LM4_USB=(
+ samus
+)
+
BOARDS_STM32=(
big
blaze
@@ -88,6 +92,8 @@ DEFINE_boolean ro "${FLAGS_FALSE}" \
"Write only the read-only partition"
DEFINE_boolean unprotect "${FLAGS_FALSE}" \
"Clear the protect flag."
+DEFINE_boolean usb "${FLAGS_FALSE}" \
+ "Use case-closed debugging over USB type-C."
# Parse command line
FLAGS_HELP="usage: $0 [flags]"
@@ -351,7 +357,12 @@ function flash_link() {
function flash_lm4() {
[[ -n "${EC_DIR}" ]] || die "Cannot locate openocd script"
- OCD_CFG="servo_v2.cfg"
+ if [ "${FLAGS_usb}" = ${FLAGS_TRUE} ] ; then
+ OCD_CFG="${BOARD}.cfg"
+ else
+ OCD_CFG="servo_v2.cfg"
+ fi
+
OCD_PATH="${EC_DIR}/chip/lm4/openocd"
OCD_CMDS="init; flash_lm4 ${IMG} ${FLAGS_offset};"
if [ "${FLAGS_unprotect}" = ${FLAGS_TRUE} ] ; then
@@ -384,6 +395,11 @@ info "${MCU} UART pty : ${EC_UART}"
save="$(servo_save)"
+if ([ "${FLAGS_usb}" = ${FLAGS_TRUE} ] && \
+ ! $(in_array "${BOARDS_LM4_USB[@]}" "${BOARD}")); then
+ die "--usb not supported for this board."
+fi
+
if $(in_array "${BOARDS_LM4[@]}" "${BOARD}"); then
flash_lm4
elif $(in_array "${BOARDS_STM32[@]}" "${BOARD}"); then