diff --git a/arch/xtensa/src/esp32/Kconfig b/arch/xtensa/src/esp32/Kconfig index 1ad0c020c7d..ce8918e6d09 100644 --- a/arch/xtensa/src/esp32/Kconfig +++ b/arch/xtensa/src/esp32/Kconfig @@ -2032,6 +2032,15 @@ config ESP32_SPIRAM_IGNORE_NOTFOUND panic. If this is enabled, booting will complete but no PSRAM will be available. +config ESP32_SPIRAM_MEMTEST + bool "Run write-read test on SPIRAM during startup" + default y + depends on ESP32_SPIRAM_BOOT_INIT + ---help--- + If enabled, SPI RAM will be tested during initial boot. + Disabling this test will reduce startup time at the expense + of testing the external memory. + config ESP32_SPIRAM_2T_MODE bool "Enable SPI PSRAM 2T mode" depends on ESP32_SPIRAM diff --git a/arch/xtensa/src/esp32/esp32_start.c b/arch/xtensa/src/esp32/esp32_start.c index 8b0cf31a08b..ec995f7bcd5 100644 --- a/arch/xtensa/src/esp32/esp32_start.c +++ b/arch/xtensa/src/esp32/esp32_start.c @@ -257,11 +257,13 @@ static noreturn_function void __esp32_start(void) else { esp_spiram_init_cache(); +# if defined(CONFIG_ESP32_SPIRAM_MEMTEST) if (esp_spiram_test() != OK) { ets_printf("SPIRAM test failed\n"); PANIC(); } +# endif // CONFIG_ESP32_SPIRAM_MEMTEST } /* Set external memory bss section to zero */ diff --git a/arch/xtensa/src/esp32s2/Kconfig b/arch/xtensa/src/esp32s2/Kconfig index 327dad56f90..86ce1c35373 100644 --- a/arch/xtensa/src/esp32s2/Kconfig +++ b/arch/xtensa/src/esp32s2/Kconfig @@ -989,6 +989,15 @@ config ESP32S2_SPIRAM_IGNORE_NOTFOUND panic. If this is enabled, booting will complete but no PSRAM will be available. +config ESP32S2_SPIRAM_MEMTEST + bool "Run write-read test on SPIRAM during startup" + default y + depends on ESP32S2_SPIRAM_BOOT_INIT + ---help--- + If enabled, SPI RAM will be tested during initial boot. + Disabling this test will reduce startup time at the expense + of testing the external memory. + endmenu # SPI RAM Configuration menu "RTC Configuration" diff --git a/arch/xtensa/src/esp32s2/esp32s2_start.c b/arch/xtensa/src/esp32s2/esp32s2_start.c index ae0262de7b1..723dcd2671e 100644 --- a/arch/xtensa/src/esp32s2/esp32s2_start.c +++ b/arch/xtensa/src/esp32s2/esp32s2_start.c @@ -404,7 +404,13 @@ static void noreturn_function IRAM_ATTR __esp32s2_start(void) else { esp_spiram_init_cache(); - esp_spiram_test(); +# if defined(CONFIG_ESP32S2_SPIRAM_MEMTEST) + if (esp_spiram_test() != OK) + { + ets_printf("SPIRAM test failed\n"); + PANIC(); + } +# endif // CONFIG_ESP32S2_SPIRAM_MEMTEST } #endif diff --git a/arch/xtensa/src/esp32s3/Kconfig b/arch/xtensa/src/esp32s3/Kconfig index a1370b742ec..2adda6f82cd 100644 --- a/arch/xtensa/src/esp32s3/Kconfig +++ b/arch/xtensa/src/esp32s3/Kconfig @@ -1004,6 +1004,15 @@ config ESP32S3_SPIRAM_IGNORE_NOTFOUND panic. If this is enabled, booting will complete but no PSRAM will be available. +config ESP32S3_SPIRAM_MEMTEST + bool "Write-Read test on SPIRAM during startup" + default y + depends on ESP32S3_SPIRAM_BOOT_INIT + ---help--- + If enabled, SPI RAM will be tested during initial boot. + Disabling this test will reduce startup time at the expense + of testing the external memory. + endmenu # SPI RAM Configuration menu "Memory Configuration" diff --git a/arch/xtensa/src/esp32s3/esp32s3_start.c b/arch/xtensa/src/esp32s3/esp32s3_start.c index ac5bd5cbc55..90e17dacafb 100644 --- a/arch/xtensa/src/esp32s3/esp32s3_start.c +++ b/arch/xtensa/src/esp32s3/esp32s3_start.c @@ -407,11 +407,13 @@ noinstrument_function void noreturn_function IRAM_ATTR __esp32s3_start(void) PANIC(); } +# if defined(CONFIG_ESP32S3_SPIRAM_MEMTEST) if (esp_spiram_test() != OK) { ets_printf("SPIRAM test failed\n"); PANIC(); } +# endif // CONFIG_ESP32S3_SPIRAM_MEMTEST } #endif