feat(sdmmc): add esp32s31 support

Enable SDMMC host support on ESP32-S31 across HAL, SOC caps, tests, examples, and documentation.
This commit is contained in:
armando
2026-05-21 09:09:28 +08:00
parent 19a716086f
commit f408e1a8bc
38 changed files with 1813 additions and 218 deletions
@@ -45,6 +45,10 @@ menu "SDMMC Test Board Configuration"
bool "ESP32-C5 breakout board"
depends on IDF_TARGET_ESP32C5
config SDMMC_BOARD_ESP32S31_KORVO_BOARD
bool "ESP32-S31 KORVO Board"
depends on IDF_TARGET_ESP32S31
config SDMMC_BOARD_CUSTOM_SD
depends on SOC_SDMMC_HOST_SUPPORTED
bool "Custom SD (choose pins)"
@@ -147,6 +151,7 @@ menu "SDMMC Test Board Configuration"
int "GPIO not routed on the board"
default 34 if IDF_TARGET_ESP32P4
default 8 if IDF_TARGET_ESP32C5
default 26 if IDF_TARGET_ESP32S31
default -1
endmenu
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -485,6 +485,34 @@ static const sdmmc_test_board_info_t s_board_info = {
},
};
#elif CONFIG_SDMMC_BOARD_ESP32S31_KORVO_BOARD
static const sdmmc_test_board_info_t s_board_info = {
.name = "ESP32-S31 KORVO Board",
.slot = {
{
.slot_exists = true,
.bus_width = 4,
.clk = SDMMC_SLOT0_IOMUX_PIN_NUM_CLK,
.cmd_mosi = SDMMC_SLOT0_IOMUX_PIN_NUM_CMD,
.d0_miso = SDMMC_SLOT0_IOMUX_PIN_NUM_D0,
.d1 = SDMMC_SLOT0_IOMUX_PIN_NUM_D1,
.d2 = SDMMC_SLOT0_IOMUX_PIN_NUM_D2,
.d3_cs = SDMMC_SLOT0_IOMUX_PIN_NUM_D3,
.d4 = GPIO_NUM_NC,
.d5 = GPIO_NUM_NC,
.d6 = GPIO_NUM_NC,
.d7 = GPIO_NUM_NC,
.cd = GPIO_NUM_NC,
.wp = GPIO_NUM_NC,
.unused_pin = 26,
},
{
.slot_exists = false,
}
},
};
#elif CONFIG_SDMMC_BOARD_CUSTOM_SD
static const sdmmc_test_board_info_t s_board_info = {
@@ -1,2 +1,2 @@
| Supported Targets | ESP32 | ESP32-P4 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-P4 | ESP32-S3 | ESP32-S31 |
| ----------------- | ----- | -------- | -------- | --------- |
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -53,6 +53,19 @@
#define SDMMC_SLOT1_D1 13
#define SDMMC_SLOT1_D2 14
#define SDMMC_SLOT1_D3 15
#elif CONFIG_IDF_TARGET_ESP32S31
#define SDMMC_SLOT0_CLK 24
#define SDMMC_SLOT0_CMD 25
#define SDMMC_SLOT0_D0 20
#define SDMMC_SLOT0_D1 21
#define SDMMC_SLOT0_D2 22
#define SDMMC_SLOT0_D3 23
#define SDMMC_SLOT1_CLK 39
#define SDMMC_SLOT1_CMD 40
#define SDMMC_SLOT1_D0 35
#define SDMMC_SLOT1_D1 36
#define SDMMC_SLOT1_D2 37
#define SDMMC_SLOT1_D3 38
#endif
TEST_CASE("SDMMC controller exhausted allocation", "[sdmmc]")
@@ -14,7 +14,7 @@ from pytest_embedded_idf.utils import idf_parametrize
],
indirect=True,
)
@idf_parametrize('target', ['esp32', 'esp32s3', 'esp32p4'], indirect=['target'])
@idf_parametrize('target', ['esp32', 'esp32s3', 'esp32p4', 'esp32s31'], indirect=['target'])
def test_sdmmc(dut: IdfDut) -> None:
# SDMMC driver can't be reinitialized if the test fails,
# so we need to reset the board between tests to avoid failing