Bug fix in Flash erase function for LPC MCUs.

This commit is contained in:
Thiadmer Riemersma 2021-08-11 15:07:14 +02:00 committed by UweBonnes
parent 5eb43a1ddb
commit c7bc4b6a5d
1 changed files with 1 additions and 1 deletions

View File

@ -184,7 +184,7 @@ int lpc_flash_erase(struct target_flash *tf, target_addr addr, size_t len)
if (f->reserved_pages && ((addr + len) >= tf->length - 0x400) ) {
last_full_sector -= 1;
}
if (start >= last_full_sector) {
if (start <= last_full_sector) {
/* Sector erase */
if (lpc_iap_call(f, NULL, IAP_CMD_ERASE, start, last_full_sector, CPU_CLK_KHZ, f->bank))
return -2;