esp32.ld 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /* ESP32 Linker Script Memory Layout
  2. This file describes the memory layout (memory blocks) as virtual
  3. memory addresses.
  4. esp32.project.ld contains output sections to link compiler output
  5. into these memory blocks.
  6. ***
  7. This linker script is passed through the C preprocessor to include
  8. configuration options.
  9. Please use preprocessor features sparingly! Restrict
  10. to simple macros with numeric values, and/or #if/#endif blocks.
  11. */
  12. #include "sdkconfig.h"
  13. /* If BT is not built at all */
  14. #ifndef CONFIG_BT_RESERVE_DRAM
  15. #define CONFIG_BT_RESERVE_DRAM 0
  16. #endif
  17. MEMORY
  18. {
  19. /* All these values assume the flash cache is on, and have the blocks this uses subtracted from the length
  20. of the various regions. The 'data access port' dram/drom regions map to the same iram/irom regions but
  21. are connected to the data port of the CPU and eg allow bytewise access. */
  22. /* IRAM for PRO cpu. Not sure if happy with this, this is MMU area... */
  23. iram0_0_seg (RX) : org = 0x40080000, len = 0x20000
  24. /* Even though the segment name is iram, it is actually mapped to flash
  25. */
  26. iram0_2_seg (RX) : org = 0x400D0018, len = 0x330000-0x18
  27. /*
  28. (0x18 offset above is a convenience for the app binary image generation. Flash cache has 64KB pages. The .bin file
  29. which is flashed to the chip has a 0x18 byte file header. Setting this offset makes it simple to meet the flash
  30. cache MMU's constraint that (paddr % 64KB == vaddr % 64KB).)
  31. */
  32. /* Shared data RAM, excluding memory reserved for ROM bss/data/stack.
  33. Enabling Bluetooth & Trace Memory features in menuconfig will decrease
  34. the amount of RAM available.
  35. Note: Length of this section *should* be 0x50000, and this extra DRAM is available
  36. in heap at runtime. However due to static ROM memory usage at this 176KB mark, the
  37. additional static memory temporarily cannot be used.
  38. */
  39. dram0_0_seg (RW) : org = 0x3FFB0000 + CONFIG_BT_RESERVE_DRAM,
  40. len = 0x2c200 - CONFIG_BT_RESERVE_DRAM
  41. /* Flash mapped constant data */
  42. drom0_0_seg (R) : org = 0x3F400018, len = 0x400000-0x18
  43. /* (See iram0_2_seg for meaning of 0x18 offset in the above.) */
  44. /* RTC fast memory (executable). Persists over deep sleep.
  45. */
  46. rtc_iram_seg(RWX) : org = 0x400C0000, len = 0x2000
  47. /* RTC fast memory (same block as above), viewed from data bus */
  48. rtc_data_seg(RW) : org = 0x3ff80000, len = 0x2000
  49. /* RTC slow memory (data accessible). Persists over deep sleep.
  50. Start of RTC slow memory is reserved for ULP co-processor code + data, if enabled.
  51. */
  52. rtc_slow_seg(RW) : org = 0x50000000 + CONFIG_ULP_COPROC_RESERVE_MEM,
  53. len = 0x1000 - CONFIG_ULP_COPROC_RESERVE_MEM
  54. /* external memory ,including data and text */
  55. extern_ram_seg(RWX) : org = 0x3F800000,
  56. len = 0x400000
  57. }
  58. /* Heap ends at top of dram0_0_seg */
  59. _heap_end = 0x40000000 - CONFIG_TRACEMEM_RESERVE_DRAM;
  60. _data_seg_org = ORIGIN(rtc_data_seg);
  61. /* The lines below define location alias for .rtc.data section based on Kconfig option.
  62. When the option is not defined then use slow memory segment
  63. else the data will be placed in fast memory segment */
  64. #ifndef CONFIG_ESP32_RTCDATA_IN_FAST_MEM
  65. REGION_ALIAS("rtc_data_location", rtc_slow_seg );
  66. #else
  67. REGION_ALIAS("rtc_data_location", rtc_data_seg );
  68. #endif