diff options
author | ChromeOS Developer <dparker@chromium.org> | 2014-03-18 22:10:30 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-04-22 18:26:39 +0000 |
commit | 03a4e4fdc1f7c482bc88b4b95a38a9d82ee800df (patch) | |
tree | 8fa9b015075e16bee4a3615e47af0103bd1ac3b0 | |
parent | 5267cdac9413182cb7006c2dd7247f2edcc50330 (diff) | |
download | chrome-ec-03a4e4fdc1f7c482bc88b4b95a38a9d82ee800df.tar.gz |
Make board names in flash_ec less prone to conflicts
BUG=None
BRANCH=rambi
TEST=Run util/flash_ec on clapper
Change-Id: Ib388af6800ae208934d5b026a63f0567d31ef86e
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/196226
Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rwxr-xr-x | util/flash_ec | 55 |
1 files changed, 47 insertions, 8 deletions
diff --git a/util/flash_ec b/util/flash_ec index dccef5d57c..a5e54ff86a 100755 --- a/util/flash_ec +++ b/util/flash_ec @@ -7,6 +7,32 @@ COMMON_SH=/usr/lib/crosutils/common.sh . "${COMMON_SH}" || exit 1 +# Note: Link is a special case and is not included here. +BOARDS_LM4=( + clapper + enguarde + expresso + falco + glimmer + gnawty + kip + peppy + rambi + quawks + samus + squawks + swanky + winky +) + +BOARDS_STM32=( + discovery + nyan + pit + snow + spring +) + # Flags DEFINE_string board "${DEFAULT_BOARD}" \ "The board to run debugger on." @@ -31,6 +57,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_hard_reset() { info "you probably need to hard-reset your EC with Refresh+Power" @@ -221,13 +259,14 @@ fi save="$(servo_save)" -case "${BOARD}" in - discovery | nyan | pit | snow | spring ) flash_stm32 ;; - falco | glimmer | peppy | rambi | samus | squawks | clapper | \ - winky | enguarde | quawks | kip | expresso | swanky \ - ) 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 [ "${BOARD}" == "link" ]; then + flash_link +else + die "board ${BOARD} not supported" +fi info "Flashing done." |