diff options
author | Namyoon Woo <namyoon@chromium.org> | 2019-08-22 13:13:59 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-08-26 20:23:50 +0000 |
commit | 63cbd9b2650166a9f4c777333782581dd5810a44 (patch) | |
tree | 69856b462b38178ce553b50c12b440bf4fbc7340 /util/flash_ec | |
parent | 66bb7ba71db2a8c1233bd51d06e0ece93d89ce91 (diff) | |
download | chrome-ec-63cbd9b2650166a9f4c777333782581dd5810a44.tar.gz |
flash_ec: npcx_uut uses "--read-flash" flag to read EC binary
flash_ec used to get a flash memory size from EC UART command
"flashinfo", and pass it to uartudatetool with read command.
If EC is in a bad status, then it failed to read EC binary,
because flashinfo wasn't responded.
Thanks to the patch crrev.com/c/1763888, flash_ec doesn't need to
pass the flash memory size to uartupdatetool to read binary.
Instead, it just passes "--read-flash".
This CL also handles the comparison between the different sized
binaries.
BUG=b:139752920
BRANCH=null
TEST=manually ran flash_ec on platforms.
$ util/flash_ec --board ${BRD} --image ${IMG} --verify
- Checked on hatch with ccd and servo_v2.
- Checked on liara with ccd, servo_v2 and servo_micro.
- Checked on fleex with ccd and servo_micro.
- Checked on scarlet with ccd.
Cq-Depend:chromium:1763888
Change-Id: I196420dc29ce95c6737dbc241ba92660557d2bc5
Signed-off-by: Namyoon Woo <namyoon@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1766095
Reviewed-by: Wai-Hong Tam <waihong@google.com>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Commit-Queue: Mary Ruthven <mruthven@chromium.org>
Diffstat (limited to 'util/flash_ec')
-rwxr-xr-x | util/flash_ec | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/util/flash_ec b/util/flash_ec index 684642532e..957a110786 100755 --- a/util/flash_ec +++ b/util/flash_ec @@ -876,7 +876,6 @@ function flash_flashrom() { die "Failed to determine chip size!" [[ ${SPI_SIZE} -eq 0 ]] && die "Chip size is 0!" - IMG_SIZE=$(stat -c%s "${IMG}") PATCH_SIZE=$((${SPI_SIZE} - ${IMG_SIZE})) # Temp image @@ -1044,9 +1043,10 @@ function flash_stm32() { if [[ -z "${FLAGS_read}" && "${FLAGS_verify}" == ${FLAGS_TRUE} ]]; then info "Verifying EC firmware image." if [[ "${FLAGS_verbose}" == ${FLAGS_TRUE} ]]; then - echo "diff ${IMG} ${IMG_READ}" + echo "cmp -n ${IMG_SIZE} ${IMG} ${IMG_READ}" fi - diff -q "${IMG}" "${IMG_READ}" || die "${MSG_VERIFY_FAIL}" + cmp -s -n "${IMG_SIZE}" "${IMG}" "${IMG_READ}" \ + || die "${MSG_VERIFY_FAIL}" fi # Remove the Application processor reset @@ -1261,11 +1261,6 @@ function flash_npcx_uut() { # The start address to restore monitor firmware binary local MON_ADDR="0x200C3020" - local BASE_ADDR="0x64000000" # The base flash memory address - local FLASH_SIZE # EC Flash memory size - - FLASH_SIZE=$(dut_control_get ec_flash_size) \ - && FLASH_SIZE=$(( ${FLASH_SIZE}*1024 )) || true if [ ! -x "$NPCX_UUT" ]; then die "no NPCX UART Update Tool found." @@ -1327,7 +1322,6 @@ function flash_npcx_uut() { IMG_READ="${TEMP_DIR}/ec.read.bin" DELETE_LIST+=( "${TEMP_DIR}" ) - FLASH_SIZE=$(stat -c %s "${IMG}") fi fi @@ -1336,9 +1330,7 @@ function flash_npcx_uut() { info "Reading EC firmware image." local UUT_RD=( "${NPCX_UUT}" "${UUT_ARGS[@]}" \ - "--opr=rd" "--addr=${BASE_ADDR}" \ - "--size=${FLASH_SIZE}" - "--file=${IMG_READ}" ) + "--read-flash" "--file=${IMG_READ}" ) if [[ "${FLAGS_verbose}" == ${FLAGS_TRUE} ]]; then echo "${UUT_RD[*]}" @@ -1353,10 +1345,11 @@ function flash_npcx_uut() { info "Verifying EC firmware image." if [[ "${FLAGS_verbose}" == ${FLAGS_TRUE} ]]; then - echo "diff ${IMG} ${IMG_READ}" + echo "cmp -n ${IMG_SIZE} ${IMG} ${IMG_READ}" fi - diff -q "${IMG}" "${IMG_READ}" || die "${MSG_VERIFY_FAIL}" + cmp -s -n "${IMG_SIZE}" "${IMG}" "${IMG_READ}" \ + || die "${MSG_VERIFY_FAIL}" fi } @@ -1401,6 +1394,7 @@ info "Using ${SERVO_TYPE}." if [[ -z "${FLAGS_read}" ]]; then IMG="$(ec_image)" info "Using ${MCU} image : ${IMG}" + IMG_SIZE=$(stat -c%s "${IMG}") fi if [ "${NEED_SERVO}" != "no" ] ; then |