diff options
author | Todd Broch <tbroch@chromium.org> | 2014-06-19 15:57:50 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-06-20 06:24:34 +0000 |
commit | 246053495b3663202d34dd1b0b70302c295b32df (patch) | |
tree | 3332cabf1f05ee5840c4d2be6097590932c9d4a2 /util | |
parent | 17696e1470d152308ad39ac0ec1e61f82f4ff260 (diff) | |
download | chrome-ec-246053495b3663202d34dd1b0b70302c295b32df.tar.gz |
Twinkie: Enable flashing with dfu-util.
Twinkie only has test points for uart connection so nominally it will
need to be programmed via DFU mode over USB micro-B connection.
This CL changes from programming via flash_stm32 function and instead
adds dfu support.
BUG=chrome-os-partner:28337
TEST=util/flash_ec --board=twinkie successfully programs twinkie f/w
Change-Id: Ia5433b569579bb879bd405e98921450764510a73
Reviewed-on: https://chromium-review.googlesource.com/204749
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
Diffstat (limited to 'util')
-rwxr-xr-x | util/flash_ec | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/util/flash_ec b/util/flash_ec index 296a6189f5..1900ba0876 100755 --- a/util/flash_ec +++ b/util/flash_ec @@ -128,6 +128,7 @@ function ec_uart() { # Servo variables management case "${BOARD}" in samus_pd ) MCU="usbpd" ;; + twinkie ) DUT_CONTROL_CMD="true" ; MCU="ec" ;; *) MCU="ec" ;; esac @@ -211,6 +212,26 @@ function flash_stm32() { ${STM32MON} -d ${EC_UART} -u -e -w "${IMG}" } +function flash_stm32_dfu() { + DFU_DEVICE=0483:df11 + ADDR=0x08000000 + DFU_UTIL='dfu-util' + which $DFU_UTIL &> /dev/null || die \ + "no dfu-util util found. Did you 'sudo emerge dfu-util'" + + info "Using dfu flasher : ${DFU_UTIL}" + + dev_cnt=$(lsusb -d $DFU_DEVICE | wc -l) + if [ $dev_cnt -eq 0 ] ; then + die "unable to locate dfu device at $DFU_DEVICE" + elif [ $dev_cnt -ne 1 ] ; then + die "too many dfu devices (${dev_cnt}). Disconnect all but one." + fi + + SIZE=$(wc -c ${IMG} | cut -d' ' -f1) + sudo $DFU_UTIL -a 0 -s ${ADDR}:${SIZE} -D "${IMG}" +} + function flash_link() { OCD_CFG="servo_v2_slower.cfg" OCD_PATH="${SRC_ROOT}/platform/ec/chip/lm4/openocd" @@ -264,7 +285,8 @@ save="$(servo_save)" case "${BOARD}" in big | discovery | nyan | pit | snow | spring ) flash_stm32 ;; - fruitpie | zinger | firefly | samus_pd | twinkie) flash_stm32 ;; + fruitpie | zinger | firefly | samus_pd ) flash_stm32 ;; + twinkie) flash_stm32_dfu ;; falco | peppy | rambi | samus | squawks ) flash_lm4 ;; link ) flash_link ;; *) die "board ${BOARD} not supported" ;; |