diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2018-08-08 13:18:00 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-08-09 02:21:40 -0700 |
commit | 5affd7d824c369684212d62eb03c19a1e866624b (patch) | |
tree | 1f02bf123b694638909085b1adda6448653005b1 /util | |
parent | 1921d67b708943d972c9c6f239863079040efe84 (diff) | |
download | chrome-ec-5affd7d824c369684212d62eb03c19a1e866624b.tar.gz |
flash_ec: support stpm32mon log option
The command line option '--logfile' allows to specify the log file to
use by stm32mon.
BRANCH=none
BUG=none
TEST=invoking
./util/flash_ec --board scarlet --logfile /tmp/flash.log --image ...
results in creating of /tmp/flash.log containing record of exchange
between stm32mon and the EC.
Change-Id: I645557bcc6b457c054d441cd639c3e4151db9f07
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1168160
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Diffstat (limited to 'util')
-rwxr-xr-x | util/flash_ec | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/util/flash_ec b/util/flash_ec index c09451bf49..32b46978b3 100755 --- a/util/flash_ec +++ b/util/flash_ec @@ -192,8 +192,8 @@ DEFINE_string chip "" \ "The chip to run debugger on." DEFINE_string image "" \ "Full pathname of the EC firmware image to flash." -DEFINE_integer timeout 600 \ - "Timeout for flashing the EC, measured in seconds." +DEFINE_string logfile "" \ + "Stm32 only: pathname of the file to store communications log." DEFINE_string offset "0" \ "Offset where to program the image from." DEFINE_integer port "${DEFAULT_PORT}" \ @@ -202,6 +202,8 @@ DEFINE_boolean raiden "${FLAGS_FALSE}" \ "Use raiden_debug_spi programmer" DEFINE_boolean ro "${FLAGS_FALSE}" \ "Write only the read-only partition" +DEFINE_integer timeout 600 \ + "Timeout for flashing the EC, measured in seconds." DEFINE_boolean verbose "${FLAGS_FALSE}" \ "Verbose hw control logging" @@ -877,6 +879,8 @@ function flash_flashrom() { } function flash_stm32() { + local log_option + TOOL_PATH="${EC_DIR}/build/${BOARD}/util:$PATH" STM32MON=$(PATH="${TOOL_PATH}" which stm32mon) EC_UART="$(servo_ec_uart)" @@ -921,8 +925,14 @@ function flash_stm32() { if $(servo_has_cold_reset); then ec_reset fi + + if [ -n "${FLAGS_logfile}" ]; then + log_option="-L ${FLAGS_logfile}" + info "Saving log in ${FLAGS_logfile}" + fi + # Unprotect flash, erase, and write - STM32MON_COMMAND="${STM32MON} -d ${EC_UART} -U -u -e -w" + STM32MON_COMMAND="${STM32MON} -d ${EC_UART} ${log_option} -U -u -e -w" if [ "${FLAGS_verbose}" = ${FLAGS_TRUE} ]; then echo "${STM32MON_COMMAND}" "${IMG}" fi |