linker-script-generation.rst 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  1. Linker Script Generation
  2. ========================
  3. :link_to_translation:`zh_CN:[中文]`
  4. Overview
  5. --------
  6. There are several :ref:`memory regions<memory-layout>` where code and data can be placed. Code and read-only data are placed by default in flash, writable data in RAM, etc. However, it is sometimes necessary to change these default placements.
  7. .. only:: SOC_ULP_SUPPORTED
  8. For example, it may be necessary to place critical code in RAM for performance reasons or to place code in RTC memory for use in a wake stub or the ULP coprocessor.
  9. .. only:: not SOC_ULP_SUPPORTED
  10. For example, it may be necessary to place critical code in RAM for performance reasons or to place code in RTC memory for use in a wake stub.
  11. With the linker script generation mechanism, it is possible to specify these placements at the component level within ESP-IDF. The component presents information on how it would like to place its symbols, objects or the entire archive. During build, the information presented by the components are collected, parsed and processed; and the placement rules generated is used to link the app.
  12. Quick Start
  13. ------------
  14. This section presents a guide for quickly placing code/data to RAM and RTC memory - placements ESP-IDF provides out-of-the-box.
  15. For this guide, suppose we have the following::
  16. - components/
  17. - my_component/
  18. - CMakeLists.txt
  19. - component.mk
  20. - Kconfig
  21. - src/
  22. - my_src1.c
  23. - my_src2.c
  24. - my_src3.c
  25. - my_linker_fragment_file.lf
  26. - a component named ``my_component`` that is archived as library ``libmy_component.a`` during build
  27. - three source files archived under the library, ``my_src1.c``, ``my_src2.c`` and ``my_src3.c`` which are compiled as ``my_src1.o``, ``my_src2.o`` and ``my_src3.o``, respectively
  28. - under ``my_src1.o``, the function ``my_function1`` is defined; under ``my_src2.o``, the function ``my_function2`` is defined
  29. - there is bool-type config ``PERFORMANCE_MODE`` (y/n) and int type config ``PERFORMANCE_LEVEL`` (with range 0-3) in ``my_component``'s Kconfig
  30. Creating and Specifying a Linker Fragment File
  31. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  32. Before anything else, a linker fragment file needs to be created. A linker fragment file is simply a text file with a ``.lf`` extension upon which the desired placements will be written. After creating the file, it is then necessary to present it to the build system. The instructions for the build systems supported by ESP-IDF are as follows:
  33. Make
  34. """"
  35. In the component's ``component.mk`` file, set the variable ``COMPONENT_ADD_LDFRAGMENTS`` to the path of the created linker fragment file. The path can either be an absolute path or a relative path from the component directory.
  36. .. code-block:: make
  37. COMPONENT_ADD_LDFRAGMENTS += my_linker_fragment_file.lf
  38. CMake
  39. """""
  40. In the component's ``CMakeLists.txt`` file, specify argument ``LDFRAGMENTS`` in the ``idf_component_register`` call. The value of ``LDFRAGMENTS`` can either be an absolute path or a relative path from the component directory to the created linker fragment file.
  41. .. code-block:: cmake
  42. # file paths relative to CMakeLists.txt
  43. idf_component_register(...
  44. LDFRAGMENTS "path/to/linker_fragment_file.lf" "path/to/another_linker_fragment_file.lf"
  45. ...
  46. )
  47. Specifying placements
  48. ^^^^^^^^^^^^^^^^^^^^^
  49. It is possible to specify placements at the following levels of granularity:
  50. - object file (``.obj`` or ``.o`` files)
  51. - symbol (function/variable)
  52. - archive (``.a`` files)
  53. .. _ldgen-placing-object-files :
  54. Placing object files
  55. """"""""""""""""""""
  56. Suppose the entirety of ``my_src1.o`` is performance-critical, so it is desirable to place it in RAM. On the other hand, the entirety of ``my_src2.o`` contains symbols needed coming out of deep sleep, so it needs to be put under RTC memory.
  57. In the the linker fragment file, we can write:
  58. .. code-block:: none
  59. [mapping:my_component]
  60. archive: libmy_component.a
  61. entries:
  62. my_src1 (noflash) # places all my_src1 code/read-only data under IRAM/DRAM
  63. my_src2 (rtc) # places all my_src2 code/ data and read-only data under RTC fast memory/RTC slow memory
  64. What happens to ``my_src3.o``? Since it is not specified, default placements are used for ``my_src3.o``. More on default placements :ref:`here<ldgen-default-placements>`.
  65. Placing symbols
  66. """"""""""""""""
  67. Continuing our example, suppose that among functions defined under ``object1.o``, only ``my_function1`` is performance-critical; and under ``object2.o``, only ``my_function2`` needs to execute after the chip comes out of deep sleep. This could be accomplished by writing:
  68. .. code-block:: none
  69. [mapping:my_component]
  70. archive: libmy_component.a
  71. entries:
  72. my_src1:my_function1 (noflash)
  73. my_src2:my_function2 (rtc)
  74. The default placements are used for the rest of the functions in ``my_src1.o`` and ``my_src2.o`` and the entire ``object3.o``. Something similar can be achieved for placing data by writing the variable name instead of the function name, like so::
  75. my_src1:my_variable (noflash)
  76. .. warning::
  77. There are :ref:`limitations<ldgen-symbol-granularity-placements>` in placing code/data at symbol granularity. In order to ensure proper placements, an alternative would be to group relevant code and data into source files, and :ref:`use object-granularity placements<ldgen-placing-object-files>`.
  78. Placing entire archive
  79. """""""""""""""""""""""
  80. In this example, suppose that the entire component archive needs to be placed in RAM. This can be written as:
  81. .. code-block:: none
  82. [mapping:my_component]
  83. archive: libmy_component.a
  84. entries:
  85. * (noflash)
  86. Similarly, this places the entire component in RTC memory:
  87. .. code-block:: none
  88. [mapping:my_component]
  89. archive: libmy_component.a
  90. entries:
  91. * (rtc)
  92. Configuration-dependent placements
  93. """"""""""""""""""""""""""""""""""
  94. Suppose that the entire component library should only have special placement when a certain condition is true; for example, when ``CONFIG_PERFORMANCE_MODE == y``. This could be written as:
  95. .. code-block:: none
  96. [mapping:my_component]
  97. archive: libmy_component.a
  98. entries:
  99. if PERFORMANCE_MODE = y:
  100. * (noflash)
  101. else:
  102. * (default)
  103. For a more complex config-dependent placement, suppose the following requirements: when ``CONFIG_PERFORMANCE_LEVEL == 1``, only ``object1.o`` is put in RAM; when ``CONFIG_PERFORMANCE_LEVEL == 2``, ``object1.o`` and ``object2.o``; and when ``CONFIG_PERFORMANCE_LEVEL == 3`` all object files under the archive are to be put into RAM. When these three are false however, put entire library in RTC memory. This scenario is a bit contrived, but, it can be written as:
  104. .. code-block:: none
  105. [mapping:my_component]
  106. archive: libmy_component.a
  107. entries:
  108. if PERFORMANCE_LEVEL = 1:
  109. my_src1 (noflash)
  110. elif PERFORMANCE_LEVEL = 2:
  111. my_src1 (noflash)
  112. my_src2 (noflash)
  113. elif PERFORMANCE_LEVEL = 3:
  114. my_src1 (noflash)
  115. my_src2 (noflash)
  116. my_src3 (noflash)
  117. else:
  118. * (rtc)
  119. Nesting condition-checking is also possible. The following is equivalent to the snippet above:
  120. .. code-block:: none
  121. [mapping:my_component]
  122. archive: libmy_component.a
  123. entries:
  124. if PERFORMANCE_LEVEL <= 3 && PERFORMANCE_LEVEL > 0:
  125. if PERFORMANCE_LEVEL >= 1:
  126. object1 (noflash)
  127. if PERFORMANCE_LEVEL >= 2:
  128. object2 (noflash)
  129. if PERFORMANCE_LEVEL >= 3:
  130. object2 (noflash)
  131. else:
  132. * (rtc)
  133. .. _ldgen-default-placements:
  134. The 'default' placements
  135. ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  136. Up until this point, the term 'default placements' has been mentioned as fallback placements when the placement rules ``rtc`` and ``noflash`` are not specified. It is important to note that the tokens ``noflash`` or ``rtc`` are not merely keywords, but are actually entities called fragments, specifically :ref:`schemes<ldgen-scheme-fragment>`.
  137. In the same manner as ``rtc`` and ``noflash`` are schemes, there exists a ``default`` scheme which defines what the default placement rules should be. As the name suggests, it is where code and data are usually placed, i.e. code/constants is placed in flash, variables placed in RAM, etc. More on the default scheme :ref:`here<ldgen-default-scheme>`.
  138. .. note::
  139. For an example of an ESP-IDF component using the linker script generation mechanism, see :component_file:`freertos/CMakeLists.txt`. ``freertos`` uses this to place its object files to the instruction RAM for performance reasons.
  140. This marks the end of the quick start guide. The following text discusses the internals of the mechanism in a little bit more detail. The following sections should be helpful in creating custom placements or modifying default behavior.
  141. Linker Script Generation Internals
  142. ----------------------------------
  143. Linking is the last step in the process of turning C/C++ source files into an executable. It is performed by the toolchain's linker, and accepts linker scripts which specify code/data placements, among other things. With the linker script generation mechanism, this process is no different, except that the linker script passed to the linker is dynamically generated from: (1) the collected :ref:`linker fragment files<ldgen-linker-fragment-files>` and (2) :ref:`linker script template<ldgen-linker-script-template>`.
  144. .. note::
  145. The tool that implements the linker script generation mechanism lives under :idf:`tools/ldgen`.
  146. .. _ldgen-linker-fragment-files :
  147. Linker Fragment Files
  148. ^^^^^^^^^^^^^^^^^^^^^
  149. As mentioned in the quick start guide, fragment files are simple text files with the ``.lf`` extension containing the desired placements. This is a simplified description of what fragment files contain, however. What fragment files actually contain are 'fragments'. Fragments are entities which contain pieces of information which, when put together, form placement rules that tell where to place sections of object files in the output binary. There are three types of fragments: :ref:`sections<ldgen-sections-fragment>`, :ref:`scheme<ldgen-scheme-fragment>` and :ref:`mapping<ldgen-mapping-fragment>`.
  150. Grammar
  151. """""""
  152. The three fragment types share a common grammar:
  153. .. code-block:: none
  154. [type:name]
  155. key: value
  156. key:
  157. value
  158. value
  159. value
  160. ...
  161. - type: Corresponds to the fragment type, can either be ``sections``, ``scheme`` or ``mapping``.
  162. - name: The name of the fragment, should be unique for the specified fragment type.
  163. - key, value: Contents of the fragment; each fragment type may support different keys and different grammars for the key values.
  164. .. note::
  165. In cases where multiple fragments of the same type and name are encountered, an exception is thrown.
  166. .. note::
  167. The only valid characters for fragment names and keys are alphanumeric characters and underscore.
  168. .. _ldgen-condition-checking :
  169. **Condition Checking**
  170. Condition checking enable the linker script generation to be configuration-aware. Depending on whether expressions involving configuration values are true or not, a particular set of values for a key can be used. The evaluation uses ``eval_string`` from kconfiglib package and adheres to its required syntax and limitations. Supported operators are as follows:
  171. - comparison
  172. - LessThan ``<``
  173. - LessThanOrEqualTo ``<=``
  174. - MoreThan ``>``
  175. - MoreThanOrEqualTo ``>=``
  176. - Equal ``=``
  177. - NotEqual ``!=``
  178. - logical
  179. - Or ``||``
  180. - And ``&&``
  181. - Negation ``!``
  182. - grouping
  183. - Parenthesis ``()``
  184. Condition checking behaves as you would expect an ``if...elseif/elif...else`` block in other languages. Condition-checking is possible for both key values and entire fragments. The two sample fragments below are equivalent:
  185. .. code-block:: none
  186. # Value for keys is dependent on config
  187. [type:name]
  188. key_1:
  189. if CONDITION = y:
  190. value_1
  191. else:
  192. value_2
  193. key_2:
  194. if CONDITION = y:
  195. value_a
  196. else:
  197. value_b
  198. .. code-block:: none
  199. # Entire fragment definition is dependent on config
  200. if CONDITION = y:
  201. [type:name]
  202. key_1:
  203. value_1
  204. key_2:
  205. value_b
  206. else:
  207. [type:name]
  208. key_1:
  209. value_2
  210. key_2:
  211. value_b
  212. **Comments**
  213. Comment in linker fragment files begin with ``#``. Like in other languages, comment are used to provide helpful descriptions and documentation and are ignored during processing.
  214. Compatibility with ESP-IDF v3.x Linker Script Fragment Files
  215. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  216. ESP-IDF v4.0 brings some changes to the linker script fragment file grammar:
  217. - indentation is enforced and improperly indented fragment files generate a parse exception; this was not enforced in the old version but previous documentation and examples demonstrates properly indented grammar
  218. - move to ``if...elif...else`` structure for conditionals, with the ability to nest checks and place entire fragments themselves inside conditionals
  219. - mapping fragments now requires a name like other fragment types
  220. Linker script generator should be able to parse ESP-IDF v3.x linker fragment files that are indented properly (as demonstrated by the ESP-IDF v3.x version of this document). Backward compatibility with the previous mapping fragment grammar (optional name and the old grammar for conditionals) has also been retained but with a deprecation warning. Users should switch to the newer grammar discussed in this document as support for the old grammar is planned to be removed in the future.
  221. Note that linker fragment files using the new ESP-IDF v4.0 grammar is not supported on ESP-IDF v3.x, however.
  222. Types
  223. """""
  224. .. _ldgen-sections-fragment :
  225. **Sections**
  226. Sections fragments defines a list of object file sections that the GCC compiler emits. It may be a default section (e.g. ``.text``, ``.data``) or it may be user defined section through the ``__attribute__`` keyword.
  227. The use of an optional '+' indicates the inclusion of the section in the list, as well as sections that start with it. This is the preferred method over listing both explicitly.
  228. .. code-block:: none
  229. [sections:name]
  230. entries:
  231. .section+
  232. .section
  233. ...
  234. Example:
  235. .. code-block:: none
  236. # Non-preferred
  237. [sections:text]
  238. entries:
  239. .text
  240. .text.*
  241. .literal
  242. .literal.*
  243. # Preferred, equivalent to the one above
  244. [sections:text]
  245. entries:
  246. .text+ # means .text and .text.*
  247. .literal+ # means .literal and .literal.*
  248. .. _ldgen-scheme-fragment :
  249. **Scheme**
  250. Scheme fragments define what ``target`` a sections fragment is assigned to.
  251. .. code-block:: none
  252. [scheme:name]
  253. entries:
  254. sections -> target
  255. sections -> target
  256. ...
  257. Example:
  258. .. code-block:: none
  259. [scheme:noflash]
  260. entries:
  261. text -> iram0_text # the entries under the sections fragment named text will go to iram0_text
  262. rodata -> dram0_data # the entries under the sections fragment named rodata will go to dram0_data
  263. .. _ldgen-default-scheme:
  264. The ``default`` scheme
  265. There exists a special scheme with the name ``default``. This scheme is special because catch-all placement rules are generated from its entries. This means that, if one of its entries is ``text -> flash_text``, the placement rule will be generated for the target ``flash_text``.
  266. .. code-block:: none
  267. *(.literal .literal.* .text .text.*)
  268. These catch-all rules then effectively serve as fallback rules for those whose mappings were not specified.
  269. The ``default scheme`` is defined in :component_file:`esp_system/app.lf`. The ``noflash`` and ``rtc`` scheme fragments which are
  270. built-in schemes referenced in the quick start guide are also defined in this file.
  271. .. _ldgen-mapping-fragment :
  272. **Mapping**
  273. Mapping fragments define what scheme fragment to use for mappable entities, i.e. object files, function names, variable names, archives.
  274. .. code-block:: none
  275. [mapping:name]
  276. archive: archive # output archive file name, as built (i.e. libxxx.a)
  277. entries:
  278. object:symbol (scheme) # symbol granularity
  279. object (scheme) # object granularity
  280. * (scheme) # archive granularity
  281. There are three levels of placement granularity:
  282. - symbol: The object file name and symbol name are specified. The symbol name can be a function name or a variable name.
  283. - object: Only the object file name is specified.
  284. - archive: ``*`` is specified, which is a short-hand for all the object files under the archive.
  285. To know what an entry means, let us expand a sample object-granularity placement:
  286. .. code-block:: none
  287. object (scheme)
  288. Then expanding the scheme fragment from its entries definitions, we have:
  289. .. code-block:: none
  290. object (sections -> target,
  291. sections -> target,
  292. ...)
  293. Expanding the sections fragment with its entries definition:
  294. .. code-block:: none
  295. object (.section, # given this object file
  296. .section, # put its sections listed here at this
  297. ... -> target, # target
  298. .section,
  299. .section, # same should be done for these sections
  300. ... -> target,
  301. ...) # and so on
  302. Example:
  303. .. code-block:: none
  304. [mapping:map]
  305. archive: libfreertos.a
  306. entries:
  307. * (noflash)
  308. Aside from the entity and scheme, flags can also be specified in an entry. The following flags are supported (note: <> = argument name, [] = optional):
  309. 1. ALIGN(<alignment>[, pre, post])
  310. Align the placement by the amount specified in ``alignment``. Generates
  311. .. code-block::none
  312. . = ALIGN(<alignment>)
  313. before and/or after (depending whether ``pre``, ``post`` or both are specified) the input section description generated from the mapping fragment entry. If neither 'pre' or 'post' is specified, the alignment command is generated before the input section description. Order sensitive.
  314. 2. SORT([<sort_by_first>, <sort_by_second>])
  315. Emits ``SORT_BY_NAME``, ``SORT_BY_ALIGNMENT``, ``SORT_BY_INIT_PRIORITY`` or ``SORT`` in the input section description.
  316. Possible values for ``sort_by_first`` and ``sort_by_second`` are: ``name``, ``alignment``, ``init_priority``.
  317. If both ``sort_by_first`` and ``sort_by_second`` are not specified, the input sections are sorted by name. If both are specified, then the nested sorting follows the same rules discussed in https://sourceware.org/binutils/docs/ld/Input-Section-Wildcards.html.
  318. 3. KEEP()
  319. Prevent the linker from discarding the placement by surrounding the input section description with KEEP command. See https://sourceware.org/binutils/docs/ld/Input-Section-Keep.html for more details.
  320. 4.SURROUND(<name>)
  321. Generate symbols before and after the placement. The generated symbols follow the naming ``_<name>_start`` and ``_<name>_end``. For example, if ``name`` == sym1,
  322. .. code-block::none
  323. _sym1_start = ABSOLUTE(.)
  324. ...
  325. _sym2_end = ABSOLUTE(.)
  326. These symbols can then be referenced from C/C++ code. Order sensitive.
  327. When adding flags, the specific ``section -> target`` in the scheme needs to be specified. For multiple ``section -> target``, use a comma as a separator. For example,
  328. .. code-block:: none
  329. # Notes:
  330. # A. semicolon after entity-scheme
  331. # B. comma before section2 -> target2
  332. # C. section1 -> target1 and section2 -> target2 should be defined in entries of scheme1
  333. entity1 (scheme1);
  334. section1 -> target1 KEEP() ALIGN(4, pre, post),
  335. section2 -> target2 SURROUND(sym) ALIGN(4, post) SORT()
  336. Putting it all together, the following mapping fragment, for example,
  337. .. code-block:: none
  338. [mapping:name]
  339. archive: lib1.a
  340. entries:
  341. obj1 (noflash);
  342. rodata -> dram0_data KEEP() SORT() ALIGN(8) SURROUND(my_sym)
  343. generates an output on the linker script:
  344. .. code-block:: none
  345. . = ALIGN(8)
  346. _my_sym_start = ABSOLUTE(.)
  347. KEEP(lib1.a:obj1.*( SORT(.rodata) SORT(.rodata.*) ))
  348. _my_sym_end = ABSOLUTE(.)
  349. Note that ALIGN and SURROUND, as mentioned in the flag descriptions, are order sensitive. Therefore, if for the same mapping fragment these two are switched, the following is generated instead:
  350. .. code-block:: none
  351. _my_sym_start = ABSOLUTE(.)
  352. . = ALIGN(8)
  353. KEEP(lib1.a:obj1.*( SORT(.rodata) SORT(.rodata.*) ))
  354. _my_sym_end = ABSOLUTE(.)
  355. .. _ldgen-symbol-granularity-placements :
  356. On Symbol-Granularity Placements
  357. """"""""""""""""""""""""""""""""
  358. Symbol granularity placements is possible due to compiler flags ``-ffunction-sections`` and ``-ffdata-sections``. ESP-IDF compiles with these flags by default.
  359. If the user opts to remove these flags, then the symbol-granularity placements will not work. Furthermore, even with the presence of these flags, there are still other limitations to keep in mind due to the dependence on the compiler's emitted output sections.
  360. For example, with ``-ffunction-sections``, separate sections are emitted for each function; with section names predictably constructed i.e. ``.text.{func_name}`` and ``.literal.{func_name}``. This is not the case for string literals within the function, as they go to pooled or generated section names.
  361. With ``-fdata-sections``, for global scope data the compiler predictably emits either ``.data.{var_name}``, ``.rodata.{var_name}`` or ``.bss.{var_name}``; and so ``Type I`` mapping entry works for these.
  362. However, this is not the case for static data declared in function scope, as the generated section name is a result of mangling the variable name with some other information.
  363. .. _ldgen-linker-script-template :
  364. Linker Script Template
  365. ^^^^^^^^^^^^^^^^^^^^^^
  366. The linker script template is the skeleton in which the generated placement rules are put into. It is an otherwise ordinary linker script, with a specific marker syntax that indicates where the generated placement rules are placed.
  367. To reference the placement rules collected under a ``target`` token, the following syntax is used:
  368. .. code-block:: none
  369. mapping[target]
  370. Example:
  371. The example below is an excerpt from a possible linker script template. It defines an output section ``.iram0.text``, and inside is a marker referencing the target ``iram0_text``.
  372. .. code-block:: none
  373. .iram0.text :
  374. {
  375. /* Code marked as runnning out of IRAM */
  376. _iram_text_start = ABSOLUTE(.);
  377. /* Marker referencing iram0_text */
  378. mapping[iram0_text]
  379. _iram_text_end = ABSOLUTE(.);
  380. } > iram0_0_seg
  381. Suppose the generator collected the fragment definitions below:
  382. .. code-block:: none
  383. [sections:text]
  384. .text+
  385. .literal+
  386. [sections:iram]
  387. .iram1+
  388. [scheme:default]
  389. entries:
  390. text -> flash_text
  391. iram -> iram0_text
  392. [scheme:noflash]
  393. entries:
  394. text -> iram0_text
  395. [mapping:freertos]
  396. archive: libfreertos.a
  397. entries:
  398. * (noflash)
  399. Then the corresponding excerpt from the generated linker script will be as follows:
  400. .. code-block:: c
  401. .iram0.text :
  402. {
  403. /* Code marked as runnning out of IRAM */
  404. _iram_text_start = ABSOLUTE(.);
  405. /* Placement rules generated from the processed fragments, placed where the marker was in the template */
  406. *(.iram1 .iram1.*)
  407. *libfreertos.a:(.literal .text .literal.* .text.*)
  408. _iram_text_end = ABSOLUTE(.);
  409. } > iram0_0_seg
  410. ``*libfreertos.a:(.literal .text .literal.* .text.*)``
  411. Rule generated from the entry ``* (noflash)`` of the ``freertos`` mapping fragment. All ``text`` sections of all object files under the archive ``libfreertos.a`` will be collected under the target ``iram0_text`` (as per the ``noflash`` scheme) and placed wherever in the template ``iram0_text`` is referenced by a marker.
  412. ``*(.iram1 .iram1.*)``
  413. Rule generated from the default scheme entry ``iram -> iram0_text``. Since the default scheme specifies an ``iram -> iram0_text`` entry, it too is placed wherever ``iram0_text`` is referenced by a marker. Since it is a rule generated from the default scheme, it comes first among all other rules collected under the same target name.
  414. The linker script template currently used is :component_file:`esp_system/ld/{IDF_TARGET_PATH_NAME}/sections.ld.in`; the generated output script ``sections.ld`` is put under its build directory.