Merge pull request #297 from UweBonnes/write_size
target: Fix calculation of erase size.
This commit is contained in:
commit
231d42d581
|
@ -199,7 +199,8 @@ int target_flash_erase(target *t, target_addr addr, size_t len)
|
|||
int ret = 0;
|
||||
while (len) {
|
||||
struct target_flash *f = flash_for_addr(t, addr);
|
||||
size_t tmplen = MIN(len, f->length - (addr % f->length));
|
||||
size_t tmptarget = MIN(addr + len, f->start + f->length);
|
||||
size_t tmplen = tmptarget - addr;
|
||||
ret |= f->erase(f, addr, tmplen);
|
||||
addr += tmplen;
|
||||
len -= tmplen;
|
||||
|
|
Loading…
Reference in New Issue