Chapter 4. API Guides
Linker Fragment Files
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: sections, scheme and mapping.
Grammar The three fragment types share a common grammar:
[type:name]
key: value
key:
value
value
value
...
• type: Corresponds to the fragment type, can either be sections, scheme or mapping.
• name: The name of the fragment, should be unique for the specified fragment type.
• key, value: Contents of the fragment; each fragment type may support different keys and different grammars
for the key values.
Note: In cases where multiple fragments of the same type and name are encountered, an exception is thrown.
Note: The only valid characters for fragment names and keys are alphanumeric characters and underscore.
Condition Checking
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:
• comparison
– LessThan <
– LessThanOrEqualTo <=
– MoreThan >
– MoreThanOrEqualTo >=
– Equal =
– NotEqual !=
• logical
– Or ||
– And &&
– Negation !
• grouping
– Parenthesis ()
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 equiv-
alent:
# Value for keys is dependent on config
[type:name]
key_1:
if CONDITION = y:
value_1
(continues on next page)
Espressif Systems 1415
Submit Document Feedback
Release v4.4