summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChromeOS Developer <dparker@chromium.org>2014-03-18 22:10:30 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-07-31 02:17:06 +0000
commitdbf62710f78959df7b4bd9a6e21fb977aac6370f (patch)
treec97ab30e78f328bf2d5b5befa7551873389b239b
parent68dd21c56077171426928e9e12ee6c1c656846af (diff)
downloadchrome-ec-dbf62710f78959df7b4bd9a6e21fb977aac6370f.tar.gz
Make board names in flash_ec less prone to conflicts
BUG=None BRANCH=None TEST=Run util/flash_ec on peppy, spring, link. Verify flashing complete successfully. Change-Id: Ib388af6800ae208934d5b026a63f0567d31ef86e Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/191304 Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rwxr-xr-xutil/flash_ec63
1 files changed, 54 insertions, 9 deletions
diff --git a/util/flash_ec b/util/flash_ec
index 5658b8039d..ee311e8243 100755
--- a/util/flash_ec
+++ b/util/flash_ec
@@ -39,6 +39,37 @@ die() {
exit 1
}
+# Note: Link is a special case and is not included here.
+BOARDS_LM4=(
+ falco
+ peppy
+ rambi
+ samus
+ squawks
+)
+
+BOARDS_STM32=(
+ big
+ blaze
+ discovery
+ firefly
+ fruitpie
+ nyan
+ pit
+ plankton
+ ryu
+ ryu_sh
+ samus_pd
+ snow
+ spring
+ veyron
+ zinger
+)
+
+BOARDS_STM32_DFU=(
+ twinkie
+)
+
# Flags
DEFINE_string board "${DEFAULT_BOARD}" \
"The board to run debugger on."
@@ -65,6 +96,18 @@ set -e
SERVO_TYPE=servo
+in_array() {
+ local n=$#
+ local value=${!n}
+
+ for (( i=1; i<$#; i++ )) do
+ if [ "${!i}" == "${value}" ]; then
+ return 0
+ fi
+ done
+ return 1
+}
+
# reset the EC
toad_ec_hard_reset() {
if dut_control cold_reset 2>/dev/null ; then
@@ -327,14 +370,16 @@ info "${MCU} UART pty : ${EC_UART}"
save="$(servo_save)"
-case "${BOARD}" in
- big | discovery | nyan | pit | snow | spring | veyron ) flash_stm32 ;;
- fruitpie | zinger | firefly | samus_pd | ryu | ryu_sh ) flash_stm32 ;;
- plankton ) flash_stm32 ;;
- twinkie) flash_stm32_dfu ;;
- falco | peppy | rambi | samus | squawks ) flash_lm4 ;;
- link ) flash_link ;;
- *) die "board ${BOARD} not supported" ;;
-esac
+if $(in_array "${BOARDS_LM4[@]}" "${BOARD}"); then
+ flash_lm4
+elif $(in_array "${BOARDS_STM32[@]}" "${BOARD}"); then
+ flash_stm32
+elif $(in_array "${BOARDS_STM32_DFU[@]}" "${BOARD}"); then
+ flash_stm32_dfu
+elif [ "${BOARD}" == "link" ]; then
+ flash_link
+else
+ die "board ${BOARD} not supported"
+fi
info "Flashing done."