2021-01-25 21:48:12 -05:00
|
|
|
idf_build_get_property(target IDF_TARGET)
|
|
|
|
|
2022-11-03 11:59:19 -04:00
|
|
|
# On Linux, we only support a few features, hence this simple component registration
|
|
|
|
if(${target} STREQUAL "linux")
|
|
|
|
idf_component_register(SRCS "esp_system.c"
|
|
|
|
"port/soc/linux/reset_reason.c"
|
|
|
|
"port/soc/linux/system_internal.c"
|
|
|
|
"port/esp_system_linux.c"
|
|
|
|
INCLUDE_DIRS "include")
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
2021-02-07 02:03:51 -05:00
|
|
|
set(srcs "esp_err.c")
|
2021-01-25 21:48:12 -05:00
|
|
|
|
2023-06-20 04:04:41 -04:00
|
|
|
if(CONFIG_IDF_ENV_FPGA OR CONFIG_ESP_BRINGUP_BYPASS_CPU_CLK_SETTING)
|
2023-12-04 21:42:19 -05:00
|
|
|
list(APPEND srcs "fpga_overrides_clk.c")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_IDF_ENV_FPGA OR CONFIG_ESP_BRINGUP_BYPASS_RANDOM_SETTING)
|
|
|
|
list(APPEND srcs "fpga_overrides_rng.c")
|
2021-01-26 00:12:54 -05:00
|
|
|
endif()
|
|
|
|
|
2021-01-20 02:18:55 -05:00
|
|
|
if(BOOTLOADER_BUILD)
|
2021-02-07 02:03:51 -05: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 02:18:55 -05:00
|
|
|
else()
|
2021-02-23 07:06:41 -05:00
|
|
|
list(APPEND srcs "crosscore_int.c"
|
2021-09-16 23:14:32 -04:00
|
|
|
"esp_ipc.c"
|
2021-02-23 07:06:41 -05:00
|
|
|
"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"
|
2023-11-24 12:32:37 -05:00
|
|
|
"startup_funcs.c"
|
2021-01-20 02:18:55 -05:00
|
|
|
"system_time.c"
|
|
|
|
"stack_check.c"
|
2021-08-29 23:30:12 -04:00
|
|
|
"ubsan.c"
|
2024-01-23 19:41:18 -05:00
|
|
|
"xt_wdt.c")
|
2021-01-25 21:48:12 -05:00
|
|
|
|
2022-08-23 05:58:14 -04:00
|
|
|
if(CONFIG_ESP_TASK_WDT_EN)
|
2022-08-12 06:27:11 -04:00
|
|
|
list(APPEND srcs "task_wdt/task_wdt.c")
|
|
|
|
|
|
|
|
if(CONFIG_ESP_TASK_WDT_USE_ESP_TIMER)
|
|
|
|
list(APPEND srcs "task_wdt/task_wdt_impl_esp_timer.c")
|
|
|
|
else()
|
|
|
|
list(APPEND srcs "task_wdt/task_wdt_impl_timergroup.c")
|
|
|
|
endif()
|
2022-07-07 02:54:15 -04:00
|
|
|
endif()
|
|
|
|
|
2021-02-07 02:03:51 -05:00
|
|
|
if(CONFIG_ESP_SYSTEM_USE_EH_FRAME)
|
|
|
|
list(APPEND srcs "eh_frame_parser.c")
|
|
|
|
endif()
|
|
|
|
|
2022-08-29 05:59:11 -04:00
|
|
|
if(CONFIG_SOC_SYSTIMER_SUPPORT_ETM)
|
|
|
|
list(APPEND srcs "systick_etm.c")
|
|
|
|
endif()
|
|
|
|
|
2023-05-04 11:31:31 -04:00
|
|
|
if(CONFIG_ESP_SYSTEM_HW_STACK_GUARD)
|
|
|
|
list(APPEND srcs "hw_stack_guard.c")
|
|
|
|
endif()
|
|
|
|
|
2021-01-20 02:18:55 -05:00
|
|
|
idf_component_register(SRCS "${srcs}"
|
|
|
|
INCLUDE_DIRS include
|
2022-11-02 07:11:45 -04:00
|
|
|
PRIV_REQUIRES spi_flash esp_timer esp_mm
|
2021-01-20 02:18:55 -05:00
|
|
|
# [refactor-todo] requirements due to init code,
|
|
|
|
# should be removable once using component init functions
|
|
|
|
# link-time registration is used.
|
2024-06-11 22:55:51 -04:00
|
|
|
bootloader_support esp_pm
|
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(
|
2024-01-24 22:12:21 -05:00
|
|
|
"startup.c" "stack_check.c" "port/cpu_start.c"
|
2021-01-20 02:18:55 -05:00
|
|
|
PROPERTIES COMPILE_FLAGS
|
|
|
|
-fno-stack-protector)
|
2020-09-02 05:10:54 -04:00
|
|
|
|
2021-04-07 22:27:21 -04:00
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/ld/ld.cmake)
|
2020-11-10 02:40:01 -05:00
|
|
|
endif()
|
2021-01-26 00:12:54 -05:00
|
|
|
|
2023-06-20 04:04:41 -04:00
|
|
|
if(CONFIG_IDF_ENV_FPGA OR CONFIG_ESP_BRINGUP_BYPASS_CPU_CLK_SETTING)
|
2021-01-26 00:12:54 -05:00
|
|
|
# Forces the linker to include fpga stubs from this component
|
2023-12-04 21:42:19 -05:00
|
|
|
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u esp_common_include_fpga_overrides_clk")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_IDF_ENV_FPGA OR CONFIG_ESP_BRINGUP_BYPASS_RANDOM_SETTING)
|
|
|
|
# Forces the linker to include fpga stubs from this component
|
|
|
|
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u esp_common_include_fpga_overrides_rng")
|
2021-01-26 00:12:54 -05:00
|
|
|
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")
|
2021-12-13 04:52:22 -05:00
|
|
|
|
2023-11-24 12:32:37 -05:00
|
|
|
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u esp_system_include_startup_funcs")
|
2021-12-13 04:52:22 -05: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)
|
2021-06-07 15:54:09 -04:00
|
|
|
idf_component_optional_requires(PRIVATE esp_gdbstub)
|
2022-02-07 04:20:59 -05:00
|
|
|
|
2023-05-04 05:14:46 -04:00
|
|
|
if(NOT CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT)
|
|
|
|
idf_component_optional_requires(PRIVATE esp_app_format)
|
|
|
|
endif()
|
2022-02-07 04:20:59 -05:00
|
|
|
|
|
|
|
if(CONFIG_PM_ENABLE)
|
|
|
|
idf_component_optional_requires(PRIVATE pm)
|
|
|
|
endif()
|
2022-04-15 04:51:07 -04:00
|
|
|
|
|
|
|
if(CONFIG_VFS_SUPPORT_IO)
|
|
|
|
idf_component_optional_requires(PRIVATE vfs)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_SW_COEXIST_ENABLE OR CONFIG_EXTERNAL_COEX_ENABLE)
|
2022-12-14 04:10:54 -05:00
|
|
|
idf_component_optional_requires(PRIVATE esp_coex)
|
2022-04-15 04:51:07 -04:00
|
|
|
endif()
|
2022-05-10 22:32:56 -04:00
|
|
|
|
|
|
|
if(NOT BOOTLOADER_BUILD)
|
|
|
|
if(CONFIG_SPIRAM)
|
|
|
|
idf_component_optional_requires(PRIVATE esp_psram)
|
|
|
|
endif()
|
|
|
|
endif()
|
2024-02-12 00:51:25 -05:00
|
|
|
|
|
|
|
if(CONFIG_SOC_MEM_NON_CONTIGUOUS_SRAM)
|
|
|
|
target_link_options(${COMPONENT_LIB} INTERFACE "-Wl,--enable-non-contiguous-regions")
|
|
|
|
endif()
|