Error in calculating ending sector number.

This commit is contained in:
mirage 2013-01-26 11:38:27 +08:00
parent 99a23a7e1a
commit b50b3ffa86
1 changed files with 2 additions and 2 deletions

View File

@ -146,7 +146,7 @@ lpc11xx_flash_prepare(struct target_s *target, uint32_t addr, int len)
memset(&flash_pgm.p, 0, sizeof(flash_pgm.p));
flash_pgm.p.command[0] = IAP_CMD_PREPARE;
flash_pgm.p.command[1] = addr / 4096;
flash_pgm.p.command[2] = (addr + len) / 4096;
flash_pgm.p.command[2] = (addr + len - 1) / 4096;
lpc11x_iap_call(target, &flash_pgm.p, sizeof(flash_pgm.p));
if (flash_pgm.p.result[0] != IAP_STATUS_CMD_SUCCESS) {
@ -170,7 +170,7 @@ lpc11xx_flash_erase(struct target_s *target, uint32_t addr, int len)
/* and now erase them */
flash_pgm.p.command[0] = IAP_CMD_ERASE;
flash_pgm.p.command[1] = addr / 4096;
flash_pgm.p.command[2] = (addr + len) / 4096;
flash_pgm.p.command[2] = (addr + len - 1) / 4096;
flash_pgm.p.command[3] = 12000; /* XXX safe to assume this? */
lpc11x_iap_call(target, &flash_pgm.p, sizeof(flash_pgm.p));
if (flash_pgm.p.result[0] != IAP_STATUS_CMD_SUCCESS) {