Skip to content

Commit c84d8fa

Browse files
committed
Merge pull request stlink-org#207 from jimparis/master
When ignoring the end of a file, make sure we don't ignore partial words.
2 parents bc49ed6 + 5dcd45d commit c84d8fa

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/stlink-common.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1752,8 +1752,10 @@ int stlink_fwrite_flash(stlink_t *sl, const char* path, stm32_addr_t addr) {
17521752
else
17531753
num_empty = 0;
17541754
}
1755+
/* Round down to words */
1756+
num_empty -= (num_empty & 3);
17551757
if(num_empty != 0) {
1756-
ILOG("Ignoring %d bytes of Zeros at end of file\n",num_empty);
1758+
ILOG("Ignoring %d bytes of 0x%02x at end of file\n", num_empty, erased_pattern);
17571759
mf.len -= num_empty;
17581760
}
17591761
err = stlink_write_flash(sl, addr, mf.base, mf.len);

0 commit comments

Comments
 (0)