ESP32 ESP-IDF link script mechanism

ESP-IDF link script mechanism

ESP-IDF from the v3.3start to support the componentlevel of control the linking process, only need to use Linker Script Generation mechanisms and grammatical conventions, in componentadding in a xx.lffile, 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)

Script generator will xx.lfbe 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

Guess you like

Origin blog.csdn.net/qq_20515461/article/details/108148724