Skip to content

Commit

Permalink
be quicker about determining erased byte pattern when flashing
Browse files Browse the repository at this point in the history
  • Loading branch information
gtalusan committed Feb 27, 2016
1 parent 09a8113 commit b561d90
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/stlink-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1972,11 +1972,11 @@ int stlink_fwrite_flash(stlink_t *sl, const char* path, stm32_addr_t addr) {
ELOG("map_file() == -1\n");
return -1;
}
for(index = 0; index < mf.len; index ++) {
if (mf.base[index] == erased_pattern)
num_empty ++;
else
num_empty = 0;
for(index = mf.len - 1; index >= 0; index --) {
if (mf.base[index] != erased_pattern) {
break;
}
num_empty ++;
}
/* Round down to words */
num_empty -= (num_empty & 3);
Expand Down

0 comments on commit b561d90

Please sign in to comment.