diff --git a/platform/fm1.c b/platform/fm1.c index 4a112cd..5d325bb 100644 --- a/platform/fm1.c +++ b/platform/fm1.c @@ -542,7 +542,7 @@ void fm1_cstart(void) { if (boot_mode == BOOT_RECOVERY || recovery_key()) { recovery_main(); /* OCT- at power-on: the USB rescue */ } - flash_ok = FL_FAR(fl_jedec_ram)() == 0x856014u; + flash_ok = FL_JEDEC_OK(FL_FAR(fl_jedec_ram)()); ota_boot_cleanup(); lcd_init(); lcd_fill(0, 0, 240, 240, C_BLACK); diff --git a/platform/hal/fm1_flash.h b/platform/hal/fm1_flash.h index 2d7df3b..4cc7f60 100644 --- a/platform/hal/fm1_flash.h +++ b/platform/hal/fm1_flash.h @@ -35,6 +35,7 @@ static inline void *fl_far(void *p) { void *volatile q = p; return q; } #define T4_CNT REG32(0x10804u) /* TIMER4, 24 MHz free-running */ #define FL_XIP(off) FM1_XIP(off) /* fm1_xip.h */ +#define FL_JEDEC_OK(id) ((id) == 0x856014u || (id) == 0xB36014u) /* the FM-1's part up to 2026, the newer FM-1s' */ #define FL_DATA_LO 0x00097000u /* Felucca main store */ #define FL_DATA_HI 0x000E0000u #define FL_GLOB_LO 0x000FC000u /* Felucca superblock / globals */ @@ -143,7 +144,7 @@ RAMINL int fl_wait_ready(uint32_t max_us, uint32_t *took_us) /* ---- entry points: IRQs OFF, args/buffers in RAM ---- */ -static RAMFN uint32_t fl_jedec_ram(void) /* expect 0x856014 */ +static RAMFN uint32_t fl_jedec_ram(void) /* FL_JEDEC_OK */ { fl_saved_t s; uint32_t id; if (fl_enter(&s)) return 0; diff --git a/platform/loader/loader.c b/platform/loader/loader.c index 837a775..848800d 100644 --- a/platform/loader/loader.c +++ b/platform/loader/loader.c @@ -70,7 +70,7 @@ static void ldr_record_clear(void) { fm1_updata_parm_clear(); /* CRC 0: the SPL ignores it on a warm reset */ } -static int ldr_flash_known(void) { return fl_jedec_ram() == 0x856014u; } /* as the app (project.c) */ +static int ldr_flash_known(void) { return FL_JEDEC_OK(fl_jedec_ram()); } /* as the app (fm1.c) */ static void ldr_progress(uint32_t done, uint32_t total) { (void)done; (void)total; ldr_poll(); } #include "ldr_core.c" diff --git a/platform/src/recovery.c b/platform/src/recovery.c index 977ae21..8f7d068 100644 --- a/platform/src/recovery.c +++ b/platform/src/recovery.c @@ -56,7 +56,7 @@ static void recovery_main(void) recovery_last = recovery_usb_last = fm1_ticks(); recovery_fraction = fm1_ms = 0; /* No persist_boot or OTA cleanup: no flash write just for entering rescue. */ - flash_ok = FL_FAR(fl_jedec_ram)() == 0x856014u; + flash_ok = FL_JEDEC_OK(FL_FAR(fl_jedec_ram)()); lcd_init(); lcd_fill(0, 0, 240, 240, C_BLACK); draw_text_box(0, 64, 240, &FONT_S, APP_NAME " USB RESCUE", C_WHITE, 1);