summaryrefslogtreecommitdiff
path: root/util/flash_ec
diff options
context:
space:
mode:
Diffstat (limited to 'util/flash_ec')
-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