summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Hesling <hesling@chromium.org>2019-11-18 11:34:12 -0800
committerPhilip Chen <philipchen@chromium.org>2020-02-10 19:36:36 +0000
commit9fb7f7d476c2e651495448dc8d99273cf56c74ca (patch)
tree095e1e97c875def5481bb306a816dc992b7175d9
parent4f9cb30a4cade64cfc4d1e803feb0d4e13f7e379 (diff)
downloadchrome-ec-9fb7f7d476c2e651495448dc8d99273cf56c74ca.tar.gz
flash_fp_mcu: Add hello test mode
Add a "hello" mode to flash_fp_mcu that bypasses file operations. The function is to only say hello to the bootloader, in order to conduct stress tests with flash_fp_mcu. BRANCH=nocturne,hatch BUG=b:143374692,b:144729003 TEST=# Ensure PS crrev.com/c/1921705 is applied. # Run http://go/bit/hesling/5791510394044416 Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: Iadcc52f11f8186dfea35445ce5ffbb6fb40d7a36 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1921705 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Commit-Queue: Tom Hughes <tomhughes@chromium.org> Tested-by: Tom Hughes <tomhughes@chromium.org> (cherry picked from commit 0fffe36e799cd7d0d0ecc7f28d01c332cdcebd57) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2047627 Reviewed-by: Philip Chen <philipchen@chromium.org> Commit-Queue: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org>
-rw-r--r--util/flash_fp_mcu43
1 files changed, 23 insertions, 20 deletions
diff --git a/util/flash_fp_mcu b/util/flash_fp_mcu
index 0a679c0942..ec317e9413 100644
--- a/util/flash_fp_mcu
+++ b/util/flash_fp_mcu
@@ -16,13 +16,14 @@ DEFINE_boolean 'remove_flash_read_protect' "${FLAGS_TRUE}" \
DEFINE_boolean 'remove_flash_write_protect' "${FLAGS_TRUE}" \
'Remove flash write protection while performing command' 'u'
DEFINE_integer 'retries' "${DEFAULT_RETRIES}" 'Specify number of retries' 'R'
+DEFINE_boolean 'hello' "${FLAGS_FALSE}" 'Only ping the bootloader' 'H'
FLAGS_HELP="Usage: ${0} [flags] ec.bin"
# Process commandline flags
FLAGS "${@}" || exit 1
eval set -- "${FLAGS_ARGV}"
-if [[ "$#" -eq 0 ]]; then
+if [[ "$#" -eq 0 ]] && [[ "${FLAGS_hello}" -eq "${FLAGS_FALSE}" ]]; then
echo "Missing filename"
flags_help
exit 1
@@ -124,28 +125,30 @@ flash_fp_mcu_stm32() {
local stm32mon_flags="-p --retries ${STM32MON_CONNECT_RETRIES} -s ${spidev}"
- if [[ "${FLAGS_remove_flash_write_protect}" -eq "${FLAGS_TRUE}" ]]; then
- stm32mon_flags+=" -u"
- fi
-
- if [[ "${FLAGS_remove_flash_read_protect}" -eq "${FLAGS_TRUE}" ]]; then
- stm32mon_flags+=" -U"
- fi
+ if [[ "${FLAGS_hello}" -eq "${FLAGS_FALSE}" ]]; then
+ if [[ "${FLAGS_remove_flash_write_protect}" -eq "${FLAGS_TRUE}" ]]; then
+ stm32mon_flags+=" -u"
+ fi
- if [[ "${FLAGS_read}" -eq "${FLAGS_TRUE}" ]]; then
- # Read from FPMCU to file
- if [[ -e "${file}" ]]; then
- echo "Output file already exists: ${file}"
- exit 1
+ if [[ "${FLAGS_remove_flash_read_protect}" -eq "${FLAGS_TRUE}" ]]; then
+ stm32mon_flags+=" -U"
fi
- stm32mon_flags+=" -r ${file}"
- else
- # Write to FPMCU from file
- if [[ ! -f "${file}" ]]; then
- echo "Invalid image file: ${file}"
- exit 1
+
+ if [[ "${FLAGS_read}" -eq "${FLAGS_TRUE}" ]]; then
+ # Read from FPMCU to file
+ if [[ -e "${file}" ]]; then
+ echo "Output file already exists: ${file}"
+ exit 1
+ fi
+ stm32mon_flags+=" -r ${file}"
+ else
+ # Write to FPMCU from file
+ if [[ ! -f "${file}" ]]; then
+ echo "Invalid image file: ${file}"
+ exit 1
+ fi
+ stm32mon_flags+=" -e -w ${file}"
fi
- stm32mon_flags+=" -e -w ${file}"
fi