esp32.ld 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* ESP32 Linker Script Memory Layout
  2. This file describes the memory layout (memory blocks) as virtual
  3. memory addresses.
  4. esp32.common.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. */
  36. dram0_0_seg (RW) : org = 0x3FFB0000 + CONFIG_BT_RESERVE_DRAM,
  37. len = 0x50000 - CONFIG_TRACEMEM_RESERVE_DRAM - CONFIG_BT_RESERVE_DRAM
  38. /* Flash mapped constant data */
  39. drom0_0_seg (R) : org = 0x3F400018, len = 0x400000-0x18
  40. /* (See iram0_2_seg for meaning of 0x18 offset in the above.) */
  41. /* RTC fast memory (executable). Persists over deep sleep.
  42. */
  43. rtc_iram_seg(RWX) : org = 0x400C0000, len = 0x2000
  44. /* RTC slow memory (data accessible). Persists over deep sleep.
  45. Start of RTC slow memory is reserved for ULP co-processor code + data, if enabled.
  46. */
  47. rtc_slow_seg(RW) : org = 0x50000000 + CONFIG_ULP_COPROC_RESERVE_MEM,
  48. len = 0x1000 - CONFIG_ULP_COPROC_RESERVE_MEM
  49. }
  50. /* Heap ends at top of dram0_0_seg */
  51. _heap_end = 0x40000000 - CONFIG_TRACEMEM_RESERVE_DRAM;