docs(esp_system): add detailed RTC memory layout documentation

This commit is contained in:
wuzhenghui
2026-01-09 11:15:15 +08:00
parent 9a20ef85f5
commit c17787722c
9 changed files with 369 additions and 1 deletions
@@ -12,6 +12,7 @@
Please use preprocessor features sparingly!
Restrict to simple macros with numeric values, and/or #if/#endif blocks.
*/
#include "sdkconfig.h"
#include "ld.common"
@@ -68,6 +69,61 @@ MEMORY
/* (See iram0_2_seg for meaning of 0x20 offset in the above.) */
#endif // CONFIG_APP_BUILD_USE_FLASH_SECTIONS
/**
* RTC Memory Layout for ESP32-S2
*
* ESP32-S2 has two separate RTC memory regions:
* 1. RTC FAST Memory: 8KB, used for RTC code and data
* 2. RTC SLOW Memory: 8KB, used for ULP coprocessor
*
* ==================== RTC FAST Memory ====================
* Size: 8KB (0x2000)
* IRAM View: 0x40070000 - 0x40072000 (executable)
* DRAM View: 0x3FF9E000 - 0x3FFA0000 (data access)
*
* +-----------------------------+ 0x40072000 / 0x3FFA0000 (RTC FAST memory end)
* | rtc_reserved_seg |
* | (RESERVE_RTC_MEM) |
* |- - - - - - - - - - - - - - -|
* | bootloader_data_rtc_mem | s_bootloader_retain_mem
* | (ESP_BOOTLOADER_RESERVE_RTC)|
* |- - - - - - - - - - - - - - -|
* | rtc_timer_data_in_rtc_mem | s_rtc_timer_retain_mem (24 bytes)
* | (RTC_TIMER_RESERVE_RTC) |
* +-----------------------------+ 0x40072000 - RESERVE_RTC_MEM
* | rtc_iram_seg / |
* | rtc_data_seg |
* |- - - - - - - - - - - - - - -|
* | .rtc.text | RTC wake stub code
* |- - - - - - - - - - - - - - -|
* | .rtc.data / .rtc.rodata | (when CONFIG_ESP32S2_RTCDATA_IN_FAST_MEM)
* |- - - - - - - - - - - - - - -|
* | .rtc.bss |
* +-----------------------------+ 0x40070000 / 0x3FF9E000 (RTC FAST memory start)
*
* ==================== RTC SLOW Memory ====================
* Size: 8KB (0x2000)
* Address: 0x50000000 - 0x50002000
*
* +-----------------------------+ 0x50002000 (RTC SLOW memory end)
* | rtc_slow_seg |
* |- - - - - - - - - - - - - - -|
* | .rtc.data / .rtc.rodata | (when !CONFIG_ESP32S2_RTCDATA_IN_FAST_MEM)
* |- - - - - - - - - - - - - - -|
* | .rtc.bss |
* +-----------------------------+ 0x50000000 + CONFIG_ULP_COPROC_RESERVE_MEM (if ULP enabled)
* | ULP Coprocessor Reserve | (Optional, CONFIG_ULP_COPROC_RESERVE_MEM)
* | (code + data) |
* +-----------------------------+ 0x50000000 (RTC SLOW memory start)
*
* RESERVE_RTC_MEM calculation:
* - RTC_TIMER_RESERVE_RTC = 24 bytes
* - ESP_BOOTLOADER_RESERVE_RTC = ALIGN_UP(CONFIG_BOOTLOADER_RESERVE_RTC_SIZE, 8)
*
* Note: RTC data can be placed in either FAST or SLOW memory based on
* CONFIG_ESP32S2_RTCDATA_IN_FAST_MEM configuration option.
*/
/* RTC fast memory (executable). Persists over deep sleep.
*/
rtc_iram_seg(RWX) : org = 0x40070000, len = 0x2000 - RESERVE_RTC_MEM