From 91e2b7f643b75ed3c76bfee416ec4f7b57b0c108 Mon Sep 17 00:00:00 2001 From: Pol Henarejos Date: Thu, 22 Sep 2022 19:24:17 +0200 Subject: [PATCH] Fix reading corrupted memory. Signed-off-by: Pol Henarejos --- src/fs/file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fs/file.c b/src/fs/file.c index 6ef34a6..f65c2b6 100644 --- a/src/fs/file.c +++ b/src/fs/file.c @@ -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)];