Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xtensa/esp32s3: Support malloc from external RAM and internal RAM #11144

Conversation

cwespressif
Copy link
Contributor

Summary

This PR intends to enable the separation of Kernel and Userspace heaps in ESP32S3 operating under Flat mode.

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

Testing

  • Successful execution of ostest in esp32s3-devkit:psram_usrheap defconfig.
  • Successful connection to Wi-Fi network using a custom version of esp32s3-devkit:wapi and enable SPIRAM config: CONFIG_ESP32S3_SPIRAM/CONFIG_ESP32S3_SPIRAM_USER_HEAP/CONFIG_XTENSA_IMEM_USE_SEPARATE_HEAP

企业微信截图_16983983556458

@yamt
Copy link
Contributor

yamt commented Nov 8, 2023

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).

just curious; did it actually make wifi work better?

@cwespressif
Copy link
Contributor Author

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).

just curious; did it actually make wifi work better?

  • If WiFi internal malloc from external RAM, it will cause the system to block, using this PR can avoid Wi-Fi internal malloc from external RAM. In addition, the kernel drivers uses kmm_malloc to apply for memory from internal RAM rather than external RAM, which can usually avoid some possible performance problems or compatibility issues.


#ifdef CONFIG_MM_KERNEL_HEAP
#define HEAP_REGION1_END 0x3fccfff0
#define HEAP_REGION2_START 0x3fcd0000
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add indent

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

@jerpelea jerpelea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add commit message!

Enables the allocation of the entire Userspace heap into SPI RAM and reserving the Internal RAM exclusively for the Kernel heap.
1. Disable psram as task stack to avoid system blocking.
2. Add some function comments.
@cwespressif cwespressif force-pushed the feature/esp32s3_support_malloc_from_psram_and_iram branch from 20e97d5 to 30269fb Compare November 8, 2023 12:10
@acassis acassis merged commit 5239d01 into apache:master Nov 8, 2023
26 checks passed
@jerpelea jerpelea added this to To-Add in Release Notes - 12.4.0 Dec 27, 2023
@jerpelea jerpelea moved this from To-Add to processed in Release Notes - 12.4.0 Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants