stm32: Force disconnect of UART prior to writing firmware.

For chromeos devices with the stm32 EC we write the firmware via
uart.  Often developers are connected to this UART for console I/O
which causes flash_ec to fail.

This change looks for any pids currently attached to the UART and
forcibly kills them prior to attempting to write the firmware.

Signed-off-by: Todd Broch <tbroch@chromium.org>

BRANCH=spring
BUG=none
TEST=manual,

./util/flash_ec --board spring ...

Forcibly grabs UART from both:
  cu -l /dev/pts/<num>
  minicom -p /dev/pts/<num>

Change-Id: Ie2a2b7aaf437c2cedd1d16e399c63068f2b02da3
Reviewed-on: https://gerrit.chromium.org/gerrit/45217
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
This commit is contained in:
Todd Broch
2013-03-12 09:37:47 -07:00
committed by ChromeBot
parent e1c1756808
commit abc11d883c

View File

@@ -104,6 +104,14 @@ function servo_restore() {
done
}
function free_pty() {
pids=$(lsof -F p 2>/dev/null -- $1 | cut -d'p' -f2)
if [ "${pids}" != "" ]; then
kill -9 ${pids}
info "You'll need to re-launch console on $1"
fi
}
# Board specific flashing scripts
function flash_daisy() {
@@ -118,6 +126,7 @@ function flash_daisy() {
fi
info "Using serial flasher : ${STM32MON}"
free_pty ${EC_UART}
dut_control uart1_en:on
dut_control uart1_parity:even