esp32.bootloader.ld 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /*
  2. Linker file used to link the bootloader.
  3. *WARNING* For now this linker dumps everything into IRAM/DRAM. ToDo: move
  4. some/most stuff to DROM/IROM.
  5. */
  6. /* THESE ARE THE VIRTUAL RUNTIME ADDRESSES */
  7. /* The load addresses are defined later using the AT statements. */
  8. MEMORY
  9. {
  10. /* All these values assume the flash cache is on, and have the blocks this uses subtracted from the length
  11. of the various regions. The 'data access port' dram/drom regions map to the same iram/irom regions but
  12. are connected to the data port of the CPU and eg allow bytewise access. */
  13. dport0_seg (RW) : org = 0x3FF00000, len = 0x10 /* IO */
  14. iram_seg (RWX) : org = 0x40080000, len = 0x400 /* 1k of IRAM used by bootloader functions which need to flush/enable APP CPU cache */
  15. iram_pool_1_seg (RWX) : org = 0x40078000, len = 0x8000 /* IRAM POOL1, used for APP CPU cache. We can abuse it in bootloader because APP CPU is still held in reset, until we enable APP CPU cache */
  16. dram_seg (RW) : org = 0x3FFC0000, len = 0x20000 /* Shared RAM, minus rom bss/data/stack.*/
  17. }
  18. /* Default entry point: */
  19. ENTRY(call_start_cpu0);
  20. SECTIONS
  21. {
  22. .iram1.text :
  23. {
  24. _init_start = ABSOLUTE(.);
  25. *(.UserEnter.literal);
  26. *(.UserEnter.text);
  27. . = ALIGN (16);
  28. *(.entry.text)
  29. *(.init.literal)
  30. *(.init)
  31. _init_end = ABSOLUTE(.);
  32. /* Code marked as runnning out of IRAM */
  33. _iram_text_start = ABSOLUTE(.);
  34. *(.iram1 .iram1.*)
  35. _iram_text_end = ABSOLUTE(.);
  36. } > iram_seg
  37. /* Shared RAM */
  38. .dram0.bss (NOLOAD) :
  39. {
  40. . = ALIGN (8);
  41. _bss_start = ABSOLUTE(.);
  42. *(.dynsbss)
  43. *(.sbss)
  44. *(.sbss.*)
  45. *(.gnu.linkonce.sb.*)
  46. *(.scommon)
  47. *(.sbss2)
  48. *(.sbss2.*)
  49. *(.gnu.linkonce.sb2.*)
  50. *(.dynbss)
  51. KEEP(*(.bss))
  52. *(.bss.*)
  53. *(.gnu.linkonce.b.*)
  54. *(COMMON)
  55. . = ALIGN (8);
  56. _bss_end = ABSOLUTE(.);
  57. } >dram_seg
  58. .dram0.data :
  59. {
  60. _data_start = ABSOLUTE(.);
  61. KEEP(*(.data))
  62. KEEP(*(.data.*))
  63. KEEP(*(.gnu.linkonce.d.*))
  64. KEEP(*(.data1))
  65. KEEP(*(.sdata))
  66. KEEP(*(.sdata.*))
  67. KEEP(*(.gnu.linkonce.s.*))
  68. KEEP(*(.sdata2))
  69. KEEP(*(.sdata2.*))
  70. KEEP(*(.gnu.linkonce.s2.*))
  71. KEEP(*(.jcr))
  72. _data_end = ABSOLUTE(.);
  73. } >dram_seg
  74. .dram0.rodata :
  75. {
  76. _rodata_start = ABSOLUTE(.);
  77. *(.rodata)
  78. *(.rodata.*)
  79. *(.irom1.text) /* catch stray ICACHE_RODATA_ATTR */
  80. *(.gnu.linkonce.r.*)
  81. *(.rodata1)
  82. __XT_EXCEPTION_TABLE_ = ABSOLUTE(.);
  83. *(.xt_except_table)
  84. *(.gcc_except_table)
  85. *(.gnu.linkonce.e.*)
  86. *(.gnu.version_r)
  87. *(.eh_frame)
  88. . = (. + 3) & ~ 3;
  89. /* C++ constructor and destructor tables, properly ordered: */
  90. __init_array_start = ABSOLUTE(.);
  91. KEEP (*crtbegin.o(.ctors))
  92. KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
  93. KEEP (*(SORT(.ctors.*)))
  94. KEEP (*(.ctors))
  95. __init_array_end = ABSOLUTE(.);
  96. KEEP (*crtbegin.o(.dtors))
  97. KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
  98. KEEP (*(SORT(.dtors.*)))
  99. KEEP (*(.dtors))
  100. /* C++ exception handlers table: */
  101. __XT_EXCEPTION_DESCS_ = ABSOLUTE(.);
  102. *(.xt_except_desc)
  103. *(.gnu.linkonce.h.*)
  104. __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
  105. *(.xt_except_desc_end)
  106. *(.dynamic)
  107. *(.gnu.version_d)
  108. _rodata_end = ABSOLUTE(.);
  109. /* Literals are also RO data. */
  110. _lit4_start = ABSOLUTE(.);
  111. *(*.lit4)
  112. *(.lit4.*)
  113. *(.gnu.linkonce.lit4.*)
  114. _lit4_end = ABSOLUTE(.);
  115. . = ALIGN(4);
  116. _heap_start = ABSOLUTE(.);
  117. } >dram_seg
  118. .iram_pool_1.text :
  119. {
  120. _stext = .;
  121. _text_start = ABSOLUTE(.);
  122. *(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
  123. *(.irom0.text) /* catch stray ICACHE_RODATA_ATTR */
  124. *(.fini.literal)
  125. *(.fini)
  126. *(.gnu.version)
  127. _text_end = ABSOLUTE(.);
  128. _etext = .;
  129. } >iram_pool_1_seg
  130. }