From 5f9e3b1a4b4b3f45919f6f72cc46e0b94ddfd2b0 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Mon, 25 Nov 2019 07:23:47 +0100 Subject: [PATCH 1/2] cpu/esp32: change order for spi_flash_drive_init To see debug or error messages during SPI flash drive initialization, spi_flash_drive_init has to be called after stdio_init. --- cpu/esp32/startup.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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 */ From 4fe35efe2b5cf74e86aa3a3f11bd8692c11582e3 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Mon, 25 Nov 2019 07:24:17 +0100 Subject: [PATCH 2/2] cpu/esp32: mtd has to be in IRAM to work correctly --- cpu/esp32/ld/esp32.common.ld | 1 + 1 file changed, 1 insertion(+) 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(.);