ESP32: Enable the allocation of Userspace heap exclusively in SPI RAM under Flat mode #8166
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR intends to enable the separation of Kernel and Userspace heaps in ESP32 operating under Flat mode, by relying on the
MM_KERNEL_HEAPextension brought by #8140.This new feature enables the allocation of the entire Userspace heap into SPI RAM and reserving the Internal RAM exclusively for the Kernel heap, which may benefit some timing-constrained Kernel components (e.g. Wi-Fi driver).
Impact
Breaking change:
ESP32_SPIRAMno longer auto selectsXTENSA_IMEM_USE_SEPARATE_HEAP.XTENSA_IMEM_USE_SEPARATE_HEAPis now selected byESP32_IMM_HEAP, which in turn is not enabled by default.Drivers that previously relied on
XTENSA_IMEM_USE_SEPARATE_HEAPnow bring inESP32_IMM_HEAPifESP32_SPIRAMis also selected, with the notable exception fromESP32_WIFI.ESP32_WIFIpreviously usedXTENSA_IMEM_USE_SEPARATE_HEAPfor allocating dynamic data into Internal RAM via a specific API. With this PR, there is now an alternative approach usingMM_KERNEL_HEAP. So it is up to the user to either selectESP32_IMM_HEAPorMM_KERNEL_HEAP.In order to keep the current behavior, custom board users shall select
ESP32_IMM_HEAPon Kconfig.Testing
Successful execution of
ostestinesp32-devkitc:psram_usrheapdefconfig.Successful connection to Wi-Fi network using a custom version of
esp32-devkitc:wapi.