Fix reading corrupted memory.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos 2022-09-22 19:24:17 +02:00
parent 3092da23ed
commit 91e2b7f643
No known key found for this signature in database
GPG key ID: C0095B7870A4CCD3

View file

@ -235,10 +235,10 @@ void scan_region(bool persistent) {
}
}
}
void wait_flash_finish();
void scan_flash() {
initialize_flash(false); //soft initialization
if (*(uintptr_t *)end_data_pool == 0xffffffff && *(uintptr_t *)(end_data_pool+sizeof(uintptr_t)) == 0xffffffff)
if (*(uintptr_t *)flash_read(end_rom_pool) == 0xffffffff && *(uintptr_t *)flash_read(end_rom_pool+sizeof(uintptr_t)) == 0xffffffff)
{
printf("First initialization (or corrupted!)\r\n");
uint8_t empty[sizeof(uintptr_t)*2+sizeof(uint32_t)];