diff --git a/cpu/esp32/ld/esp32.common.ld b/cpu/esp32/ld/esp32.common.ld index 1514f23b4687..a895ccc6de0c 100644 --- a/cpu/esp32/ld/esp32.common.ld +++ b/cpu/esp32/ld/esp32.common.ld @@ -107,6 +107,7 @@ SECTIONS /* part of RIOT ports that should run in IRAM */ *cpu.a:*(.literal .text .literal.* .text.*) *periph.a:*(.literal .text .literal.* .text.*) + *mtd.a:**(.literal .text .literal.* .text.*) INCLUDE esp32.spiram.rom-functions-iram.ld _iram_text_end = ABSOLUTE(.); diff --git a/cpu/esp32/startup.c b/cpu/esp32/startup.c index 5f1b5f962169..fd5cd318aea7 100644 --- a/cpu/esp32/startup.c +++ b/cpu/esp32/startup.c @@ -311,12 +311,6 @@ static NORETURN void IRAM system_init (void) _sys_time.tm_year + 1900, _sys_time.tm_mon + 1, _sys_time.tm_mday, _sys_time.tm_hour, _sys_time.tm_min, _sys_time.tm_sec); - #if MODULE_MTD - /* init flash drive */ - extern void spi_flash_drive_init (void); - spi_flash_drive_init(); - #endif - /* initialize the board */ board_init(); @@ -329,6 +323,12 @@ static NORETURN void IRAM system_init (void) /* print the board config */ print_board_config(); + #if MODULE_MTD + /* init flash drive */ + extern void spi_flash_drive_init (void); + spi_flash_drive_init(); + #endif + /* route a software interrupt source to CPU as trigger for thread yields */ intr_matrix_set(PRO_CPU_NUM, ETS_FROM_CPU_INTR0_SOURCE, CPU_INUM_SOFTWARE); /* set thread yield handler and enable the software interrupt */