mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-30 19:19:21 +00:00
esp32: Add support for noinit variables in SPIRAM
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.
This commit is contained in:

committed by
Armando (Dou Yiwen)

parent
47e1b41563
commit
b85011c15f
@@ -72,6 +72,14 @@ extern "C" {
|
||||
#define EXT_RAM_ATTR
|
||||
#endif
|
||||
|
||||
#if CONFIG_SPIRAM_ALLOW_NOINIT_EXTERNAL_MEMORY
|
||||
// Forces data into external memory noinit section to avoid initialization after restart.
|
||||
#define EXT_RAM_NOINIT_ATTR _SECTION_ATTR_IMPL(".ext_ram.noinit", __COUNTER__)
|
||||
#else
|
||||
// Place in internal noinit section
|
||||
#define EXT_RAM_NOINIT_ATTR __NOINIT_ATTR
|
||||
#endif
|
||||
|
||||
// Forces data into RTC slow memory. See "docs/deep-sleep-stub.rst"
|
||||
// Any variable marked with this attribute will keep its value
|
||||
// during a deep sleep / wake cycle.
|
||||
@@ -155,4 +163,3 @@ FORCE_INLINE_ATTR TYPE& operator<<=(TYPE& a, int b) { a <<= b; return a; }
|
||||
}
|
||||
#endif
|
||||
#endif /* __ESP_ATTR_H__ */
|
||||
|
||||
|
Reference in New Issue
Block a user