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>
This commit is contained in:
Dominic Chen
2014-08-09 20:36:37 -07:00
committed by chrome-internal-fetch
parent fd9eed96fd
commit 67281b9807

View File

@@ -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