system: add kconfig option for using parts of SRAM1 for IRAM

Using parts of SRAM1 for IRAM allows apps with more statically allocated IRAM

Closes https://github.com/espressif/esp-idf/issues/9824
This commit is contained in:
Marius Vikhammer
2022-11-24 14:05:40 +08:00
parent a15c36f987
commit 5cbd311ecf
8 changed files with 66 additions and 5 deletions
+15 -2
View File
@@ -48,6 +48,13 @@ ASSERT((CONFIG_ESP32_FIXED_STATIC_RAM_SIZE <= 0x2c200),
#define DRAM0_0_SEG_LEN 0x2c200
#endif
#if CONFIG_ESP_SYSTEM_ESP32_SRAM1_REGION_AS_IRAM
#define SRAM1_IRAM_LEN 0xA000
#else
#define SRAM1_IRAM_LEN 0x0
#endif
MEMORY
{
/* All these values assume the flash cache is on, and have the blocks this uses subtracted from the length
@@ -55,7 +62,7 @@ MEMORY
are connected to the data port of the CPU and eg allow bytewise access. */
/* IRAM for PRO cpu. Not sure if happy with this, this is MMU area... */
iram0_0_seg (RX) : org = 0x40080000, len = 0x20000
iram0_0_seg (RX) : org = 0x40080000, len = 0x20000 + SRAM1_IRAM_LEN
#ifdef CONFIG_APP_BUILD_USE_FLASH_SECTIONS
/* Even though the segment name is iram, it is actually mapped to flash
@@ -121,8 +128,14 @@ _heap_start = 0x3FFB0000 + DRAM0_0_SEG_LEN;
_heap_start = _heap_low_start;
#endif
/* Heap ends at top of dram0_0_seg */
_sram1_iram_start = 0x400A0000;
_sram1_iram_len = ( _iram_end > _sram1_iram_start) ? (_iram_end - _sram1_iram_start) : 0;
_heap_end = ALIGN(0x40000000 - _sram1_iram_len - 3, 4);
#if CONFIG_ESP32_TRACEMEM_RESERVE_DRAM != 0
_heap_end = 0x40000000 - CONFIG_ESP32_TRACEMEM_RESERVE_DRAM;
#endif
_data_seg_org = ORIGIN(rtc_data_seg);
@@ -41,4 +41,19 @@ menu "Memory"
This is possible due to handling of exceptions `LoadStoreError (3)` and `LoadStoreAlignmentError (9)`
Each unaligned read/write access will incur a penalty of maximum of 167 CPU cycles.
menu "Non-backward compatible options"
config ESP_SYSTEM_ESP32_SRAM1_REGION_AS_IRAM
bool "Reserve parts of SRAM1 for app IRAM (WARNING, read help before enabling)"
depends on !ESP32_TRAX
help
Reserve parts of SRAM1 for app IRAM which was previously reserved for bootloader DRAM.
If booting an app on an older bootloader from before this option was introduced, the app may fail
to boot due to overlapping memory areas. If this is the case please test carefully before pushing out
any OTA updates.
The bootloader DRAM memory should be sufficient for any non-modified IDF bootloader.
endmenu
endmenu # Memory