Skip to content

Commit 9250abb

Browse files
committed
Fixed erase address in case of NVM + FLAGS_HOME
1 parent 04111a6 commit 9250abb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/libwolfboot.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ static int RAMFUNCTION nvm_select_fresh_sector(int part)
191191
int sel;
192192
uintptr_t off;
193193
uint8_t *base;
194-
uint8_t* addrErase;
194+
uint8_t* addrErase = 0;
195195
uint32_t magic_off = 0;
196196
uint32_t word_0;
197197
uint32_t word_1;
@@ -205,8 +205,13 @@ static int RAMFUNCTION nvm_select_fresh_sector(int part)
205205
}
206206
else {
207207
base = (uint8_t *)PART_UPDATE_ENDFLAGS;
208+
#ifdef FLAGS_HOME
209+
addrErase = (uint8_t *)WOLFBOOT_PARTITION_BOOT_ADDRESS +
210+
WOLFBOOT_PARTITION_SIZE - WOLFBOOT_SECTOR_SIZE;
211+
#else
208212
addrErase = (uint8_t *)WOLFBOOT_PARTITION_UPDATE_ADDRESS +
209213
WOLFBOOT_PARTITION_SIZE - WOLFBOOT_SECTOR_SIZE;
214+
#endif
210215
}
211216

212217
#ifdef EXT_ENCRYPTED

0 commit comments

Comments
 (0)