ESP-IDF link script mechanism
ESP-IDF from the v3.3
start to support the component
level of control the linking process, only need to use Linker Script Generation mechanisms and grammatical conventions, in component
adding in a xx.lf
file, and referenced in the Makefile.
COMPONENT_ADD_LDFRAGMENTS += "xx.lf"
Fill in the content according to the agreed grammar:
\\示例:
[sections:text]
.text+
.literal+
[sections:iram]
.iram1+
[scheme:default]
entries:
text -> flash_text
iram -> iram0_text
[scheme:noflash]
entries:
text -> iram0_text
[mapping:freertos]
archive: libfreertos.a
entries:
* (noflash)
- For grammar rules, please refer to the document: Linker Script Generation
Script generator will xx.lf
be converted into gcc link fragment ultimately add to the project's link to the script:
\\示例:
.iram0.text :
{
/* Code marked as runnning out of IRAM */
_iram_text_start = ABSOLUTE(.);
/* Placement rules generated from the processed fragments, placed where the marker was in the template */
*(.iram1 .iram1.*)
*libfreertos.a:(.literal .text .literal.* .text.*)
_iram_text_end = ABSOLUTE(.);
} > iram0_0_seg