Chapter 4. API Guides
What happens to my_src3.o? Since it is not specified, default placements are used for my_src3.o. More on
default placements here.
Placing symbols 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:
[mapping:my_component]
archive: libmy_component.a
entries:
my_src1:my_function1 (noflash)
my_src2:my_function2 (rtc)
The default placements are used for the rest of the functions in my_src1.o and my_src2.o and the entire ob-
ject3.o. Something similar can be achieved for placing data by writing the variable name instead of the function
name, like so:
my_src1:my_variable (noflash)
Warning: There are limitations 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 use object-granularity placements.
Placing entire archive In this example, suppose that the entire component archive needs to be placed in RAM.
This can be written as:
[mapping:my_component]
archive: libmy_component.a
entries:
* (noflash)
Similarly, this places the entire component in RTC memory:
[mapping:my_component]
archive: libmy_component.a
entries:
* (rtc)
Configuration-dependent placements Suppose that the entire component library should only have special place-
ment when a certain condition is true; for example, when CONFIG_PERFORMANCE_MODE == y. This could be
written as:
[mapping:my_component]
archive: libmy_component.a
entries:
if PERFORMANCE_MODE = y:
* (noflash)
else:
* (default)
For a more complex config-dependent placement, suppose the following requirements: when
CONFIG_PERFORMANCE_LEVEL == 1, only object1.o is put in RAM; when CON-
FIG_PERFORMANCE_LEVEL == 2, object1.o and object2.o; and when CON-
FIG_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:
Espressif Systems 1413
Submit Document Feedback
Release v4.4