diff --git a/soc/espressif/esp32s3/default.ld b/soc/espressif/esp32s3/default.ld index 17277f5ebcc..cfe44f010f7 100644 --- a/soc/espressif/esp32s3/default.ld +++ b/soc/espressif/esp32s3/default.ld @@ -15,18 +15,18 @@ * If no bootloader is used, we can extend it to gain more user ram. */ #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 user_iram_end = BOOTLOADER_IRAM_LOADER_SEG_START; #endif /* User available SRAM memory segments */ user_dram_seg_org = SRAM1_DRAM_START; -user_iram_seg_org = (SRAM0_IRAM_START + CONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE); -user_dram_end = (user_iram_end - IRAM_DRAM_OFFSET); -user_idram_size = (user_dram_end - SRAM1_DRAM_START); -sram0_iram_size = (SRAM0_SIZE - CONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE); -user_iram_seg_len = (user_idram_size + sram0_iram_size); +user_iram_seg_org = SRAM0_IRAM_START + CONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE; +user_dram_end = BOOTLOADER_IRAM_LOADER_SEG_START - IRAM_DRAM_OFFSET; +user_idram_size = user_dram_end - SRAM1_DRAM_START; +sram0_iram_size = SRAM0_SIZE - CONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE; +user_iram_seg_len = user_idram_size + sram0_iram_size; user_dram_seg_len = user_idram_size; /* Aliases */ diff --git a/soc/espressif/esp32s3/mcuboot.ld b/soc/espressif/esp32s3/mcuboot.ld index 01ad3aded33..a8ec6a4d150 100644 --- a/soc/espressif/esp32s3/mcuboot.ld +++ b/soc/espressif/esp32s3/mcuboot.ld @@ -23,14 +23,17 @@ #define RODATA_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; MEMORY { - iram_seg (RWX) : org = BOOTLOADER_IRAM_SEG_START, len = BOOTLOADER_IRAM_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 + iram_seg (RWX) : org = BOOTLOADER_IRAM_SEG_START, + len = BOOTLOADER_IRAM_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 IDT_LIST(RW): org = 0x3ebfe010, len = 0x2000 diff --git a/soc/espressif/esp32s3/memory.h b/soc/espressif/esp32s3/memory.h index 5675acccead..4a359c91c80 100644 --- a/soc/espressif/esp32s3/memory.h +++ b/soc/espressif/esp32s3/memory.h @@ -41,20 +41,20 @@ /* Base address used for calculating memory layout * 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 */ #define BOOTLOADER_STACK_OVERHEAD 0x0 -#define BOOTLOADER_DRAM_SEG_LEN 0x6600 -#define BOOTLOADER_IRAM_LOADER_SEG_LEN 0x2c00 -#define BOOTLOADER_IRAM_SEG_LEN 0x9000 +#define BOOTLOADER_DRAM_SEG_LEN 0x6400 +#define BOOTLOADER_IRAM_LOADER_SEG_LEN 0x1a00 +#define BOOTLOADER_IRAM_SEG_LEN 0xa000 /* 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_DRAM_SEG_START (BOOTLOADER_DRAM_SEG_END - BOOTLOADER_DRAM_SEG_LEN) -#define BOOTLOADER_IRAM_LOADER_SEG_START (BOOTLOADER_DRAM_SEG_START - \ - BOOTLOADER_IRAM_LOADER_SEG_LEN + IRAM_DRAM_OFFSET) +#define BOOTLOADER_IRAM_LOADER_SEG_START (BOOTLOADER_USER_DRAM_END - BOOTLOADER_STACK_OVERHEAD + \ + IRAM_DRAM_OFFSET - BOOTLOADER_IRAM_LOADER_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 */ #ifdef CONFIG_FLASH_SIZE