EasyManuals Logo

Espressif ESP32-S2 User Manual

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #1423 background imageLoading...
Page #1423 background image
Chapter 4. API Guides
(continued from previous page)
- src/
- my_src1.c
- my_src2.c
- my_src3.c
- my_linker_fragment_file.lf
a component named my_component that is archived as library libmy_component.a during build
three source files archived under the library, my_src1.c, my_src2.c and my_src3.c which are com-
piled as my_src1.o, my_src2.o and my_src3.o, respectively
under my_src1.o, the function my_function1 is defined; under my_src2.o, the function
my_function2 is defined
there is bool-type config PERFORMANCE_MODE (y/n) and int type config PERFORMANCE_LEVEL (with
range 0-3) in my_components Kconfig
Creating and Specifying a Linker Fragment File
Before anything else, a linker fragment file needs to be created. A linker fragment file is simply a text file with a .lf
extension upon which the desired placements will be written. After creating the file, it is then necessary to present it
to the build system. The instructions for the build systems supported by ESP-IDF are as follows:
Make In the components component.mk file, set the variable COMPONENT_ADD_LDFRAGMENTS to the
path of the created linker fragment file. The path can either be an absolute path or a relative path from the component
directory.
COMPONENT_ADD_LDFRAGMENTS += my_linker_fragment_file.lf
CMake In the components CMakeLists.txt file, specify argument LDFRAGMENTS in the
idf_component_register call. The value of LDFRAGMENTS can either be an absolute path or a
relative path from the component directory to the created linker fragment file.
# file paths relative to CMakeLists.txt
idf_component_register(...
LDFRAGMENTS "path/to/linker_fragment_file.lf" "path/to/
,another_linker_fragment_file.lf"
...
)
Specifying placements
It is possible to specify placements at the following levels of granularity:
object file (.obj or .o files)
symbol (function/variable)
archive (.a files)
Placing object files Suppose the entirety of my_src1.o is performance-critical, so it is desirable to place it in
RAM. On the other hand, the entirety of my_src2.o contains symbols needed coming out of deep sleep, so it needs
to be put under RTC memory. In the the linker fragment file, we can write:
[mapping:my_component]
archive: libmy_component.a
entries:
my_src1 (noflash) # places all my_src1 code/read-only data under IRAM/DRAM
my_src2 (rtc) # places all my_src2 code/ data and read-only data under
,RTC fast memory/RTC slow memory
Espressif Systems 1412
Submit Document Feedback
Release v4.4

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Espressif ESP32-S2 and is the answer not in the manual?

Espressif ESP32-S2 Specifications

General IconGeneral
BrandEspressif
ModelESP32-S2
CategorySingle board computers
LanguageEnglish