2021-01-25 21:48:12 -05:00
|
|
|
idf_build_get_property(target IDF_TARGET)
|
|
|
|
|
2021-01-20 02:18:55 -05:00
|
|
|
set(srcs)
|
2021-01-25 21:48:12 -05:00
|
|
|
|
2021-01-26 00:12:54 -05:00
|
|
|
if(CONFIG_IDF_ENV_FPGA)
|
|
|
|
list(APPEND srcs "fpga_overrides.c")
|
|
|
|
endif()
|
|
|
|
|
2021-01-20 02:18:55 -05:00
|
|
|
if(BOOTLOADER_BUILD)
|
|
|
|
# Bootloader relies on some Kconfig options defined in esp_system.
|
|
|
|
idf_component_register(SRCS "${srcs}")
|
|
|
|
else()
|
2021-02-23 07:06:41 -05:00
|
|
|
list(APPEND srcs "crosscore_int.c"
|
|
|
|
"esp_err.c"
|
2021-01-20 02:18:55 -05:00
|
|
|
"freertos_hooks.c"
|
|
|
|
"int_wdt.c"
|
|
|
|
"panic.c"
|
2021-03-10 20:48:30 -05:00
|
|
|
"esp_system.c"
|
2021-01-20 02:18:55 -05:00
|
|
|
"startup.c"
|
|
|
|
"system_time.c"
|
|
|
|
"stack_check.c"
|
2020-11-20 21:15:59 -05:00
|
|
|
"task_wdt.c"
|
|
|
|
"ubsan.c")
|
2020-03-02 23:22:41 -05:00
|
|
|
|
2021-06-10 03:22:43 -04:00
|
|
|
if(NOT (${target} STREQUAL "esp32c3") AND NOT (${target} STREQUAL "esp32h2"))
|
2021-01-20 02:18:55 -05:00
|
|
|
list(APPEND srcs "dbg_stubs.c")
|
|
|
|
endif()
|
2021-01-25 21:48:12 -05:00
|
|
|
|
2021-01-20 02:18:55 -05: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-03-10 08:39:29 -05:00
|
|
|
esp_pm app_update nvs_flash pthread app_trace esp_gdbstub
|
2021-05-24 07:39:39 -04:00
|
|
|
espcoredump esp_phy
|
2021-03-10 06:33:24 -05:00
|
|
|
LDFRAGMENTS "linker.lf" "app.lf")
|
2021-01-20 02:18:55 -05:00
|
|
|
add_subdirectory(port)
|
2020-02-13 07:43:23 -05:00
|
|
|
|
2021-01-20 02:18:55 -05: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 06:11:22 -04:00
|
|
|
|
2021-01-20 02:18:55 -05: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 05:10:54 -04:00
|
|
|
|
2020-11-10 02:40:01 -05:00
|
|
|
endif()
|
2021-01-26 00:12:54 -05: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-20 21:15:59 -05: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")
|