From 0d118ec1abe0ca7178eb8292212121064c5cb3fe Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Wed, 25 Sep 2024 13:44:30 -0300 Subject: [PATCH] soc: esp32: add SPIRAM memory test kconfig option Add kconfig to disable SPIRAM memory test. Allows faster SoC initialization when disabled. Signed-off-by: Sylvio Alves --- soc/espressif/common/Kconfig.spiram | 6 ++++++ soc/espressif/common/psram.c | 10 ++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/soc/espressif/common/Kconfig.spiram b/soc/espressif/common/Kconfig.spiram index 051131debac291..94dcf9a1676295 100644 --- a/soc/espressif/common/Kconfig.spiram +++ b/soc/espressif/common/Kconfig.spiram @@ -30,6 +30,12 @@ config ESP_SPIRAM_HEAP_SIZE help Specify size of SPIRAM heap. +config ESP_SPIRAM_MEMTEST + bool "Run memory test on SPI RAM initialization" + default y + help + Runs a memory test on initialization. Disable this for faster startup. + choice SPIRAM_MODE prompt "Mode (QUAD/OCT) of SPI RAM chip in use" default SPIRAM_MODE_QUAD diff --git a/soc/espressif/common/psram.c b/soc/espressif/common/psram.c index ca62fa9b9222ae..37e814fcc76e70 100644 --- a/soc/espressif/common/psram.c +++ b/soc/espressif/common/psram.c @@ -40,10 +40,12 @@ void esp_init_psram(void) ets_printf("External RAM size is less than configured.\n"); } - if (esp_psram_is_initialized()) { - if (!esp_psram_extram_test()) { - ets_printf("External RAM failed memory test!"); - return; + if (IS_ENABLED(CONFIG_ESP_SPIRAM_MEMTEST)) { + if (esp_psram_is_initialized()) { + if (!esp_psram_extram_test()) { + ets_printf("External RAM failed memory test!"); + return; + } } }