soc: espressif: esp32s3: fix memory utilization

Fixed bootloader memory layout.
Improved memory utilization.

Signed-off-by: Marek Matej <marek.matej@espressif.com>
This commit is contained in:
Marek Matej 2024-05-29 18:01:27 +02:00 committed by Johan Hedberg
commit 61bb79c7ea
3 changed files with 21 additions and 18 deletions

View file

@ -15,18 +15,18 @@
* If no bootloader is used, we can extend it to gain more user ram. * If no bootloader is used, we can extend it to gain more user ram.
*/ */
#ifdef CONFIG_ESP_SIMPLE_BOOT #ifdef CONFIG_ESP_SIMPLE_BOOT
user_iram_end = (DRAM_BUFFERS_START + IRAM_DRAM_OFFSET); user_iram_end = (BOOTLOADER_USER_DRAM_END + IRAM_DRAM_OFFSET);
#else #else
user_iram_end = BOOTLOADER_IRAM_LOADER_SEG_START; user_iram_end = BOOTLOADER_IRAM_LOADER_SEG_START;
#endif #endif
/* User available SRAM memory segments */ /* User available SRAM memory segments */
user_dram_seg_org = SRAM1_DRAM_START; user_dram_seg_org = SRAM1_DRAM_START;
user_iram_seg_org = (SRAM0_IRAM_START + CONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE); user_iram_seg_org = SRAM0_IRAM_START + CONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE;
user_dram_end = (user_iram_end - IRAM_DRAM_OFFSET); user_dram_end = BOOTLOADER_IRAM_LOADER_SEG_START - IRAM_DRAM_OFFSET;
user_idram_size = (user_dram_end - SRAM1_DRAM_START); user_idram_size = user_dram_end - SRAM1_DRAM_START;
sram0_iram_size = (SRAM0_SIZE - CONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE); sram0_iram_size = SRAM0_SIZE - CONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE;
user_iram_seg_len = (user_idram_size + sram0_iram_size); user_iram_seg_len = user_idram_size + sram0_iram_size;
user_dram_seg_len = user_idram_size; user_dram_seg_len = user_idram_size;
/* Aliases */ /* Aliases */

View file

@ -23,14 +23,17 @@
#define RODATA_REGION dram_seg #define RODATA_REGION dram_seg
#define ROMABLE_REGION dram_seg #define ROMABLE_REGION dram_seg
_bootloader_dram_seg_end = BOOTLOADER_DRAM_SEG_END; _bootloader_dram_seg_start = BOOTLOADER_DRAM_SEG_START;
_bootloader_iram_loader_seg_start = BOOTLOADER_IRAM_LOADER_SEG_START; _bootloader_iram_loader_seg_start = BOOTLOADER_IRAM_LOADER_SEG_START;
MEMORY MEMORY
{ {
iram_seg (RWX) : org = BOOTLOADER_IRAM_SEG_START, len = BOOTLOADER_IRAM_SEG_LEN iram_seg (RWX) : org = BOOTLOADER_IRAM_SEG_START,
iram_loader_seg (RWX) : org = BOOTLOADER_IRAM_LOADER_SEG_START, len = BOOTLOADER_IRAM_LOADER_SEG_LEN len = BOOTLOADER_IRAM_SEG_LEN
dram_seg (RW) : org = BOOTLOADER_DRAM_SEG_START, len = BOOTLOADER_DRAM_SEG_LEN iram_loader_seg (RWX) : org = BOOTLOADER_IRAM_LOADER_SEG_START,
len = BOOTLOADER_IRAM_LOADER_SEG_LEN
dram_seg (RW) : org = BOOTLOADER_DRAM_SEG_START,
len = BOOTLOADER_DRAM_SEG_LEN
#ifdef CONFIG_GEN_ISR_TABLES #ifdef CONFIG_GEN_ISR_TABLES
IDT_LIST(RW): org = 0x3ebfe010, len = 0x2000 IDT_LIST(RW): org = 0x3ebfe010, len = 0x2000

View file

@ -41,20 +41,20 @@
/* Base address used for calculating memory layout /* Base address used for calculating memory layout
* counted from Dbus backwards and back to the Ibus * counted from Dbus backwards and back to the Ibus
*/ */
#define BOOTLOADER_USABLE_DRAM_END DRAM_BUFFERS_START #define BOOTLOADER_USER_DRAM_END DRAM_BUFFERS_START
/* For safety margin between bootloader data section and startup stacks */ /* For safety margin between bootloader data section and startup stacks */
#define BOOTLOADER_STACK_OVERHEAD 0x0 #define BOOTLOADER_STACK_OVERHEAD 0x0
#define BOOTLOADER_DRAM_SEG_LEN 0x6600 #define BOOTLOADER_DRAM_SEG_LEN 0x6400
#define BOOTLOADER_IRAM_LOADER_SEG_LEN 0x2c00 #define BOOTLOADER_IRAM_LOADER_SEG_LEN 0x1a00
#define BOOTLOADER_IRAM_SEG_LEN 0x9000 #define BOOTLOADER_IRAM_SEG_LEN 0xa000
/* Start of the lower region is determined by region size and the end of the higher region */ /* Start of the lower region is determined by region size and the end of the higher region */
#define BOOTLOADER_DRAM_SEG_END (BOOTLOADER_USABLE_DRAM_END - BOOTLOADER_STACK_OVERHEAD) #define BOOTLOADER_IRAM_LOADER_SEG_START (BOOTLOADER_USER_DRAM_END - BOOTLOADER_STACK_OVERHEAD + \
#define BOOTLOADER_DRAM_SEG_START (BOOTLOADER_DRAM_SEG_END - BOOTLOADER_DRAM_SEG_LEN) IRAM_DRAM_OFFSET - BOOTLOADER_IRAM_LOADER_SEG_LEN)
#define BOOTLOADER_IRAM_LOADER_SEG_START (BOOTLOADER_DRAM_SEG_START - \
BOOTLOADER_IRAM_LOADER_SEG_LEN + IRAM_DRAM_OFFSET)
#define BOOTLOADER_IRAM_SEG_START (BOOTLOADER_IRAM_LOADER_SEG_START - BOOTLOADER_IRAM_SEG_LEN) #define BOOTLOADER_IRAM_SEG_START (BOOTLOADER_IRAM_LOADER_SEG_START - BOOTLOADER_IRAM_SEG_LEN)
#define BOOTLOADER_DRAM_SEG_END (BOOTLOADER_IRAM_SEG_START - IRAM_DRAM_OFFSET)
#define BOOTLOADER_DRAM_SEG_START (BOOTLOADER_DRAM_SEG_END - BOOTLOADER_DRAM_SEG_LEN)
/* Flash */ /* Flash */
#ifdef CONFIG_FLASH_SIZE #ifdef CONFIG_FLASH_SIZE