diff options
author | Shelley Chen <shchen@chromium.org> | 2015-01-20 11:12:06 -0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-01-23 00:28:49 +0000 |
commit | 7e9fc466b08ec8cb52019538a1a3608a3e9690a8 (patch) | |
tree | fcb808afc2bf93880006d00a634dc5900fae4df9 | |
parent | da733f3aae80afa30f6d12a3032972eb08d06635 (diff) | |
download | chrome-ec-7e9fc466b08ec8cb52019538a1a3608a3e9690a8.tar.gz |
flash_ec: fixing servo v3 support for beaglebone
Adding setup_openocd function to take care of setup of either servo v2 and or
servo v3 setup (setting up OCD_PATH and OCD_CFG variables). Have modified
flash_link, flash_lm4, and flash_npcx functions to use setup_openocd function.
BUG=chromium:412249
BRANCH=None
TEST=made sure that outputted flash_ec command lines prior/after change on host
are identical for link and peppy. Also made sure that flash_ec command
works on peppy with updated image on beaglebone. Also ran "make runtests".
Change-Id: Iacf42fae1f175d6acd08bbd16352afb8f3bd21b0
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/242043
Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rwxr-xr-x | util/flash_ec | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/util/flash_ec b/util/flash_ec index 9cfc19baa1..8124781669 100755 --- a/util/flash_ec +++ b/util/flash_ec @@ -311,6 +311,25 @@ function free_pty() { # Board specific flashing scripts +# helper function for setting up servo v2/3 with openocd paths +function setup_openocd() { + if [[ -z "${EC_DIR}" ]]; then + # check if we're on beaglebone + if [[ -e "/usr/bin/lib" ]]; then + OCD_CFG="servo_v3.cfg" + OCD_PATH="/usr/bin/lib" + else + die "Cannot locate openocd configs" + fi + else + if [ "${FLAGS_usb}" = ${FLAGS_TRUE} ] ; then + OCD_CFG="${BOARD}.cfg" + else + OCD_CFG="servo_v2.cfg" + fi + fi +} + function flash_stm32() { TOOL_PATH="${EC_DIR}/build/${BOARD}/util:$PATH" STM32MON=$(PATH="${TOOL_PATH}" which stm32mon) @@ -366,10 +385,9 @@ function flash_stm32_dfu() { } function flash_link() { - [[ -n "${EC_DIR}" ]] || die "Cannot locate openocd script" - - OCD_CFG="servo_v2.cfg" OCD_PATH="${EC_DIR}/chip/lm4/openocd" + setup_openocd + OCD_CMDS="init; flash_lm4 ${IMG} ${FLAGS_offset};" if [ "${FLAGS_unprotect}" = ${FLAGS_TRUE} ] ; then info "Clearing write protect flag." @@ -385,15 +403,9 @@ function flash_link() { } function flash_lm4() { - [[ -n "${EC_DIR}" ]] || die "Cannot locate openocd script" - - if [ "${FLAGS_usb}" = ${FLAGS_TRUE} ] ; then - OCD_CFG="${BOARD}.cfg" - else - OCD_CFG="servo_v2.cfg" - fi - OCD_PATH="${EC_DIR}/chip/lm4/openocd" + setup_openocd + OCD_CMDS="init; flash_lm4 ${IMG} ${FLAGS_offset};" if [ "${FLAGS_unprotect}" = ${FLAGS_TRUE} ] ; then # Unprotect exists, but isn't needed because erasing pstate is @@ -410,15 +422,9 @@ function flash_lm4() { } function flash_npcx() { - [[ -n "${EC_DIR}" ]] || die "Cannot locate openocd script" - - if [ "${FLAGS_usb}" = ${FLAGS_TRUE} ] ; then - OCD_CFG="${BOARD}.cfg" - else - OCD_CFG="servo_v2.cfg" - fi - OCD_PATH="${EC_DIR}/chip/npcx/openocd" + setup_openocd + if [ "${FLAGS_unprotect}" = ${FLAGS_TRUE} ] ; then # Unprotect exists, but isn't needed because erasing pstate is # implicit in writing the entire image |