esp32.project.ld.in 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  1. /* Default entry point: */
  2. ENTRY(call_start_cpu0);
  3. SECTIONS
  4. {
  5. /* RTC fast memory holds RTC wake stub code,
  6. including from any source file named rtc_wake_stub*.c
  7. */
  8. .rtc.text :
  9. {
  10. . = ALIGN(4);
  11. mapping[rtc_text]
  12. *rtc_wake_stub*.*(.literal .text .literal.* .text.*)
  13. _rtc_text_end = ABSOLUTE(.);
  14. } > rtc_iram_seg
  15. /*
  16. This section is required to skip rtc.text area because rtc_iram_seg and
  17. rtc_data_seg are reflect the same address space on different buses.
  18. */
  19. .rtc.dummy :
  20. {
  21. _rtc_dummy_start = ABSOLUTE(.);
  22. _rtc_fast_start = ABSOLUTE(.);
  23. . = SIZEOF(.rtc.text);
  24. _rtc_dummy_end = ABSOLUTE(.);
  25. } > rtc_data_seg
  26. /* This section located in RTC FAST Memory area.
  27. It holds data marked with RTC_FAST_ATTR attribute.
  28. See the file "esp_attr.h" for more information.
  29. */
  30. .rtc.force_fast :
  31. {
  32. . = ALIGN(4);
  33. _rtc_force_fast_start = ABSOLUTE(.);
  34. *(.rtc.force_fast .rtc.force_fast.*)
  35. . = ALIGN(4) ;
  36. _rtc_force_fast_end = ABSOLUTE(.);
  37. } > rtc_data_seg
  38. /* RTC data section holds RTC wake stub
  39. data/rodata, including from any source file
  40. named rtc_wake_stub*.c and the data marked with
  41. RTC_DATA_ATTR, RTC_RODATA_ATTR attributes.
  42. The memory location of the data is dependent on
  43. CONFIG_ESP32_RTCDATA_IN_FAST_MEM option.
  44. */
  45. .rtc.data :
  46. {
  47. _rtc_data_start = ABSOLUTE(.);
  48. mapping[rtc_data]
  49. *rtc_wake_stub*.*(.data .rodata .data.* .rodata.* .bss .bss.*)
  50. _rtc_data_end = ABSOLUTE(.);
  51. } > rtc_data_location
  52. /* RTC bss, from any source file named rtc_wake_stub*.c */
  53. .rtc.bss (NOLOAD) :
  54. {
  55. _rtc_bss_start = ABSOLUTE(.);
  56. *rtc_wake_stub*.*(.bss .bss.*)
  57. *rtc_wake_stub*.*(COMMON)
  58. mapping[rtc_bss]
  59. _rtc_bss_end = ABSOLUTE(.);
  60. } > rtc_data_location
  61. /* This section holds data that should not be initialized at power up
  62. and will be retained during deep sleep.
  63. User data marked with RTC_NOINIT_ATTR will be placed
  64. into this section. See the file "esp_attr.h" for more information.
  65. The memory location of the data is dependent on
  66. CONFIG_ESP32_RTCDATA_IN_FAST_MEM option.
  67. */
  68. .rtc_noinit (NOLOAD):
  69. {
  70. . = ALIGN(4);
  71. _rtc_noinit_start = ABSOLUTE(.);
  72. *(.rtc_noinit .rtc_noinit.*)
  73. . = ALIGN(4) ;
  74. _rtc_noinit_end = ABSOLUTE(.);
  75. } > rtc_data_location
  76. /* This section located in RTC SLOW Memory area.
  77. It holds data marked with RTC_SLOW_ATTR attribute.
  78. See the file "esp_attr.h" for more information.
  79. */
  80. .rtc.force_slow :
  81. {
  82. . = ALIGN(4);
  83. _rtc_force_slow_start = ABSOLUTE(.);
  84. *(.rtc.force_slow .rtc.force_slow.*)
  85. . = ALIGN(4) ;
  86. _rtc_force_slow_end = ABSOLUTE(.);
  87. } > rtc_slow_seg
  88. /* Get size of rtc slow data based on rtc_data_location alias */
  89. _rtc_slow_length = (ORIGIN(rtc_slow_seg) == ORIGIN(rtc_data_location))
  90. ? (_rtc_force_slow_end - _rtc_data_start)
  91. : (_rtc_force_slow_end - _rtc_force_slow_start);
  92. _rtc_fast_length = (ORIGIN(rtc_slow_seg) == ORIGIN(rtc_data_location))
  93. ? (_rtc_force_fast_end - _rtc_fast_start)
  94. : (_rtc_noinit_end - _rtc_fast_start);
  95. ASSERT((_rtc_slow_length <= LENGTH(rtc_slow_seg)),
  96. "RTC_SLOW segment data does not fit.")
  97. ASSERT((_rtc_fast_length <= LENGTH(rtc_data_seg)),
  98. "RTC_FAST segment data does not fit.")
  99. /* Send .iram0 code to iram */
  100. .iram0.vectors :
  101. {
  102. _iram_start = ABSOLUTE(.);
  103. /* Vectors go to IRAM */
  104. _init_start = ABSOLUTE(.);
  105. /* Vectors according to builds/RF-2015.2-win32/esp108_v1_2_s5_512int_2/config.html */
  106. . = 0x0;
  107. KEEP(*(.WindowVectors.text));
  108. . = 0x180;
  109. KEEP(*(.Level2InterruptVector.text));
  110. . = 0x1c0;
  111. KEEP(*(.Level3InterruptVector.text));
  112. . = 0x200;
  113. KEEP(*(.Level4InterruptVector.text));
  114. . = 0x240;
  115. KEEP(*(.Level5InterruptVector.text));
  116. . = 0x280;
  117. KEEP(*(.DebugExceptionVector.text));
  118. . = 0x2c0;
  119. KEEP(*(.NMIExceptionVector.text));
  120. . = 0x300;
  121. KEEP(*(.KernelExceptionVector.text));
  122. . = 0x340;
  123. KEEP(*(.UserExceptionVector.text));
  124. . = 0x3C0;
  125. KEEP(*(.DoubleExceptionVector.text));
  126. . = 0x400;
  127. _invalid_pc_placeholder = ABSOLUTE(.);
  128. *(.*Vector.literal)
  129. *(.UserEnter.literal);
  130. *(.UserEnter.text);
  131. . = ALIGN (16);
  132. *(.entry.text)
  133. *(.init.literal)
  134. *(.init)
  135. _init_end = ABSOLUTE(.);
  136. } > iram0_0_seg
  137. .iram0.text :
  138. {
  139. /* Code marked as runnning out of IRAM */
  140. _iram_text_start = ABSOLUTE(.);
  141. mapping[iram0_text]
  142. } > iram0_0_seg
  143. .dram0.data :
  144. {
  145. _data_start = ABSOLUTE(.);
  146. _bt_data_start = ABSOLUTE(.);
  147. *libbt.a:(.data .data.*)
  148. . = ALIGN (4);
  149. _bt_data_end = ABSOLUTE(.);
  150. _btdm_data_start = ABSOLUTE(.);
  151. *libbtdm_app.a:(.data .data.*)
  152. . = ALIGN (4);
  153. _btdm_data_end = ABSOLUTE(.);
  154. _nimble_data_start = ABSOLUTE(.);
  155. *libnimble.a:(.data .data.*)
  156. . = ALIGN (4);
  157. _nimble_data_end = ABSOLUTE(.);
  158. *(.gnu.linkonce.d.*)
  159. *(.data1)
  160. *(.sdata)
  161. *(.sdata.*)
  162. *(.gnu.linkonce.s.*)
  163. *(.sdata2)
  164. *(.sdata2.*)
  165. *(.gnu.linkonce.s2.*)
  166. *(.jcr)
  167. mapping[dram0_data]
  168. _data_end = ABSOLUTE(.);
  169. . = ALIGN(4);
  170. } > dram0_0_seg
  171. /*This section holds data that should not be initialized at power up.
  172. The section located in Internal SRAM memory region. The macro _NOINIT
  173. can be used as attribute to place data into this section.
  174. See the esp_attr.h file for more information.
  175. */
  176. .noinit (NOLOAD):
  177. {
  178. . = ALIGN(4);
  179. _noinit_start = ABSOLUTE(.);
  180. *(.noinit .noinit.*)
  181. . = ALIGN(4) ;
  182. _noinit_end = ABSOLUTE(.);
  183. } > dram0_0_seg
  184. /* Shared RAM */
  185. .dram0.bss (NOLOAD) :
  186. {
  187. . = ALIGN (8);
  188. _bss_start = ABSOLUTE(.);
  189. *(.ext_ram.bss*)
  190. _bt_bss_start = ABSOLUTE(.);
  191. *libbt.a:(.bss .bss.* COMMON)
  192. . = ALIGN (4);
  193. _bt_bss_end = ABSOLUTE(.);
  194. _btdm_bss_start = ABSOLUTE(.);
  195. *libbtdm_app.a:(.bss .bss.* COMMON)
  196. . = ALIGN (4);
  197. _btdm_bss_end = ABSOLUTE(.);
  198. _nimble_bss_start = ABSOLUTE(.);
  199. *libnimble.a:(.bss .bss.* COMMON)
  200. . = ALIGN (4);
  201. _nimble_bss_end = ABSOLUTE(.);
  202. mapping[dram0_bss]
  203. *(.dynsbss)
  204. *(.sbss)
  205. *(.sbss.*)
  206. *(.gnu.linkonce.sb.*)
  207. *(.scommon)
  208. *(.sbss2)
  209. *(.sbss2.*)
  210. *(.gnu.linkonce.sb2.*)
  211. *(.dynbss)
  212. *(.share.mem)
  213. *(.gnu.linkonce.b.*)
  214. . = ALIGN (8);
  215. _bss_end = ABSOLUTE(.);
  216. } > dram0_0_seg
  217. ASSERT(((_bss_end - ORIGIN(dram0_0_seg)) <= LENGTH(dram0_0_seg)),
  218. "DRAM segment data does not fit.")
  219. .flash.appdesc : ALIGN(0x10)
  220. {
  221. _rodata_start = ABSOLUTE(.);
  222. *(.rodata_desc .rodata_desc.*) /* Should be the first. App version info. DO NOT PUT ANYTHING BEFORE IT! */
  223. *(.rodata_custom_desc .rodata_custom_desc.*) /* Should be the second. Custom app version info. DO NOT PUT ANYTHING BEFORE IT! */
  224. /* Create an empty gap within this section. Thanks to this, the end of this
  225. * section will match .flah.rodata's begin address. Thus, both sections
  226. * will be merged when creating the final bin image. */
  227. . = ALIGN(ALIGNOF(.flash.rodata));
  228. } >default_rodata_seg
  229. .flash.rodata : ALIGN(0x10)
  230. {
  231. _flash_rodata_start = ABSOLUTE(.);
  232. mapping[flash_rodata]
  233. *(.irom1.text) /* catch stray ICACHE_RODATA_ATTR */
  234. *(.gnu.linkonce.r.*)
  235. *(.rodata1)
  236. __XT_EXCEPTION_TABLE_ = ABSOLUTE(.);
  237. *(.xt_except_table)
  238. *(.gcc_except_table .gcc_except_table.*)
  239. *(.gnu.linkonce.e.*)
  240. *(.gnu.version_r)
  241. . = (. + 3) & ~ 3;
  242. __eh_frame = ABSOLUTE(.);
  243. KEEP(*(.eh_frame))
  244. . = (. + 7) & ~ 3;
  245. /* C++ constructor and destructor tables
  246. Make a point of not including anything from crtbegin.o or crtend.o, as IDF doesn't use toolchain crt
  247. */
  248. __init_array_start = ABSOLUTE(.);
  249. KEEP (*(EXCLUDE_FILE (*crtend.* *crtbegin.*) .ctors SORT(.ctors.*)))
  250. __init_array_end = ABSOLUTE(.);
  251. KEEP (*crtbegin.*(.dtors))
  252. KEEP (*(EXCLUDE_FILE (*crtend.*) .dtors))
  253. KEEP (*(SORT(.dtors.*)))
  254. KEEP (*(.dtors))
  255. /* C++ exception handlers table: */
  256. __XT_EXCEPTION_DESCS_ = ABSOLUTE(.);
  257. *(.xt_except_desc)
  258. *(.gnu.linkonce.h.*)
  259. __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
  260. *(.xt_except_desc_end)
  261. *(.dynamic)
  262. *(.gnu.version_d)
  263. /* Addresses of memory regions reserved via
  264. SOC_RESERVE_MEMORY_REGION() */
  265. soc_reserved_memory_region_start = ABSOLUTE(.);
  266. KEEP (*(.reserved_memory_address))
  267. soc_reserved_memory_region_end = ABSOLUTE(.);
  268. _rodata_end = ABSOLUTE(.);
  269. /* Literals are also RO data. */
  270. _lit4_start = ABSOLUTE(.);
  271. *(*.lit4)
  272. *(.lit4.*)
  273. *(.gnu.linkonce.lit4.*)
  274. _lit4_end = ABSOLUTE(.);
  275. . = ALIGN(4);
  276. _thread_local_start = ABSOLUTE(.);
  277. *(.tdata)
  278. *(.tdata.*)
  279. *(.tbss)
  280. *(.tbss.*)
  281. _thread_local_end = ABSOLUTE(.);
  282. . = ALIGN(4);
  283. } >default_rodata_seg
  284. _flash_rodata_align = ALIGNOF(.flash.rodata);
  285. .flash.text :
  286. {
  287. _stext = .;
  288. _text_start = ABSOLUTE(.);
  289. mapping[flash_text]
  290. *(.stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
  291. *(.irom0.text) /* catch stray ICACHE_RODATA_ATTR */
  292. *(.fini.literal)
  293. *(.fini)
  294. *(.gnu.version)
  295. _text_end = ABSOLUTE(.);
  296. _etext = .;
  297. /* Similar to _iram_start, this symbol goes here so it is
  298. resolved by addr2line in preference to the first symbol in
  299. the flash.text segment.
  300. */
  301. _flash_cache_start = ABSOLUTE(0);
  302. } >default_code_seg
  303. /* Marks the end of IRAM code segment */
  304. .iram0.text_end (NOLOAD) :
  305. {
  306. . = ALIGN (4);
  307. _iram_text_end = ABSOLUTE(.);
  308. } > iram0_0_seg
  309. .iram0.data :
  310. {
  311. . = ALIGN(4);
  312. _iram_data_start = ABSOLUTE(.);
  313. mapping[iram0_data]
  314. _iram_data_end = ABSOLUTE(.);
  315. } > iram0_0_seg
  316. .iram0.bss (NOLOAD) :
  317. {
  318. . = ALIGN(4);
  319. _iram_bss_start = ABSOLUTE(.);
  320. mapping[iram0_bss]
  321. _iram_bss_end = ABSOLUTE(.);
  322. . = ALIGN(4);
  323. _iram_end = ABSOLUTE(.);
  324. } > iram0_0_seg
  325. /* Marks the end of data, bss and possibly rodata */
  326. .dram0.heap_start (NOLOAD) :
  327. {
  328. . = ALIGN (8);
  329. _heap_start = ABSOLUTE(.);
  330. } > dram0_0_seg
  331. }
  332. ASSERT(((_iram_end - ORIGIN(iram0_0_seg)) <= LENGTH(iram0_0_seg)),
  333. "IRAM0 segment data does not fit.")
  334. ASSERT(((_heap_start - ORIGIN(dram0_0_seg)) <= LENGTH(dram0_0_seg)),
  335. "DRAM segment data does not fit.")