2022-06-09 22:34:30 +02:00
|
|
|
/****************************************************************************
|
2022-10-31 15:47:33 +01:00
|
|
|
* boards/xtensa/esp32s3/common/scripts/protected_memory.ld
|
2022-06-09 22:34:30 +02:00
|
|
|
* ESP32-S3 Linker Script Memory Layout
|
|
|
|
*
|
|
|
|
* This file describes the memory layout (memory blocks) as virtual
|
|
|
|
* memory addresses.
|
|
|
|
*
|
2022-10-31 15:47:33 +01:00
|
|
|
* kernel-space.ld contains output sections to link compiler output
|
2022-06-09 22:34:30 +02:00
|
|
|
* into these memory blocks.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
|
|
|
#define SRAM_IRAM_START 0x40370000
|
|
|
|
#define SRAM_DIRAM_I_START 0x40378000
|
2022-11-07 14:50:37 +01:00
|
|
|
|
|
|
|
/* The memory region starting from SRAM_IRAM_END up to 0x403dffff is
|
|
|
|
* reserved to the 2nd stage bootloader for actually loading the NuttX
|
|
|
|
* Application Image code and data into IRAM and DRAM. Otherwise the
|
|
|
|
* Bootloader could end up overwriting itself and failing to load the NuttX
|
|
|
|
* Application Image properly.
|
|
|
|
*
|
|
|
|
* For more information, refer to the bootloader linker scripts:
|
|
|
|
* https://github.com/espressif/esp-idf/blob/v4.4.2/components/bootloader/subproject/main/ld/esp32s3/bootloader.ld#L41-L47
|
|
|
|
*/
|
|
|
|
|
2022-11-07 14:47:20 +01:00
|
|
|
#define SRAM_IRAM_END 0x403cc700
|
2022-06-09 22:34:30 +02:00
|
|
|
#define I_D_SRAM_OFFSET (SRAM_DIRAM_I_START - SRAM_DRAM_START)
|
|
|
|
|
|
|
|
#define SRAM_DRAM_START 0x3fc88000
|
|
|
|
|
2022-11-07 14:50:37 +01:00
|
|
|
#define SRAM_DRAM_END (SRAM_IRAM_END - I_D_SRAM_OFFSET) /* 2nd stage bootloader iram_loader_seg start address */
|
2022-06-09 22:34:30 +02:00
|
|
|
#define I_D_SRAM_SIZE (SRAM_DRAM_END - SRAM_DRAM_START)
|
|
|
|
|
|
|
|
#define ICACHE_SIZE 0x8000
|
|
|
|
|
|
|
|
#define SRAM_IRAM_ORG (SRAM_IRAM_START + CONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE)
|
|
|
|
#define SRAM_IRAM_SIZE (I_D_SRAM_SIZE + ICACHE_SIZE - CONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE)
|
|
|
|
|
|
|
|
#define DCACHE_SIZE 0x10000
|
|
|
|
#define SRAM_DRAM_ORG (SRAM_DRAM_START)
|
|
|
|
|
|
|
|
#ifdef CONFIG_ESP32S3_FLASH_4M
|
|
|
|
# define FLASH_SIZE 0x400000
|
|
|
|
#elif defined (CONFIG_ESP32S3_FLASH_8M)
|
|
|
|
# define FLASH_SIZE 0x800000
|
|
|
|
#elif defined (CONFIG_ESP32S3_FLASH_16M)
|
|
|
|
# define FLASH_SIZE 0x1000000
|
|
|
|
#endif
|
|
|
|
|
|
|
|
MEMORY
|
|
|
|
{
|
2022-11-17 21:10:59 +01:00
|
|
|
metadata (RX) : org = 0x0, len = 0x30
|
|
|
|
ROM (RX) : org = 0x30, len = 0x100000
|
2022-10-31 15:47:33 +01:00
|
|
|
|
2022-11-17 21:10:59 +01:00
|
|
|
/* Instruction RAM */
|
2022-06-09 22:34:30 +02:00
|
|
|
|
2022-11-17 21:10:59 +01:00
|
|
|
UIRAM (RWX) : org = SRAM_IRAM_ORG, len = 16K
|
|
|
|
KIRAM (RWX) : org = ORIGIN(UIRAM) + LENGTH(UIRAM), len = 32K
|
2022-06-09 22:34:30 +02:00
|
|
|
|
|
|
|
/* Flash mapped instruction data. */
|
|
|
|
|
2022-10-31 15:47:33 +01:00
|
|
|
/* The 0x20 offset for the KIROM region is a convenience for the Kernel
|
|
|
|
* binary image generation in Espressif Application Image format.
|
2022-06-09 22:34:30 +02:00
|
|
|
* Flash cache has 64KB pages. The .bin file which is flashed to the chip
|
|
|
|
* has a 0x18 byte file header, and each segment has a 0x08 byte segment
|
|
|
|
* header. Setting this offset makes it simple to meet the flash cache MMU's
|
|
|
|
* constraint that (paddr % 64KB == vaddr % 64KB).
|
|
|
|
*/
|
|
|
|
|
2022-10-31 15:47:33 +01:00
|
|
|
KIROM (RX) : org = 0x42000020, len = 0x80000 - 0x20
|
|
|
|
UIROM (RX) : org = 0x42080000, len = 0x180000
|
2022-06-09 22:34:30 +02:00
|
|
|
|
2022-10-31 15:47:33 +01:00
|
|
|
/* Shared data RAM, excluding memory reserved for ROM bss/data/stack. */
|
2022-06-09 22:34:30 +02:00
|
|
|
|
2022-11-17 21:10:59 +01:00
|
|
|
KDRAM (RW) : org = ORIGIN(KIRAM) + LENGTH(KIRAM) - I_D_SRAM_OFFSET, len = 64K
|
|
|
|
UDRAM (RW) : org = ORIGIN(KDRAM) + LENGTH(KDRAM), len = 256K
|
2022-06-09 22:34:30 +02:00
|
|
|
|
|
|
|
/* Flash mapped constant data */
|
|
|
|
|
2022-10-31 15:47:33 +01:00
|
|
|
/* See KIROM region documentation above for the meaning of the 0x20 offset.
|
|
|
|
*
|
2022-11-17 21:10:59 +01:00
|
|
|
* The 0x30 offset for the UDROM region is a convenience for the User
|
2022-10-31 15:47:33 +01:00
|
|
|
* binary image generation following a custom image format, which defines
|
|
|
|
* a "metadata" output section containing some information that the Kernel
|
2022-11-17 21:10:59 +01:00
|
|
|
* needs for properly configuring the External Flash MMU and initializing
|
|
|
|
* SRAM contents when loading the User application image.
|
2022-06-09 22:34:30 +02:00
|
|
|
*/
|
|
|
|
|
2022-10-31 15:47:33 +01:00
|
|
|
KDROM (R) : org = 0x3c000020, len = 0x80000 - 0x20
|
2022-11-17 21:10:59 +01:00
|
|
|
UDROM (R) : org = 0x3c080030, len = 0x180000 - 0x30
|
2022-06-09 22:34:30 +02:00
|
|
|
}
|
|
|
|
|