Chapter 4. API Guides
else:
value_2
key_2:
if CONDITION = y:
value_a
else:
value_b
# Entire fragment definition is dependent on config
if CONDITION = y:
[type:name]
key_1:
value_1
key_2:
value_b
else:
[type:name]
key_1:
value_2
key_2:
value_b
Comments
Comment in linker fragment files begin with #. Like in other languages, comment are used to provide helpful de-
scriptions and documentation and are ignored during processing.
Compatibility with ESP-IDF v3.x Linker Script Fragment Files
linker script fragment file grammar:
• 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
• move to if...elif...else structure for conditionals, with the ability to nest checks and place entire
fragments themselves inside conditionals
• mapping fragments now requires a name like other fragment types
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.
Note that linker fragment files using the new ESP-IDF v4.0 grammar is not supported on ESP-IDF v3.x, however.
Types
Sections
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.
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.
[sections:name]
entries:
.section+
.section
...
Example:
Espressif Systems
1416
Submit Document Feedback
(continued from previous page)
ESP-IDF v4.0 brings some changes to the
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?
Questions and answers