diff options
author | Tom Hughes <tomhughes@chromium.org> | 2021-01-15 15:06:36 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-01-29 22:17:16 +0000 |
commit | 44b9b136b800159e0d62e33cf42b967573cfb270 (patch) | |
tree | ce0da69b1703d36cd6e3afa803f2ecb546af2c63 /util | |
parent | 9a2920efeffc04953ce01489ef1a5669e8662232 (diff) | |
download | chrome-ec-44b9b136b800159e0d62e33cf42b967573cfb270.tar.gz |
util/flash_ec: Clean up FPMCU flashing
Add FPMCU-specific controls for flashing instead of relying on the
"usbpd" versions.
BRANCH=none
BUG=b:177331210
TEST=With dragonclaw v0.2 connected to servo micro:
(chroot) $ sudo servod -b dragonclaw
(chroot) $ ./util/flash_ec --verbose --board bloonchipper --image
./build/bloonchipper/ec.bin
(chroot) $ screen $(dut-control raw_fpmcu_console_uart_pty |
cut -d: -f2)
Cq-Depend: chromium:2637964, chromium:2638338
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Change-Id: I0cb772f9dffd472a1e2f65a37cb714e04cf038f3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2638136
Reviewed-by: Craig Hesling <hesling@chromium.org>
Diffstat (limited to 'util')
-rwxr-xr-x | util/flash_ec | 55 |
1 files changed, 42 insertions, 13 deletions
diff --git a/util/flash_ec b/util/flash_ec index 8497331256..b2ac32720c 100755 --- a/util/flash_ec +++ b/util/flash_ec @@ -377,7 +377,7 @@ case "${BOARD}" in chocodile_bec ) MCU="usbpd" ;; oak_pd|samus_pd|strago_pd ) MCU="usbpd" ;; chell_pd|glados_pd ) MCU="usbpd" ;; - bloonchipper|dartmonkey|hatch_fp|nami_fp|nocturne_fp ) MCU="usbpd" ;; + bloonchipper|dartmonkey|hatch_fp|nami_fp|nocturne_fp ) MCU="fpmcu" ;; dingdong|hoho|twinkie ) DUT_CONTROL_CMD=( "true" ); MCU="ec" ;; *) MCU="ec" ;; esac @@ -461,6 +461,10 @@ servo_usbpd_hard_reset() { dut_control usbpd_reset:on sleep:0.5 usbpd_reset:off } +servo_fpmcu_hard_reset() { + dut_control fpmcu_reset:on sleep:0.5 fpmcu_reset:off +} + servo_sh_hard_reset() { dut_control sh_reset:on dut_control sh_reset:off @@ -521,6 +525,14 @@ servo_usbpd_boot0() { dut_control usbpd_boot_mode:$1 } +servo_fpmcu_boot0() { + dut_control fpmcu_boot_mode:"$1" +} + +servo_micro_fpmcu_boot0() { + servo_fpmcu_boot0 "$@" +} + servo_micro_usbpd_boot0() { servo_usbpd_boot0 "$@" } @@ -704,11 +716,27 @@ function ec_image() { die "no EC image found : build one or specify one." } +# Get the correct UART for flashing. The resulting string is concatenated with +# the various UART control suffixes, such as "_pty", "_en", "_parity", etc. +function servo_ec_uart_prefix() { + if [[ "${MCU}" == "fpmcu" ]]; then + # The FPMCU has multiple UARTs. Use the platform UART since it's a + # bootloader capable UART on all devices. See + # http://go/cros-fingerprint-reference-designs#uart-console. + echo "fpmcu_platform_uart" + return + fi + + echo "${MCU}_uart" +} + # Find the EC UART provided by servo. function servo_ec_uart() { SERVOD_FAIL="Cannot communicate with servod. Is servod running?" - PTY=$(dut_control_get raw_${MCU}_uart_pty || - dut_control_get ${MCU}_uart_pty) + local EC_UART_PREFIX + EC_UART_PREFIX="$(servo_ec_uart_prefix)" + PTY=$(dut_control_get "raw_${EC_UART_PREFIX}_pty" || + dut_control_get "${EC_UART_PREFIX}_pty") if [[ -z "${PTY}" ]]; then die "${SERVOD_FAIL}" fi @@ -1058,6 +1086,7 @@ function flash_stm32() { TOOL_PATH="${EC_DIR}/build/${BOARD}/util:$PATH" STM32MON=$(PATH="${TOOL_PATH}" which stm32mon) EC_UART="$(servo_ec_uart)" + EC_UART_PREFIX="$(servo_ec_uart_prefix)" if [ ! -x "$STM32MON" ]; then die "no stm32mon util found." fi @@ -1074,14 +1103,14 @@ function flash_stm32() { ec_reset if ! on_raiden && [[ "${SERVO_TYPE}" =~ "servo" ]] ; then - servo_save_add "${MCU}_uart_en" + servo_save_add "${EC_UART_PREFIX}_en" - dut_control ${MCU}_uart_en:on + dut_control "${EC_UART_PREFIX}_en:on" fi - servo_save_add "${MCU}_uart_parity" + servo_save_add "${EC_UART_PREFIX}_parity" - dut_control ${MCU}_uart_parity:even + dut_control "${EC_UART_PREFIX}_parity:even" if [[ "${SERVO_TYPE}" =~ "ccd_cr50" ]] ; then case "${FLAGS_bitbang_rate}" in @@ -1093,15 +1122,15 @@ function flash_stm32() { esac info "Programming at ${FLAGS_bitbang_rate} baud" - servo_save_add "${MCU}_uart_baudrate" - servo_save_add "${MCU}_uart_bitbang_en" + servo_save_add "${EC_UART_PREFIX}_baudrate" + servo_save_add "${EC_UART_PREFIX}_bitbang_en" - dut_control ${MCU}_uart_baudrate:"${FLAGS_bitbang_rate}" - dut_control ${MCU}_uart_bitbang_en:on + dut_control "${EC_UART_PREFIX}_baudrate:${FLAGS_bitbang_rate}" + dut_control "${EC_UART_PREFIX}_bitbang_en:on" else - servo_save_add "${MCU}_uart_baudrate" + servo_save_add "${EC_UART_PREFIX}_baudrate" - dut_control ${MCU}_uart_baudrate:115200 + dut_control "${EC_UART_PREFIX}_baudrate:115200" fi # Add a delay long enough for cr50 to update the ccdstate. Cr50 updates |