esp32: Enable SPIRAM & disable free_ram optimisation for ESP32_GENERIC_C5.#19303
esp32: Enable SPIRAM & disable free_ram optimisation for ESP32_GENERIC_C5.#19303projectgus wants to merge 4 commits into
Conversation
97151d3 to
8711aca
Compare
fc532b1 to
6c48af8
Compare
|
Code size report: |
|
I don't have a C5 board, but can test on S2 and S3. |
FWIW I've tested those already (for boards with PSRAM), and the sdkconfig ends up identical so there shouldn't be much risk of a regression there. |
This comment was marked as resolved.
This comment was marked as resolved.
Would it be better to rename |
OK, I won't test these boards. Idential sdkconfig is enough! |
This comment was marked as outdated.
This comment was marked as outdated.
These are already the ESP-IDF defaults. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
This was added with C5 support in 30c74fc, but probably unnecessary for C5 which has closer total internal RAM to C3 and C6, compared to C2 which is the chip this was added for. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
Similar to S2 & S3, it should be OK to detect at boot if present or not. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
6c48af8 to
ba63266
Compare
Have applied that change in this PR. Thanks to #18873 it's a pretty small change. Re-built all boards, and checked S2 & S3 generic board sdkconfigs again. |
They now more correctly describe what they each do. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
ba63266 to
3f5247a
Compare
|
Tested on DOIT ESP32-C5 (ESPC532 H4) devboard that has no PSRAM
Crashdumps
board package chip Details
ESPC5-32 H4https://www.lcsc.com/product-detail/C52139915.html
|

Summary
Inspired by this discussion: https://github.com/orgs/micropython/discussions/19302
Ended up making five changes:
sdkconfig.free_ramfrom the ESP32-C5, which was added with initial support in seeed_xiao_esp32c5 support (IDF v5.5) #17912. ESP32-C5 has similar internal RAM size to the ESP32-C3 & C6, so it doesn't really need this RAM optimisation which was added for C2. .The C5 is also a Wifi-6 chip, so the reduced-performance-for-more-free-RAM trade-off isn't as obvious.twothree chip-specific settings fromsdkconfig.spiram_sx, as they weren't needed (they were the defaults in ESP-IDF, already.)SPARKFUN_THINGPLUS_ESP32C5board to not include spiram config, as now part of the common C5 config.sdkconfig.spiram_*configs to better document what they are now.Testing
I have a ESP32-C5-DevKitC-1 board which I did not realise had PSRAM installed(!), so compared binary size and free memory on this board:
gc.free_mem()[*] This seems like a big drop, but
gc.mem_free()on ESP32_GENERIC_C3 is 174528 so the C5 still has more free RAM than C3 (and C3 doesn't usesdkconfig.free_ram.)This work was funded through GitHub sponsors
Trade-offs and Alternatives
sdkconfig.free_ramenabled here (especially if we can't demonstrate any performance regression), but if so we should consider enabling it for some other boards as well.sdkconfig.spiramtosdkconfig.spiram_esp32andsdkconfig.spiram_sxtosdkconfig.spiram, or something like this. Decided to keep as-is for this PR.Generative AI
I did not use generative AI tools when creating this PR.