2021-01-26 10:48:12 +08:00
|
|
|
idf_build_get_property(target IDF_TARGET)
|
|
|
|
|
2021-02-07 15:03:51 +08:00
|
|
|
set(srcs "esp_err.c")
|
2021-01-26 10:48:12 +08:00
|
|
|
|
2021-01-26 13:12:54 +08:00
|
|
|
if(CONFIG_IDF_ENV_FPGA)
|
|
|
|
list(APPEND srcs "fpga_overrides.c")
|
|
|
|
endif()
|
|
|
|
|
2021-01-20 15:18:55 +08:00
|
|
|
if(BOOTLOADER_BUILD)
|
2021-02-07 15:03:51 +08:00
|
|
|
# "_esp_error_check_failed()" requires spi_flash module
|
|
|
|
# Bootloader relies on some Kconfig options defined in esp_system.
|
|
|
|
idf_component_register(SRCS "${srcs}" REQUIRES spi_flash)
|
2021-01-20 15:18:55 +08:00
|
|
|
else()
|
2021-02-23 20:06:41 +08:00
|
|
|
list(APPEND srcs "crosscore_int.c"
|
2021-09-17 11:14:32 +08:00
|
|
|
"esp_ipc.c"
|
2021-02-23 20:06:41 +08:00
|
|
|
"esp_err.c"
|
2021-01-20 15:18:55 +08:00
|
|
|
"freertos_hooks.c"
|
|
|
|
"int_wdt.c"
|
|
|
|
"panic.c"
|
2021-03-11 09:48:30 +08:00
|
|
|
"esp_system.c"
|
2021-01-20 15:18:55 +08:00
|
|
|
"startup.c"
|
|
|
|
"system_time.c"
|
|
|
|
"stack_check.c"
|
2020-11-21 03:15:59 +01:00
|
|
|
"task_wdt.c"
|
2021-08-30 11:30:12 +08:00
|
|
|
"ubsan.c"
|
2021-09-16 00:06:10 +03:00
|
|
|
"xt_wdt.c"
|
|
|
|
"debug_stubs.c")
|
2021-01-26 10:48:12 +08:00
|
|
|
|
2021-11-06 17:24:45 +08:00
|
|
|
if(NOT (${target} STREQUAL "esp8684"))
|
|
|
|
list(APPEND srcs "debug_stubs.c")
|
|
|
|
endif()
|
|
|
|
|
2021-02-07 15:03:51 +08:00
|
|
|
if(CONFIG_ESP_SYSTEM_USE_EH_FRAME)
|
|
|
|
list(APPEND srcs "eh_frame_parser.c")
|
|
|
|
endif()
|
|
|
|
|
2021-01-20 15:18:55 +08:00
|
|
|
idf_component_register(SRCS "${srcs}"
|
|
|
|
INCLUDE_DIRS include
|
|
|
|
PRIV_REQUIRES spi_flash
|
|
|
|
# [refactor-todo] requirements due to init code,
|
|
|
|
# should be removable once using component init functions
|
|
|
|
# link-time registration is used.
|
2021-12-13 10:52:22 +01:00
|
|
|
esp_pm app_update nvs_flash pthread
|
|
|
|
esp_phy efuse
|
2021-03-10 19:33:24 +08:00
|
|
|
LDFRAGMENTS "linker.lf" "app.lf")
|
2021-01-20 15:18:55 +08:00
|
|
|
add_subdirectory(port)
|
2020-02-13 17:43:23 +05:00
|
|
|
|
2021-01-20 15:18:55 +08:00
|
|
|
# After system initialization, `start_app` (and its other cores variant) is called.
|
|
|
|
# This is provided by the user or from another component. Since we can't establish
|
|
|
|
# dependency on what we don't know, force linker to not drop the symbol regardless
|
|
|
|
# of link line order.
|
|
|
|
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u start_app")
|
|
|
|
|
|
|
|
if(NOT CONFIG_ESP_SYSTEM_SINGLE_CORE_MODE)
|
|
|
|
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u start_app_other_cores")
|
|
|
|
endif()
|
2020-07-21 18:11:22 +08:00
|
|
|
|
2021-01-20 15:18:55 +08:00
|
|
|
# Disable stack protection in files which are involved in initialization of that feature
|
|
|
|
set_source_files_properties(
|
|
|
|
"startup.c" "stack_check.c"
|
|
|
|
PROPERTIES COMPILE_FLAGS
|
|
|
|
-fno-stack-protector)
|
2020-09-02 17:10:54 +08:00
|
|
|
|
2021-04-08 10:27:21 +08:00
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/ld/ld.cmake)
|
2020-11-10 18:40:01 +11:00
|
|
|
endif()
|
2021-01-26 13:12:54 +08:00
|
|
|
|
|
|
|
if(CONFIG_IDF_ENV_FPGA)
|
|
|
|
# Forces the linker to include fpga stubs from this component
|
|
|
|
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u esp_common_include_fpga_overrides")
|
|
|
|
endif()
|
2020-11-21 03:15:59 +01:00
|
|
|
|
|
|
|
# Force linking UBSAN hooks. If UBSAN is not enabled, the hooks will ultimately be removed
|
|
|
|
# due to -ffunction-sections -Wl,--gc-sections options.
|
|
|
|
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u __ubsan_include")
|
2021-12-13 10:52:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
# [refactor-todo] requirements due to init code, should be removable
|
|
|
|
# once link-time registration of component init functions is used.
|
|
|
|
if(CONFIG_APPTRACE_ENABLE)
|
|
|
|
idf_component_optional_requires(PRIVATE app_trace)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_ESP_COREDUMP_ENABLE)
|
|
|
|
idf_component_optional_requires(PRIVATE espcoredump)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# [refactor-todo] requirement from the panic handler,
|
|
|
|
# need to introduce panic "event" concept to remove this dependency (IDF-2194)
|
|
|
|
if(CONFIG_ESP_SYSTEM_PANIC_GDBSTUB)
|
|
|
|
idf_component_optional_requires(PRIVATE esp_gdbstub)
|
|
|
|
endif()
|