bootloader.ld 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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. *libesp_common.a:fpga_overrides.*(.literal.bootloader_fill_random .text.bootloader_fill_random)
  28. *libbootloader_support.a:bootloader_efuse_esp32s2.*(.literal .text .literal.* .text.*)
  29. *libbootloader_support.a:bootloader_utility.*(.literal .text .literal.* .text.*)
  30. *libbootloader_support.a:bootloader_sha.*(.literal .text .literal.* .text.*)
  31. *libbootloader_support.a:bootloader_console_loader.*(.literal .text .literal.* .text.*)
  32. *libbootloader_support.a:bootloader_panic.*(.literal .text .literal.* .text.*)
  33. *libbootloader_support.a:bootloader_soc.*(.literal .text .literal.* .text.*)
  34. *libbootloader_support.a:esp_image_format.*(.literal .text .literal.* .text.*)
  35. *libbootloader_support.a:flash_encrypt.*(.literal .text .literal.* .text.*)
  36. *libbootloader_support.a:flash_encryption_secure_features.*(.literal .text .literal.* .text.*)
  37. *libbootloader_support.a:flash_partitions.*(.literal .text .literal.* .text.*)
  38. *libbootloader_support.a:secure_boot.*(.literal .text .literal.* .text.*)
  39. *libbootloader_support.a:secure_boot_secure_features.*(.literal .text .literal.* .text.*)
  40. *libbootloader_support.a:secure_boot_signatures_bootloader.*(.literal .text .literal.* .text.*)
  41. *libmicro-ecc.a:*.*(.literal .text .literal.* .text.*)
  42. *libspi_flash.a:*.*(.literal .text .literal.* .text.*)
  43. *libhal.a:wdt_hal_iram.*(.literal .text .literal.* .text.*)
  44. *libesp_hw_support.a:rtc_clk.*(.literal .text .literal.* .text.*)
  45. *libesp_hw_support.a:rtc_time.*(.literal .text .literal.* .text.*)
  46. *libesp_hw_support.a:regi2c_ctrl.*(.literal .text .literal.* .text.*)
  47. *libefuse.a:*.*(.literal .text .literal.* .text.*)
  48. *(.fini.literal)
  49. *(.fini)
  50. *(.gnu.version)
  51. _loader_text_end = ABSOLUTE(.);
  52. } > iram_loader_seg
  53. .iram.text :
  54. {
  55. . = ALIGN (16);
  56. *(.entry.text)
  57. *(.init.literal)
  58. *(.init)
  59. } > iram_seg
  60. /* Shared RAM */
  61. .dram0.bss (NOLOAD) :
  62. {
  63. . = ALIGN (8);
  64. _dram_start = ABSOLUTE(.);
  65. _bss_start = ABSOLUTE(.);
  66. *(.dynsbss)
  67. *(.sbss)
  68. *(.sbss.*)
  69. *(.gnu.linkonce.sb.*)
  70. *(.scommon)
  71. *(.sbss2)
  72. *(.sbss2.*)
  73. *(.gnu.linkonce.sb2.*)
  74. *(.dynbss)
  75. *(.bss)
  76. *(.bss.*)
  77. *(.gnu.linkonce.b.*)
  78. *(COMMON)
  79. . = ALIGN (8);
  80. _bss_end = ABSOLUTE(.);
  81. } >dram_seg
  82. .dram0.data :
  83. {
  84. _data_start = ABSOLUTE(.);
  85. *(.data)
  86. *(.data.*)
  87. *(.gnu.linkonce.d.*)
  88. *(.data1)
  89. *(.sdata)
  90. *(.sdata.*)
  91. *(.gnu.linkonce.s.*)
  92. *(.sdata2)
  93. *(.sdata2.*)
  94. *(.gnu.linkonce.s2.*)
  95. *(.jcr)
  96. _data_end = ABSOLUTE(.);
  97. } >dram_seg
  98. .dram0.rodata :
  99. {
  100. _rodata_start = ABSOLUTE(.);
  101. *(.rodata)
  102. *(.rodata.*)
  103. *(.gnu.linkonce.r.*)
  104. *(.rodata1)
  105. __XT_EXCEPTION_TABLE_ = ABSOLUTE(.);
  106. *(.xt_except_table)
  107. *(.gcc_except_table)
  108. *(.gnu.linkonce.e.*)
  109. *(.gnu.version_r)
  110. *(.eh_frame)
  111. . = (. + 3) & ~ 3;
  112. /* C++ constructor and destructor tables, properly ordered: */
  113. __init_array_start = ABSOLUTE(.);
  114. KEEP (*crtbegin.*(.ctors))
  115. KEEP (*(EXCLUDE_FILE (*crtend.*) .ctors))
  116. KEEP (*(SORT(.ctors.*)))
  117. KEEP (*(.ctors))
  118. __init_array_end = ABSOLUTE(.);
  119. KEEP (*crtbegin.*(.dtors))
  120. KEEP (*(EXCLUDE_FILE (*crtend.*) .dtors))
  121. KEEP (*(SORT(.dtors.*)))
  122. KEEP (*(.dtors))
  123. /* C++ exception handlers table: */
  124. __XT_EXCEPTION_DESCS_ = ABSOLUTE(.);
  125. *(.xt_except_desc)
  126. *(.gnu.linkonce.h.*)
  127. __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
  128. *(.xt_except_desc_end)
  129. *(.dynamic)
  130. *(.gnu.version_d)
  131. _rodata_end = ABSOLUTE(.);
  132. /* Literals are also RO data. */
  133. _lit4_start = ABSOLUTE(.);
  134. *(*.lit4)
  135. *(.lit4.*)
  136. *(.gnu.linkonce.lit4.*)
  137. _lit4_end = ABSOLUTE(.);
  138. . = ALIGN(4);
  139. _dram_end = ABSOLUTE(.);
  140. } >dram_seg
  141. .iram.text :
  142. {
  143. _stext = .;
  144. _text_start = ABSOLUTE(.);
  145. *(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
  146. *(.iram .iram.*) /* catch stray IRAM_ATTR */
  147. *(.fini.literal)
  148. *(.fini)
  149. *(.gnu.version)
  150. /** CPU will try to prefetch up to 16 bytes of
  151. * of instructions. This means that any configuration (e.g. MMU, PMS) must allow
  152. * safe access to up to 16 bytes after the last real instruction, add
  153. * dummy bytes to ensure this
  154. */
  155. . += 16;
  156. _text_end = ABSOLUTE(.);
  157. _etext = .;
  158. } > iram_seg
  159. }