Fix NVM_FLASH_WRITEONCE redundancy

Address of non-selected block to erase was shifted by one block
pull/287/head
Daniele Lacamera 2023-03-13 10:37:48 +01:00
parent 16bc109c06
commit b401dae331
1 changed files with 1 additions and 1 deletions

View File

@ -187,7 +187,7 @@ static int nvm_select_fresh_sector(int part)
}
}
/* Erase the non-selected partition */
addr_align = (uint32_t)(base - ((!sel) * WOLFBOOT_SECTOR_SIZE))
addr_align = (uint32_t)(base - ((1 + (!sel)) * WOLFBOOT_SECTOR_SIZE))
& (~(NVM_CACHE_SIZE - 1));
if (*((uint32_t*)(addr_align + WOLFBOOT_SECTOR_SIZE - sizeof(uint32_t)))
!= FLASH_WORD_ERASED) {