memory.ld 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. /**
  7. * ESP32-S3 Linker Script Memory Layout
  8. * This file describes the memory layout (memory blocks) by virtual memory addresses.
  9. * This linker script is passed through the C preprocessor to include configuration options.
  10. * Please use preprocessor features sparingly!
  11. * Restrict to simple macros with numeric values, and/or #if/#endif blocks.
  12. */
  13. /*
  14. * Automatically generated file. DO NOT EDIT.
  15. * Espressif IoT Development Framework (ESP-IDF) 5.3.5 Configuration Header
  16. */
  17. /* List of deprecated options */
  18. /*
  19. * SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
  20. *
  21. * SPDX-License-Identifier: Apache-2.0
  22. */
  23. /* CPU instruction prefetch padding size for flash mmap scenario */
  24. /* Copy from esp_secure_boot.h */
  25. /*
  26. * PMP region granularity size
  27. * Software may determine the PMP granularity by writing zero to pmp0cfg, then writing all ones
  28. * to pmpaddr0, then reading back pmpaddr0. If G is the index of the least-significant bit set,
  29. * the PMP granularity is 2^G+2 bytes.
  30. */
  31. /* CPU instruction prefetch padding size for memory protection scenario */
  32. /* Memory alignment size for PMS */
  33. /* rtc timer data (s_rtc_timer_retain_mem, see esp_clk.c files). For rtc_timer_data_in_rtc_mem section. */
  34. /*
  35. * 40370000 <- IRAM/Icache -> 40378000 <- D/IRAM (I) -> 403E0000
  36. * 3FC88000 <- D/IRAM (D) -> 3FCF0000 <- DRAM/DCache -> 3FD00000
  37. *
  38. * Startup code uses the IRAM from 0x403B9000 to 0x403E0000, which is not available for static
  39. * memory, but can only be used after app starts.
  40. *
  41. * D cache use the memory from high address, so when it's configured to 16K/32K, the region
  42. * 0x3FCF000 ~ (3FD00000 - DATA_CACHE_SIZE) should be available. This region is not used as
  43. * static memory, leaving to the heap.
  44. */
  45. MEMORY
  46. {
  47. /**
  48. * All these values assume the flash cache is on, and have the blocks this uses subtracted from the length
  49. * of the various regions. The 'data access port' dram/drom regions map to the same iram/irom regions but
  50. * are connected to the data port of the CPU and eg allow byte-wise access.
  51. */
  52. /* IRAM for PRO CPU. */
  53. iram0_0_seg (RX) : org = (0x40370000 + 0x4000), len = (((0x403CB700 - (0x40378000 - 0x3FC88000)) - 0x3FC88000) + 0x8000 - 0x4000)
  54. /* Flash mapped instruction data */
  55. iram0_2_seg (RX) : org = 0x42000020, len = 0x800000-0x20
  56. /**
  57. * (0x20 offset above is a convenience for the app binary image generation.
  58. * Flash cache has 64KB pages. The .bin file which is flashed to the chip
  59. * has a 0x18 byte file header, and each segment has a 0x08 byte segment
  60. * header. Setting this offset makes it simple to meet the flash cache MMU's
  61. * constraint that (paddr % 64KB == vaddr % 64KB).)
  62. */
  63. /**
  64. * Shared data RAM, excluding memory reserved for ROM bss/data/stack.
  65. * Enabling Bluetooth & Trace Memory features in menuconfig will decrease the amount of RAM available.
  66. */
  67. dram0_0_seg (RW) : org = (0x3FC88000), len = ((0x403CB700 - (0x40378000 - 0x3FC88000)) - 0x3FC88000)
  68. /* Flash mapped constant data */
  69. drom0_0_seg (R) : org = 0x3C000020, len = 0x2000000-0x20
  70. /* (See iram0_2_seg for meaning of 0x20 offset in the above.) */
  71. /**
  72. * RTC fast memory (executable). Persists over deep sleep.
  73. */
  74. rtc_iram_seg(RWX) : org = 0x600fe000, len = 0x2000 - (0 + (24))
  75. /* We reduced the size of rtc_iram_seg by RESERVE_RTC_MEM value.
  76. It reserves the amount of RTC fast memory that we use for this memory segment.
  77. This segment is intended for keeping:
  78. - (lower addr) rtc timer data (s_rtc_timer_retain_mem, see esp_clk.c files).
  79. - (higher addr) bootloader rtc data (s_bootloader_retain_mem, when a Kconfig option is on).
  80. The aim of this is to keep data that will not be moved around and have a fixed address.
  81. */
  82. rtc_reserved_seg(RW) : org = 0x600fe000 + 0x2000 - (0 + (24)), len = (0 + (24))
  83. /**
  84. * RTC slow memory (data accessible). Persists over deep sleep.
  85. * Start of RTC slow memory is reserved for ULP co-processor code + data, if enabled.
  86. */
  87. rtc_slow_seg(RW) : org = 0x50000000 , len = 0x2000
  88. /**
  89. * `extern_ram_seg` and `drom0_0_seg` share the same bus and the address region.
  90. * A dummy section is used to avoid overlap. See `.ext_ram.dummy` in `sections.ld.in`
  91. */
  92. extern_ram_seg(RWX) : org = 0x3c000020 , len = 0x2000000-0x20
  93. }
  94. _diram_i_start = 0x40378000;
  95. _heap_start = _heap_low_start;
  96. /* Heap ends at top of dram0_0_seg */
  97. _heap_end = 0x40000000;
  98. _data_seg_org = ORIGIN(rtc_data_seg);
  99. /* RTC fast memory shares the same range for both data and instructions */
  100. REGION_ALIAS("rtc_data_seg", rtc_iram_seg );
  101. REGION_ALIAS("rtc_data_location", rtc_slow_seg );
  102. REGION_ALIAS("default_code_seg", iram0_2_seg);
  103. REGION_ALIAS("default_rodata_seg", drom0_0_seg);
  104. /**
  105. * If rodata default segment is placed in `drom0_0_seg`, then flash's first rodata section must
  106. * also be first in the segment.
  107. */
  108. ASSERT(_flash_rodata_dummy_start == ORIGIN(default_rodata_seg),
  109. ".flash_rodata_dummy section must be placed at the beginning of the rodata segment.")