bootloader.ld 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. /* Simplified memory map for the bootloader.
  2. * Make sure the bootloader can load into main memory without overwriting itself.
  3. */
  4. MEMORY
  5. {
  6. iram_seg (RWX) : org = 0x4004c000, len = 0x4000 /* SRAM Block 13 */
  7. iram_loader_seg (RWX) : org = 0x40050000, len = 0x6000 /* SRAM Block 14 & part of 15 */
  8. dram_seg (RW) : org = 0x3FFE6000, len = 0x4B00 /* Part SRAM Blocks 15 & 16, ROM static buffer starts at end of this region (reclaimed after app runs) */
  9. }
  10. /* Default entry point: */
  11. ENTRY(call_start_cpu0);
  12. SECTIONS
  13. {
  14. .iram_loader.text :
  15. {
  16. . = ALIGN (16);
  17. _loader_text_start = ABSOLUTE(.);
  18. *(.stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
  19. *(.iram1 .iram1.*) /* catch stray IRAM_ATTR */
  20. *liblog.a:(.literal .text .literal.* .text.*)
  21. *libgcc.a:(.literal .text .literal.* .text.*)
  22. *libbootloader_support.a:bootloader_clock_loader.*(.literal .text .literal.* .text.*)
  23. *libbootloader_support.a:bootloader_common_loader.*(.literal .text .literal.* .text.*)
  24. *libbootloader_support.a:bootloader_flash.*(.literal .text .literal.* .text.*)
  25. *libbootloader_support.a:bootloader_random.*(.literal .text .literal.* .text.*)
  26. *libbootloader_support.a:bootloader_random*.*(.literal.bootloader_random_disable .text.bootloader_random_disable)
  27. *libbootloader_support.a:bootloader_efuse_esp32s2.*(.literal .text .literal.* .text.*)
  28. *libbootloader_support.a:bootloader_utility.*(.literal .text .literal.* .text.*)
  29. *libbootloader_support.a:bootloader_sha.*(.literal .text .literal.* .text.*)
  30. *libbootloader_support.a:bootloader_console_loader.*(.literal .text .literal.* .text.*)
  31. *libbootloader_support.a:bootloader_panic.*(.literal .text .literal.* .text.*)
  32. *libbootloader_support.a:bootloader_soc.*(.literal .text .literal.* .text.*)
  33. *libbootloader_support.a:esp_image_format.*(.literal .text .literal.* .text.*)
  34. *libbootloader_support.a:flash_encrypt.*(.literal .text .literal.* .text.*)
  35. *libbootloader_support.a:flash_partitions.*(.literal .text .literal.* .text.*)
  36. *libbootloader_support.a:secure_boot.*(.literal .text .literal.* .text.*)
  37. *libbootloader_support.a:secure_boot_signatures_bootloader.*(.literal .text .literal.* .text.*)
  38. *libmicro-ecc.a:*.*(.literal .text .literal.* .text.*)
  39. *libspi_flash.a:*.*(.literal .text .literal.* .text.*)
  40. *libhal.a:wdt_hal_iram.*(.literal .text .literal.* .text.*)
  41. *libesp_hw_support.a:rtc_clk.*(.literal .text .literal.* .text.*)
  42. *libesp_hw_support.a:rtc_time.*(.literal .text .literal.* .text.*)
  43. *libesp_hw_support.a:regi2c_ctrl.*(.literal .text .literal.* .text.*)
  44. *libefuse.a:*.*(.literal .text .literal.* .text.*)
  45. *(.fini.literal)
  46. *(.fini)
  47. *(.gnu.version)
  48. _loader_text_end = ABSOLUTE(.);
  49. } > iram_loader_seg
  50. .iram.text :
  51. {
  52. . = ALIGN (16);
  53. *(.entry.text)
  54. *(.init.literal)
  55. *(.init)
  56. } > iram_seg
  57. /* Shared RAM */
  58. .dram0.bss (NOLOAD) :
  59. {
  60. . = ALIGN (8);
  61. _dram_start = ABSOLUTE(.);
  62. _bss_start = ABSOLUTE(.);
  63. *(.dynsbss)
  64. *(.sbss)
  65. *(.sbss.*)
  66. *(.gnu.linkonce.sb.*)
  67. *(.scommon)
  68. *(.sbss2)
  69. *(.sbss2.*)
  70. *(.gnu.linkonce.sb2.*)
  71. *(.dynbss)
  72. *(.bss)
  73. *(.bss.*)
  74. *(.gnu.linkonce.b.*)
  75. *(COMMON)
  76. . = ALIGN (8);
  77. _bss_end = ABSOLUTE(.);
  78. } >dram_seg
  79. .dram0.data :
  80. {
  81. _data_start = ABSOLUTE(.);
  82. *(.data)
  83. *(.data.*)
  84. *(.gnu.linkonce.d.*)
  85. *(.data1)
  86. *(.sdata)
  87. *(.sdata.*)
  88. *(.gnu.linkonce.s.*)
  89. *(.sdata2)
  90. *(.sdata2.*)
  91. *(.gnu.linkonce.s2.*)
  92. *(.jcr)
  93. _data_end = ABSOLUTE(.);
  94. } >dram_seg
  95. .dram0.rodata :
  96. {
  97. _rodata_start = ABSOLUTE(.);
  98. *(.rodata)
  99. *(.rodata.*)
  100. *(.gnu.linkonce.r.*)
  101. *(.rodata1)
  102. __XT_EXCEPTION_TABLE_ = ABSOLUTE(.);
  103. *(.xt_except_table)
  104. *(.gcc_except_table)
  105. *(.gnu.linkonce.e.*)
  106. *(.gnu.version_r)
  107. *(.eh_frame)
  108. . = (. + 3) & ~ 3;
  109. /* C++ constructor and destructor tables, properly ordered: */
  110. __init_array_start = ABSOLUTE(.);
  111. KEEP (*crtbegin.*(.ctors))
  112. KEEP (*(EXCLUDE_FILE (*crtend.*) .ctors))
  113. KEEP (*(SORT(.ctors.*)))
  114. KEEP (*(.ctors))
  115. __init_array_end = ABSOLUTE(.);
  116. KEEP (*crtbegin.*(.dtors))
  117. KEEP (*(EXCLUDE_FILE (*crtend.*) .dtors))
  118. KEEP (*(SORT(.dtors.*)))
  119. KEEP (*(.dtors))
  120. /* C++ exception handlers table: */
  121. __XT_EXCEPTION_DESCS_ = ABSOLUTE(.);
  122. *(.xt_except_desc)
  123. *(.gnu.linkonce.h.*)
  124. __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
  125. *(.xt_except_desc_end)
  126. *(.dynamic)
  127. *(.gnu.version_d)
  128. _rodata_end = ABSOLUTE(.);
  129. /* Literals are also RO data. */
  130. _lit4_start = ABSOLUTE(.);
  131. *(*.lit4)
  132. *(.lit4.*)
  133. *(.gnu.linkonce.lit4.*)
  134. _lit4_end = ABSOLUTE(.);
  135. . = ALIGN(4);
  136. _dram_end = ABSOLUTE(.);
  137. } >dram_seg
  138. .iram.text :
  139. {
  140. _stext = .;
  141. _text_start = ABSOLUTE(.);
  142. *(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
  143. *(.iram .iram.*) /* catch stray IRAM_ATTR */
  144. *(.fini.literal)
  145. *(.fini)
  146. *(.gnu.version)
  147. /** CPU will try to prefetch up to 16 bytes of
  148. * of instructions. This means that any configuration (e.g. MMU, PMS) must allow
  149. * safe access to up to 16 bytes after the last real instruction, add
  150. * dummy bytes to ensure this
  151. */
  152. . += 16;
  153. _text_end = ABSOLUTE(.);
  154. _etext = .;
  155. } > iram_seg
  156. }