sections.ld.in 16 KB

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