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-12-07 18:11:24 +01:00
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* ESP32-S3 Linker Script Memory Layout for Protected Mode
|
2022-06-09 22:34:30 +02:00
|
|
|
*
|
|
|
|
* This file describes the memory layout (memory blocks) as virtual
|
|
|
|
* memory addresses.
|
|
|
|
*
|
2022-12-07 18:11:24 +01:00
|
|
|
* kernel-space.ld and user-space.ld contain output sections to link compiler
|
|
|
|
* output into these memory blocks for the Kernel and User images,
|
|
|
|
* respectively.
|
2022-06-09 22:34:30 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#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:
|
2023-07-31 21:41:43 +02:00
|
|
|
* https://github.com/espressif/esp-idf/blob/dbb64db552068d440c2659294dcf2a5544fe3b6b/components/bootloader/subproject/main/ld/esp32s3/bootloader.ld#L52
|
2022-11-07 14:50:37 +01:00
|
|
|
*/
|
|
|
|
|
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
|
2022-12-07 18:11:24 +01:00
|
|
|
ROM (RX) : org = ORIGIN(metadata) + LENGTH(metadata),
|
2023-07-31 21:41:43 +02:00
|
|
|
len = FLASH_SIZE - ORIGIN(ROM)
|
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).
|
|
|
|
*/
|
|
|
|
|
2023-07-31 21:41:43 +02:00
|
|
|
KIROM (RX) : org = 0x42000020, len = CONFIG_ESP32S3_KERNEL_IMAGE_SIZE - 0x20
|
|
|
|
UIROM (RX) : org = ORIGIN(KIROM) + LENGTH(KIROM), len = FLASH_SIZE - LENGTH(KIROM)
|
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
|
|
|
|
2023-07-31 21:41:43 +02:00
|
|
|
KDRAM (RW) : org = ORIGIN(KIRAM) + LENGTH(KIRAM) - I_D_SRAM_OFFSET, len = CONFIG_ESP32S3_KERNEL_RAM_SIZE
|
|
|
|
UDRAM (RW) : org = ORIGIN(KDRAM) + LENGTH(KDRAM), len = I_D_SRAM_SIZE - LENGTH(KDRAM)
|
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
|
|
|
*/
|
|
|
|
|
2023-07-31 21:41:43 +02:00
|
|
|
KDROM (R) : org = 0x3c000020, len = CONFIG_ESP32S3_KERNEL_IMAGE_SIZE - 0x20
|
|
|
|
UDROM (R) : org = ORIGIN(KDROM) + LENGTH(KDROM) + ORIGIN(ROM), len = FLASH_SIZE - LENGTH(KDROM) - ORIGIN(ROM)
|
2022-06-09 22:34:30 +02:00
|
|
|
}
|
|
|
|
|