Skip to content

Add esp32s2psram dev target with mbedTLS PSRAM override#1202

Merged
gskjold merged 1 commit into
mainfrom
feature/esp32s2psram
Jun 12, 2026
Merged

Add esp32s2psram dev target with mbedTLS PSRAM override#1202
gskjold merged 1 commit into
mainfrom
feature/esp32s2psram

Conversation

@gskjold

@gskjold gskjold commented Jun 12, 2026

Copy link
Copy Markdown
Member

Adds an esp32s2psram build env for ESP32-S2 boards with PSRAM, including an mbedTLS PSRAM allocation override. Dev/build target only; not part of the release matrix. Builds clean (and esp32 unaffected).

Tasmota's prebuilt mbedTLS sets CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=1,
which forces every TLS allocation into internal SRAM and ignores
PSRAM even when it's available.  Override the calloc/free hooks at
runtime so SSL record buffers and BIGNUM workspace land in PSRAM,
freeing ~40 KB of internal heap during an active TLS session.

The override is gated by both the BOARD_HAS_PSRAM compile flag and
a runtime ESP.getPsramSize() > 0 check, so production board profiles
(esp32dev, esp32-solo1, esp32-s2-saola-1, esp32-c3-devkitm-1,
esp32-s3-devkitc-1 — none of which define BOARD_HAS_PSRAM) are
completely unaffected.  Fallback to MALLOC_CAP_INTERNAL preserves
today's behavior if PSRAM allocation ever fails.

Also adds an [env:esp32s2psram] platformio.ini target for the Wemos
S2 Mini (lolin_s2_mini, ESP32-S2FNR2) used for dev/testing.
@github-actions

Copy link
Copy Markdown

🔧 PR Build Artifacts

Version: 566bcdd

All environments built successfully. Download the zip files:

Artifacts expire after 7 days. View workflow run

@gskjold gskjold merged commit d68bf56 into main Jun 12, 2026
7 checks passed
@gskjold gskjold deleted the feature/esp32s2psram branch June 12, 2026 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant