summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2017-12-20 10:15:39 +0100
committerchrome-bot <chrome-bot@chromium.org>2018-01-10 15:44:28 -0800
commit4cb76d6c526da009808579b05f8cb7c409ce2ead (patch)
tree8671b50a29aec7030f6d7447fd2740dff46a4569 /util
parente3323bee6966fbde19f445a6de449b17efbfd06b (diff)
downloadchrome-ec-4cb76d6c526da009808579b05f8cb7c409ce2ead.tar.gz
stm32mon: do not write trailing empty space
Add a tweak to get faster flashing: skip writing the empty trailing space at the end of the firmware image. On the STM32H7x3, flashing 2MB of useless bytes over UART can be really slow... Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=b:67081508 TEST=flash_ec --board=meowth_fp Change-Id: Ie396ee7d5b5771e0f6249e38da37ef8329c84ae3 Reviewed-on: https://chromium-review.googlesource.com/856978 Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'util')
-rw-r--r--util/stm32mon.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/util/stm32mon.c b/util/stm32mon.c
index b9896a00c0..c4c5de4fbf 100644
--- a/util/stm32mon.c
+++ b/util/stm32mon.c
@@ -858,6 +858,12 @@ int write_flash(int fd, struct stm32_def *chip, const char *filename,
}
fclose(hnd);
+ /* faster write: skip empty trailing space */
+ while (res && buffer[res - 1] == 0xff)
+ res--;
+ /* ensure 'res' is multiple of 4 given 'size' is and res <= size */
+ res = (res + 3) & ~3;
+
printf("Writing %d bytes at 0x%08x\n", res, offset);
written = command_write_mem(fd, offset, res, buffer);
if (written != res) {