From bedb649edf9a4e0d451daccda72ae35634b80dde Mon Sep 17 00:00:00 2001 From: Stanislav Ponomarev Date: Tue, 27 Feb 2024 00:26:17 +0400 Subject: [PATCH] esp32/boards/ESP32_GENERIC_S3: Add 4MiB partitioning board variant. Added a 4MiB flash partitioning variant for ESP32S3: adds support for 4MiB discrete flash boards or ESP32-S3FH4R2 with embedded 4MiB flash based ones. Tested on the waveshare ESP32-S3 Mini w/ESP32-S3FH4R2. Signed-off-by: Stanislav Ponomarev --- ports/esp32/boards/ESP32_GENERIC_S3/board.json | 3 ++- ports/esp32/boards/ESP32_GENERIC_S3/board.md | 4 +++- ports/esp32/boards/ESP32_GENERIC_S3/mpconfigboard.cmake | 7 +++++++ ports/esp32/boards/ESP32_GENERIC_S3/sdkconfig.flash_4m | 4 ++++ 4 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 ports/esp32/boards/ESP32_GENERIC_S3/sdkconfig.flash_4m diff --git a/ports/esp32/boards/ESP32_GENERIC_S3/board.json b/ports/esp32/boards/ESP32_GENERIC_S3/board.json index 671936c922ce..c9794dba8613 100644 --- a/ports/esp32/boards/ESP32_GENERIC_S3/board.json +++ b/ports/esp32/boards/ESP32_GENERIC_S3/board.json @@ -18,6 +18,7 @@ "url": "https://www.espressif.com/en/products/modules", "vendor": "Espressif", "variants": { - "SPIRAM_OCT": "Support for Octal-SPIRAM" + "SPIRAM_OCT": "Support for Octal-SPIRAM", + "FLASH_4M": "4MiB flash" } } diff --git a/ports/esp32/boards/ESP32_GENERIC_S3/board.md b/ports/esp32/boards/ESP32_GENERIC_S3/board.md index cc902eeb89fe..16930c9193c5 100644 --- a/ports/esp32/boards/ESP32_GENERIC_S3/board.md +++ b/ports/esp32/boards/ESP32_GENERIC_S3/board.md @@ -1,7 +1,9 @@ The following files are firmware that should work on most ESP32-S3-based -boards with 8MiB of flash, including WROOM and MINI modules. +boards with 4/8MiB of flash, including WROOM and MINI modules. This firmware supports configurations with and without SPIRAM (also known as PSRAM) and will auto-detect a connected SPIRAM chip at startup and allocate the MicroPython heap accordingly. However if your board has Octal SPIRAM, then use the "spiram-oct" variant. + +If your board has 4MiB flash (including ESP32-S3FH4R2 based ones with embedded flash), then use the "flash-4m" build. diff --git a/ports/esp32/boards/ESP32_GENERIC_S3/mpconfigboard.cmake b/ports/esp32/boards/ESP32_GENERIC_S3/mpconfigboard.cmake index c60f1c280a3e..1f7440353b6c 100644 --- a/ports/esp32/boards/ESP32_GENERIC_S3/mpconfigboard.cmake +++ b/ports/esp32/boards/ESP32_GENERIC_S3/mpconfigboard.cmake @@ -20,3 +20,10 @@ if(MICROPY_BOARD_VARIANT STREQUAL "SPIRAM_OCT") MICROPY_HW_BOARD_NAME="Generic ESP32S3 module with Octal-SPIRAM" ) endif() + +if(MICROPY_BOARD_VARIANT STREQUAL "FLASH_4M") + set(SDKCONFIG_DEFAULTS + ${SDKCONFIG_DEFAULTS} + boards/ESP32_GENERIC_S3/sdkconfig.flash_4m + ) +endif() diff --git a/ports/esp32/boards/ESP32_GENERIC_S3/sdkconfig.flash_4m b/ports/esp32/boards/ESP32_GENERIC_S3/sdkconfig.flash_4m new file mode 100644 index 000000000000..c967c46ae6be --- /dev/null +++ b/ports/esp32/boards/ESP32_GENERIC_S3/sdkconfig.flash_4m @@ -0,0 +1,4 @@ +CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y +CONFIG_ESPTOOLPY_FLASHSIZE_8MB= + +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MiB.csv"