mirror of https://github.com/wolfSSL/wolfBoot.git
stop the selSec from being applied twice to lastSector
parent
7008f68707
commit
c75101e999
|
@ -763,10 +763,11 @@ void RAMFUNCTION wolfBoot_update_trigger(void)
|
|||
hal_flash_erase(lastSector, SECTOR_FLAGS_SIZE);
|
||||
#else
|
||||
selSec = nvm_select_fresh_sector(PART_UPDATE);
|
||||
lastSector -= selSec * WOLFBOOT_SECTOR_SIZE;
|
||||
XMEMCPY(NVM_CACHE, (uint8_t*)lastSector, WOLFBOOT_SECTOR_SIZE);
|
||||
XMEMCPY(NVM_CACHE, (uint8_t*)lastSector - WOLFBOOT_SECTOR_SIZE * selSec,
|
||||
WOLFBOOT_SECTOR_SIZE);
|
||||
/* write to the non selected sector */
|
||||
hal_flash_erase(lastSector - WOLFBOOT_SECTOR_SIZE * !selSec, WOLFBOOT_SECTOR_SIZE);
|
||||
hal_flash_erase(lastSector - WOLFBOOT_SECTOR_SIZE * !selSec,
|
||||
WOLFBOOT_SECTOR_SIZE);
|
||||
hal_flash_write(lastSector - WOLFBOOT_SECTOR_SIZE * !selSec, NVM_CACHE,
|
||||
WOLFBOOT_SECTOR_SIZE);
|
||||
/* erase the previously selected sector */
|
||||
|
|
Loading…
Reference in New Issue