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

Add support for using noinit variables in SPIRAM (IDFGH-2654) #4728

Closed
wants to merge 2 commits into from

Conversation

devanlai
Copy link
Contributor

@devanlai devanlai commented Feb 7, 2020

As per #4700, this pull request add support for placing non-initialized variables in SPIRAM.

This includes the following changes:

  • There's a new Kconfig option SPIRAM_ALLOW_NOINIT_EXTERNAL_MEMORY which enables the feature.
  • When the feature is enabled, EXT_RAM_NOINIT_ATTR can be used to place variables into a new non-initialized section in SPIRAM. If SPIRAM_ALLOW_NOINIT_EXTERNAL_MEMORY is disabled, it attempts to place it in regular internal RAM instead.
  • At startup, the SPIRAM memory test, if enabled, skips over any noinit sections.
  • The SPIRAM noinit section is excluded from the SPIRAM memory made available to the heap allocator.

I've tested this internally and I've found it works pretty well (with the caveat that it's important to flush the SPIRAM write-back cache before restarting to ensure everything has been written back) and I've added a simple unit test for it.

Caveats:

  • No ESP32S2 support, since I don't have any way to test it.
  • No documentation yet

Add Kconfig option SPIRAM_ALLOW_NOINIT_EXTERNAL_MEMORY
When enabled, a new linker script rule (from esp32.extram.noinit.ld)
places any variables in the .ext_ram.noinit section in SPIRAM.

This section is exempted from the startup SPIRAM memory test and is
not zero-initialized or added to the malloc pool, making it usable
for noinit variables that persist across reset.

The EXT_RAM_NOINIT_ATTR macro places variables in this section.
@github-actions github-actions bot changed the title Add support for using noinit variables in SPIRAM Add support for using noinit variables in SPIRAM (IDFGH-2654) Feb 7, 2020
@Alvin1Zhang
Copy link
Collaborator

Thanks for the contribution.

@CLAassistant
Copy link

CLA assistant check
All committers have signed the CLA.

@Alvin1Zhang
Copy link
Collaborator

Thanks for your contribution, changes have been merged with 0dad763.

@Alvin1Zhang Alvin1Zhang closed this Aug 5, 2021
@espressif-bot espressif-bot added Resolution: Done Issue is done internally Status: Done Issue is done internally labels Aug 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants