Skip to content

Conversation

@gustavonihei
Copy link
Contributor

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_HEAP extension 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_SPIRAM no longer auto selects XTENSA_IMEM_USE_SEPARATE_HEAP.
XTENSA_IMEM_USE_SEPARATE_HEAP is now selected by ESP32_IMM_HEAP, which in turn is not enabled by default.

Drivers that previously relied on XTENSA_IMEM_USE_SEPARATE_HEAP now bring in ESP32_IMM_HEAP if ESP32_SPIRAM is also selected, with the notable exception from ESP32_WIFI.

ESP32_WIFI previously used XTENSA_IMEM_USE_SEPARATE_HEAP for allocating dynamic data into Internal RAM via a specific API. With this PR, there is now an alternative approach using MM_KERNEL_HEAP. So it is up to the user to either select ESP32_IMM_HEAP or MM_KERNEL_HEAP.
In order to keep the current behavior, custom board users shall select ESP32_IMM_HEAP on Kconfig.

Testing

Successful execution of ostest in esp32-devkitc:psram_usrheap defconfig.
Successful connection to Wi-Fi network using a custom version of esp32-devkitc:wapi.

image

@gustavonihei gustavonihei added the breaking change This change requires a mitigation entry in the release notes. label Jan 17, 2023
@gustavonihei gustavonihei force-pushed the testing/psram_usrheap branch from ad37c07 to 4032a72 Compare January 17, 2023 16:54
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
@gustavonihei gustavonihei force-pushed the testing/psram_usrheap branch from 4032a72 to e9a7f96 Compare January 17, 2023 17:30
@xiaoxiang781216 xiaoxiang781216 merged commit a4c9da9 into apache:master Jan 18, 2023
@gustavonihei gustavonihei deleted the testing/psram_usrheap branch January 18, 2023 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change This change requires a mitigation entry in the release notes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants