esp-idf/examples/build_system/wrappers/main/CMakeLists.txt
Omar Chebib 6dfac0dd68 example: add an example to show how to wrap functions in IDF and bootloader
A section in the documentation has also been added to talk about the wrap feature of the linker.
2022-09-09 16:47:16 +08:00

10 lines
710 B
CMake

# For this component, contraty to the bootloader's one, we don't need the WHOLE_ARCHIVE option.
# This is due to the fact that this source file, app_wrapper.c, contains a strong symbol that is required by the linker
# in order to generate the final binary: `app_main`. Thus, the whole app_wrapper object file, including the wrapper
# it contains, will be included inside the application binary.
idf_component_register(SRCS "app_wrapper.c")
# Tell the linker that we want to redefine the function named `esp_restart`.
# We must now define a function named __wrap_esp_restart, which has the same signature as the former implementation.
target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--wrap=esp_restart")