sections.ld.in 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. /*
  2. * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. /*
  7. * SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
  8. *
  9. * SPDX-License-Identifier: Apache-2.0
  10. */
  11. /*
  12. * Automatically generated file. DO NOT EDIT.
  13. * Espressif IoT Development Framework (ESP-IDF) 5.5.1 Configuration Header
  14. */
  15. /* List of deprecated options */
  16. /* CPU instruction prefetch padding size for flash mmap scenario */
  17. /*
  18. * PMP region granularity size
  19. * Software may determine the PMP granularity by writing zero to pmp0cfg, then writing all ones
  20. * to pmpaddr0, then reading back pmpaddr0. If G is the index of the least-significant bit set,
  21. * the PMP granularity is 2^G+2 bytes.
  22. */
  23. /* CPU instruction prefetch padding size for memory protection scenario */
  24. /* Memory alignment size for PMS */
  25. /* rtc timer data (s_rtc_timer_retain_mem, see esp_clk.c files). For rtc_timer_data_in_rtc_mem section. */
  26. /* Default entry point */
  27. ENTRY(call_start_cpu0);
  28. SECTIONS
  29. {
  30. /**
  31. * RTC fast memory holds RTC wake stub code,
  32. * including from any source file named rtc_wake_stub*.c
  33. */
  34. .rtc.text :
  35. {
  36. . = ALIGN(4);
  37. _rtc_fast_start = ABSOLUTE(.);
  38. . = ALIGN(4);
  39. _rtc_text_start = ABSOLUTE(.);
  40. HIDDEN(_rtc_code_start = .);
  41. *(.rtc.entry.literal .rtc.entry.text)
  42. mapping[rtc_text]
  43. *rtc_wake_stub*.*(.literal .text .literal.* .text.*)
  44. *(.rtc_text_end_test)
  45. HIDDEN(_rtc_code_end = .);
  46. /* Padding for possible CPU prefetch + 4B alignment for PMS split lines. */
  47. . = ((_rtc_code_end - _rtc_code_start) == 0) ?
  48. ALIGN(0) : 16 + ALIGN(4);
  49. _rtc_text_end = ABSOLUTE(.);
  50. } > rtc_iram_seg
  51. /**
  52. * This section located in RTC FAST Memory area.
  53. * It holds data marked with RTC_FAST_ATTR attribute.
  54. * See the file "esp_attr.h" for more information.
  55. */
  56. .rtc.force_fast :
  57. {
  58. . = ALIGN(4);
  59. _rtc_force_fast_start = ABSOLUTE(.);
  60. mapping[rtc_force_fast]
  61. *(.rtc.force_fast .rtc.force_fast.*)
  62. . = ALIGN(4);
  63. _rtc_force_fast_end = ABSOLUTE(.);
  64. } > rtc_data_seg
  65. /**
  66. * RTC data section holds RTC wake stub
  67. * data/rodata, including from any source file
  68. * named rtc_wake_stub*.c and the data marked with
  69. * RTC_DATA_ATTR, RTC_RODATA_ATTR attributes.
  70. * The memory location of the data is dependent on
  71. * CONFIG_ESP32S3_RTCDATA_IN_FAST_MEM option.
  72. */
  73. .rtc.data :
  74. {
  75. _rtc_data_start = ABSOLUTE(.);
  76. mapping[rtc_data]
  77. *rtc_wake_stub*.*(.data .rodata .data.* .rodata.*)
  78. _rtc_data_end = ABSOLUTE(.);
  79. } > rtc_data_location
  80. /* RTC bss, from any source file named rtc_wake_stub*.c */
  81. .rtc.bss (NOLOAD) :
  82. {
  83. _rtc_bss_start = ABSOLUTE(.);
  84. *rtc_wake_stub*.*(.bss .bss.*)
  85. *rtc_wake_stub*.*(COMMON)
  86. mapping[rtc_bss]
  87. _rtc_bss_end = ABSOLUTE(.);
  88. } > rtc_data_location
  89. /**
  90. * This section holds data that should not be initialized at power up
  91. * and will be retained during deep sleep.
  92. * User data marked with RTC_NOINIT_ATTR will be placed
  93. * into this section. See the file "esp_attr.h" for more information.
  94. * The memory location of the data is dependent on
  95. * CONFIG_ESP32S3_RTCDATA_IN_FAST_MEM option.
  96. */
  97. .rtc_noinit (NOLOAD):
  98. {
  99. . = ALIGN(4);
  100. _rtc_noinit_start = ABSOLUTE(.);
  101. *(.rtc_noinit .rtc_noinit.*)
  102. . = ALIGN(4);
  103. _rtc_noinit_end = ABSOLUTE(.);
  104. } > rtc_data_location
  105. /**
  106. * This section located in RTC SLOW Memory area.
  107. * It holds data marked with RTC_SLOW_ATTR attribute.
  108. * See the file "esp_attr.h" for more information.
  109. */
  110. .rtc.force_slow :
  111. {
  112. . = ALIGN(4);
  113. _rtc_force_slow_start = ABSOLUTE(.);
  114. *(.rtc.force_slow .rtc.force_slow.*)
  115. . = ALIGN(4);
  116. _rtc_force_slow_end = ABSOLUTE(.);
  117. } > rtc_slow_seg
  118. /**
  119. * This section holds RTC data that should have fixed addresses.
  120. * The data are not initialized at power-up and are retained during deep
  121. * sleep.
  122. */
  123. .rtc_reserved (NOLOAD):
  124. {
  125. . = ALIGN(4);
  126. _rtc_reserved_start = ABSOLUTE(.);
  127. /**
  128. * New data can only be added here to ensure existing data are not moved.
  129. * Because data have adhered to the end of the segment and code is relied
  130. * on it.
  131. * >> put new data here <<
  132. */
  133. *(.rtc_timer_data_in_rtc_mem .rtc_timer_data_in_rtc_mem.*)
  134. KEEP(*(.bootloader_data_rtc_mem .bootloader_data_rtc_mem.*))
  135. _rtc_reserved_end = ABSOLUTE(.);
  136. } > rtc_reserved_seg
  137. _rtc_reserved_length = _rtc_reserved_end - _rtc_reserved_start;
  138. ASSERT((_rtc_reserved_length <= LENGTH(rtc_reserved_seg)),
  139. "RTC reserved segment data does not fit.")
  140. /* Get size of rtc slow data based on rtc_data_location alias */
  141. _rtc_slow_length = (ORIGIN(rtc_slow_seg) == ORIGIN(rtc_data_location))
  142. ? (_rtc_force_slow_end - _rtc_data_start)
  143. : (_rtc_force_slow_end - _rtc_force_slow_start);
  144. _rtc_fast_length = (ORIGIN(rtc_slow_seg) == ORIGIN(rtc_data_location))
  145. ? (_rtc_force_fast_end - _rtc_fast_start)
  146. : (_rtc_noinit_end - _rtc_fast_start);
  147. ASSERT((_rtc_slow_length <= LENGTH(rtc_slow_seg)),
  148. "RTC_SLOW segment data does not fit.")
  149. ASSERT((_rtc_fast_length <= LENGTH(rtc_data_seg)),
  150. "RTC_FAST segment data does not fit.")
  151. /* Send .iram0 code to iram */
  152. .iram0.vectors :
  153. {
  154. _iram_start = ABSOLUTE(.);
  155. /* Vectors go to IRAM */
  156. _vector_table = ABSOLUTE(.);
  157. . = 0x0;
  158. KEEP(*(.WindowVectors.text));
  159. . = 0x180;
  160. KEEP(*(.Level2InterruptVector.text));
  161. . = 0x1c0;
  162. KEEP(*(.Level3InterruptVector.text));
  163. . = 0x200;
  164. KEEP(*(.Level4InterruptVector.text));
  165. . = 0x240;
  166. KEEP(*(.Level5InterruptVector.text));
  167. . = 0x280;
  168. KEEP(*(.DebugExceptionVector.text));
  169. . = 0x2c0;
  170. KEEP(*(.NMIExceptionVector.text));
  171. . = 0x300;
  172. KEEP(*(.KernelExceptionVector.text));
  173. . = 0x340;
  174. KEEP(*(.UserExceptionVector.text));
  175. . = 0x3C0;
  176. KEEP(*(.DoubleExceptionVector.text));
  177. . = 0x400;
  178. KEEP(*(._invalid_pc_placeholder.text));
  179. *(.*Vector.literal)
  180. } > iram0_0_seg
  181. .iram0.text :
  182. {
  183. /* Code marked as running out of IRAM */
  184. _iram_text_start = ABSOLUTE(.);
  185. mapping[iram0_text]
  186. } > iram0_0_seg
  187. /**
  188. * This section is required to skip .iram0.text area because iram0_0_seg and
  189. * dram0_0_seg reflect the same address space on different buses.
  190. */
  191. .dram0.dummy (NOLOAD):
  192. {
  193. . = ORIGIN(dram0_0_seg) + MAX(_iram_end - _diram_i_start, 0);
  194. } > dram0_0_seg
  195. .dram0.data :
  196. {
  197. _data_start = ABSOLUTE(.);
  198. *(.gnu.linkonce.d.*)
  199. *(.data1)
  200. *(.sdata)
  201. *(.sdata.*)
  202. *(.gnu.linkonce.s.*)
  203. *(.gnu.linkonce.s2.*)
  204. *(.jcr)
  205. mapping[dram0_data]
  206. _data_end = ABSOLUTE(.);
  207. } > dram0_0_seg
  208. /**
  209. * This section holds data that should not be initialized at power up.
  210. * The section located in Internal SRAM memory region. The macro _NOINIT
  211. * can be used as attribute to place data into this section.
  212. * See the "esp_attr.h" file for more information.
  213. */
  214. .noinit (NOLOAD):
  215. {
  216. . = ALIGN(4);
  217. _noinit_start = ABSOLUTE(.);
  218. *(.noinit .noinit.*)
  219. . = ALIGN(4);
  220. _noinit_end = ABSOLUTE(.);
  221. } > dram0_0_seg
  222. /* Shared RAM */
  223. .dram0.bss (NOLOAD) :
  224. {
  225. . = ALIGN(8);
  226. _bss_start = ABSOLUTE(.);
  227. /**
  228. * ldgen places all bss-related data to mapping[dram0_bss]
  229. * (See components/esp_system/app.lf).
  230. */
  231. mapping[dram0_bss]
  232. . = ALIGN(8);
  233. _bss_end = ABSOLUTE(.);
  234. } > dram0_0_seg
  235. ASSERT(((_bss_end - ORIGIN(dram0_0_seg)) <= LENGTH(dram0_0_seg)),
  236. "DRAM segment data does not fit.")
  237. .flash.text :
  238. {
  239. _stext = .;
  240. /**
  241. * Mark the start of flash.text.
  242. * This can be used by the MMU driver to maintain the virtual address.
  243. */
  244. _instruction_reserved_start = ABSOLUTE(.);
  245. _text_start = ABSOLUTE(.);
  246. mapping[flash_text]
  247. *(.stub)
  248. *(.gnu.warning)
  249. *(.gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
  250. *(.irom0.text) /* catch stray ICACHE_RODATA_ATTR */
  251. /**
  252. * CPU will try to prefetch up to 16 bytes of of instructions.
  253. * This means that any configuration (e.g. MMU, PMS) must allow
  254. * safe access to up to 16 bytes after the last real instruction, add
  255. * dummy bytes to ensure this
  256. */
  257. . += 16;
  258. _text_end = ABSOLUTE(.);
  259. /**
  260. * Mark the flash.text end.
  261. * This can be used for MMU driver to maintain virtual address.
  262. */
  263. _instruction_reserved_end = ABSOLUTE(.);
  264. _etext = .;
  265. /**
  266. * Similar to _iram_start, this symbol goes here so it is
  267. * resolved by addr2line in preference to the first symbol in
  268. * the flash.text segment.
  269. */
  270. _flash_cache_start = ABSOLUTE(0);
  271. } > default_code_seg
  272. /**
  273. * Dummy section represents the .flash.text section but in default_rodata_seg.
  274. * Thus, it must have its alignment and (at least) its size.
  275. */
  276. .flash_rodata_dummy (NOLOAD):
  277. {
  278. _flash_rodata_dummy_start = ABSOLUTE(.);
  279. . = ALIGN(ALIGNOF(.flash.text)) + SIZEOF(.flash.text);
  280. /* Add alignment of MMU page size + 0x20 bytes for the mapping header. */
  281. . = ALIGN(0x10000) + 0x20;
  282. } > default_rodata_seg
  283. .flash.appdesc : ALIGN(0x10)
  284. {
  285. /**
  286. * Mark flash.rodata start.
  287. * This can be used for mmu driver to maintain virtual address
  288. */
  289. _rodata_reserved_start = ABSOLUTE(.);
  290. _rodata_start = ABSOLUTE(.);
  291. /* !DO NOT PUT ANYTHING BEFORE THIS! */
  292. /* Should be the first. App version info. */
  293. *(.rodata_desc .rodata_desc.*)
  294. /* Should be the second. Custom app version info. */
  295. *(.rodata_custom_desc .rodata_custom_desc.*)
  296. /**
  297. * Create an empty gap within this section. Thanks to this, the end of this
  298. * section will match .flah.rodata's begin address. Thus, both sections
  299. * will be merged when creating the final bin image.
  300. */
  301. . = ALIGN(ALIGNOF(.flash.rodata));
  302. } > default_rodata_seg
  303. ASSERT((ADDR(.flash.rodata) == ADDR(.flash.appdesc) + SIZEOF(.flash.appdesc)), "The gap between .flash.appdesc and .flash.rodata must not exist to produce the final bin image.")
  304. .flash.rodata : ALIGN(0x10)
  305. {
  306. _flash_rodata_start = ABSOLUTE(.);
  307. mapping[flash_rodata]
  308. *(.irom1.text) /* catch stray ICACHE_RODATA_ATTR */
  309. *(.gnu.linkonce.r.*)
  310. *(.rodata1)
  311. /* C++ exception handlers table. */
  312. . = ALIGN(4);
  313. __XT_EXCEPTION_TABLE_ = ABSOLUTE(.);
  314. *(.xt_except_table)
  315. *(.gcc_except_table .gcc_except_table.*)
  316. *(.gnu.linkonce.e.*)
  317. . = ALIGN(4);
  318. __XT_EXCEPTION_DESCS_ = ABSOLUTE(.);
  319. *(.xt_except_desc)
  320. *(.gnu.linkonce.h.*)
  321. __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
  322. *(.xt_except_desc_end)
  323. /**
  324. * C++ constructor tables.
  325. *
  326. * Excluding crtbegin.o/crtend.o since IDF doesn't use the toolchain crt.
  327. */
  328. . = ALIGN(4);
  329. __init_array_start = ABSOLUTE(.);
  330. KEEP (*(EXCLUDE_FILE (*crtend.* *crtbegin.*) .ctors SORT(.ctors.*)))
  331. __init_array_end = ABSOLUTE(.);
  332. /* Addresses of memory regions reserved via SOC_RESERVE_MEMORY_REGION() */
  333. . = ALIGN(4);
  334. soc_reserved_memory_region_start = ABSOLUTE(.);
  335. KEEP (*(.reserved_memory_address))
  336. soc_reserved_memory_region_end = ABSOLUTE(.);
  337. /* System init functions registered via ESP_SYSTEM_INIT_FN */
  338. . = ALIGN(4);
  339. _esp_system_init_fn_array_start = ABSOLUTE(.);
  340. KEEP (*(SORT_BY_INIT_PRIORITY(.esp_system_init_fn.*)))
  341. _esp_system_init_fn_array_end = ABSOLUTE(.);
  342. _rodata_end = ABSOLUTE(.);
  343. /* Literals are also RO data. */
  344. _lit4_start = ABSOLUTE(.);
  345. *(*.lit4)
  346. *(.lit4.*)
  347. *(.gnu.linkonce.lit4.*)
  348. _lit4_end = ABSOLUTE(.);
  349. /* TLS data. */
  350. . = ALIGN(4);
  351. _thread_local_start = ABSOLUTE(.);
  352. *(.tdata)
  353. *(.tdata.*)
  354. *(.tbss)
  355. *(.tbss.*)
  356. _thread_local_end = ABSOLUTE(.);
  357. } > default_rodata_seg
  358. _flash_rodata_align = ALIGNOF(.flash.rodata);
  359. /**
  360. * This section contains all the rodata that is not used
  361. * at runtime, helping to avoid an increase in binary size.
  362. */
  363. .flash.rodata_noload (NOLOAD) :
  364. {
  365. /**
  366. * This symbol marks the end of flash.rodata. It can be utilized by the MMU
  367. * driver to maintain the virtual address.
  368. * NOLOAD rodata may not be included in this section.
  369. */
  370. _rodata_reserved_end = ABSOLUTE(.);
  371. mapping[rodata_noload]
  372. } > default_rodata_seg
  373. /**
  374. * Dummy section to skip flash rodata sections.
  375. * Because to `extern_ram_seg` and `drom0_0_seg` are on the same bus
  376. */
  377. .ext_ram.dummy (NOLOAD):
  378. {
  379. . = ORIGIN(extern_ram_seg);
  380. . = . + (_rodata_reserved_end - _flash_rodata_dummy_start);
  381. . = ALIGN (0x10000);
  382. } > extern_ram_seg
  383. /* Marks the end of IRAM code segment */
  384. .iram0.text_end (NOLOAD) :
  385. {
  386. /* Padding for possible CPU prefetch + alignment for PMS split lines */
  387. . += 16;
  388. . = ALIGN(256);
  389. /* iram_end_test section exists for use by memprot unit tests only */
  390. *(.iram_end_test)
  391. _iram_text_end = ABSOLUTE(.);
  392. } > iram0_0_seg
  393. .iram0.data :
  394. {
  395. . = ALIGN(4);
  396. _iram_data_start = ABSOLUTE(.);
  397. mapping[iram0_data]
  398. . = ALIGN(4);
  399. _iram_data_end = ABSOLUTE(.);
  400. } > iram0_0_seg
  401. .iram0.bss (NOLOAD) :
  402. {
  403. . = ALIGN(4);
  404. _iram_bss_start = ABSOLUTE(.);
  405. mapping[iram0_bss]
  406. _iram_bss_end = ABSOLUTE(.);
  407. . = ALIGN(4);
  408. _iram_end = ABSOLUTE(.);
  409. } > iram0_0_seg
  410. /* Marks the end of data, bss and possibly rodata */
  411. .dram0.heap_start (NOLOAD) :
  412. {
  413. /* Lowest possible start address for the heap */
  414. . = ALIGN(8);
  415. _heap_low_start = ABSOLUTE(.);
  416. } > dram0_0_seg
  417. /**
  418. * This section is not included in the binary image; it is only present in the ELF file.
  419. * It is used to keep certain symbols in the ELF file.
  420. */
  421. .noload 0 (INFO) :
  422. {
  423. _noload_keep_in_elf_start = ABSOLUTE(.);
  424. KEEP(*(.noload_keep_in_elf .noload_keep_in_elf.*))
  425. mapping[noload_keep_in_elf]
  426. _noload_keep_in_elf_end = ABSOLUTE(.);
  427. }
  428. /* DWARF 1 */
  429. .debug 0 : { *(.debug) }
  430. .line 0 : { *(.line) }
  431. /* GNU DWARF 1 extensions */
  432. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  433. .debug_sfnames 0 : { *(.debug_sfnames) }
  434. /* DWARF 1.1 and DWARF 2 */
  435. .debug_aranges 0 : { *(.debug_aranges) }
  436. .debug_pubnames 0 : { *(.debug_pubnames) }
  437. /* DWARF 2 */
  438. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  439. .debug_abbrev 0 : { *(.debug_abbrev) }
  440. .debug_line 0 : { *(.debug_line) }
  441. .debug_frame 0 : { *(.debug_frame) }
  442. .debug_str 0 : { *(.debug_str) }
  443. .debug_loc 0 : { *(.debug_loc) }
  444. .debug_macinfo 0 : { *(.debug_macinfo) }
  445. .debug_pubtypes 0 : { *(.debug_pubtypes) }
  446. /* DWARF 3 */
  447. .debug_ranges 0 : { *(.debug_ranges) }
  448. /* SGI/MIPS DWARF 2 extensions */
  449. .debug_weaknames 0 : { *(.debug_weaknames) }
  450. .debug_funcnames 0 : { *(.debug_funcnames) }
  451. .debug_typenames 0 : { *(.debug_typenames) }
  452. .debug_varnames 0 : { *(.debug_varnames) }
  453. /* GNU DWARF 2 extensions */
  454. .debug_gnu_pubnames 0 : { *(.debug_gnu_pubnames) }
  455. .debug_gnu_pubtypes 0 : { *(.debug_gnu_pubtypes) }
  456. /* DWARF 4 */
  457. .debug_types 0 : { *(.debug_types) }
  458. /* DWARF 5 */
  459. .debug_addr 0 : { *(.debug_addr) }
  460. .debug_line_str 0 : { *(.debug_line_str) }
  461. .debug_loclists 0 : { *(.debug_loclists) }
  462. .debug_macro 0 : { *(.debug_macro) }
  463. .debug_names 0 : { *(.debug_names) }
  464. .debug_rnglists 0 : { *(.debug_rnglists) }
  465. .debug_str_offsets 0 : { *(.debug_str_offsets) }
  466. .comment 0 : { *(.comment) }
  467. .note.GNU-stack 0: { *(.note.GNU-stack) }
  468. /**
  469. * .xt.prop and .xt.lit sections will be used by the debugger and disassembler
  470. * to get more information about raw data present in the code.
  471. * Indeed, it may be required to add some padding at some points in the code
  472. * in order to align a branch/jump destination on a particular bound.
  473. * Padding these instructions will generate null bytes that shall be
  474. * interpreted as data, and not code by the debugger or disassembler.
  475. * This section will only be present in the ELF file, not in the final binary
  476. * For more details, check GCC-212
  477. */
  478. .xtensa.info 0: { *(.xtensa.info) }
  479. .xt.prop 0 : { *(.xt.prop .xt.prop.* .gnu.linkonce.prop.*) }
  480. .xt.lit 0 : { *(.xt.lit .xt.lit.* .gnu.linkonce.p.*) }
  481. /DISCARD/ :
  482. {
  483. *(.fini)
  484. *(.eh_frame_hdr)
  485. *(.eh_frame)
  486. }
  487. }
  488. ASSERT(((_iram_end - ORIGIN(iram0_0_seg)) <= LENGTH(iram0_0_seg)),
  489. "IRAM0 segment data does not fit.")
  490. ASSERT(((_heap_low_start - ORIGIN(dram0_0_seg)) <= LENGTH(dram0_0_seg)),
  491. "DRAM segment data does not fit.")