flash_ec: Get the path of EC UART PTY only in flash_stm32

Flashing STM32 requires the EC UART. The path of EC UART PTY was
originally set under some conditions which didn't reflect the case.
Instead of fixing these conditions, this change simply moves it
inside flash_stm32() as other flash functions don't need EC UART PTY.

BRANCH=none
BUG=b:67010776
TEST=Used servo-micro to flash_ec a STM32 EC, no error on getting EC
UART PTY.

Change-Id: I20c31de8e6c7a99fde259f4f397e53325ee80b07
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/745101
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Nick Sanders <nsanders@chromium.org>
This commit is contained in:
Wai-Hong Tam
2017-10-30 15:51:15 -07:00
committed by chrome-bot
parent 254174085a
commit b9e95e9692

View File

@@ -677,11 +677,13 @@ fi
function flash_stm32() {
TOOL_PATH="${EC_DIR}/build/${BOARD}/util:$PATH"
STM32MON=$(PATH="${TOOL_PATH}" which stm32mon)
EC_UART="$(servo_ec_uart)"
if [ ! -x "$STM32MON" ]; then
die "no stm32mon util found."
fi
info "Using serial flasher : ${STM32MON}"
info "${MCU} UART pty : ${EC_UART}"
claim_pty ${EC_UART}
if [[ "${SERVO_TYPE}" =~ "servo" ]] ; then
@@ -826,9 +828,6 @@ IMG="$(ec_image)"
info "Using ${MCU} image : ${IMG}"
if ! on_raiden && [ "${NEED_SERVO}" != "no" ] ; then
EC_UART="$(servo_ec_uart)"
info "${MCU} UART pty : ${EC_UART}"
save="$(servo_save)"
fi