1idf_build_get_property(target IDF_TARGET) 2 3# On Linux, we only support a few features, hence this simple component registration 4if(${target} STREQUAL "linux") 5 idf_component_register(SRCS "esp_system.c" 6 "port/soc/linux/reset_reason.c" 7 "port/soc/linux/system_internal.c" 8 "port/esp_system_linux.c" 9 INCLUDE_DIRS "include") 10 return() 11endif() 12 13set(srcs "esp_err.c") 14 15if(CONFIG_IDF_ENV_FPGA) 16 list(APPEND srcs "fpga_overrides.c") 17endif() 18 19if(BOOTLOADER_BUILD) 20 # "_esp_error_check_failed()" requires spi_flash module 21 # Bootloader relies on some Kconfig options defined in esp_system. 22 idf_component_register(SRCS "${srcs}" REQUIRES spi_flash) 23else() 24 list(APPEND srcs "crosscore_int.c" 25 "esp_ipc.c" 26 "esp_err.c" 27 "freertos_hooks.c" 28 "int_wdt.c" 29 "panic.c" 30 "esp_system.c" 31 "startup.c" 32 "system_time.c" 33 "stack_check.c" 34 "ubsan.c" 35 "xt_wdt.c" 36 "debug_stubs.c") 37 38 if(CONFIG_ESP_TASK_WDT_EN) 39 list(APPEND srcs "task_wdt/task_wdt.c") 40 41 if(CONFIG_ESP_TASK_WDT_USE_ESP_TIMER) 42 list(APPEND srcs "task_wdt/task_wdt_impl_esp_timer.c") 43 else() 44 list(APPEND srcs "task_wdt/task_wdt_impl_timergroup.c") 45 endif() 46 endif() 47 48 if(CONFIG_ESP_SYSTEM_USE_EH_FRAME) 49 list(APPEND srcs "eh_frame_parser.c") 50 endif() 51 52 if(CONFIG_SOC_SYSTIMER_SUPPORT_ETM) 53 list(APPEND srcs "systick_etm.c") 54 endif() 55 56 idf_component_register(SRCS "${srcs}" 57 INCLUDE_DIRS include 58 PRIV_REQUIRES spi_flash esp_timer esp_mm 59 # [refactor-todo] requirements due to init code, 60 # should be removable once using component init functions 61 # link-time registration is used. 62 # [refactor-todo] requires "driver" for headers: 63 # - spi_common_internal.h 64 # [refactor-todo] esp_partition required for virtual efuse 65 # init code. Move to esp_efuse component. 66 pthread bootloader_support efuse driver esp_partition 67 LDFRAGMENTS "linker.lf" "app.lf") 68 add_subdirectory(port) 69 70 # After system initialization, `start_app` (and its other cores variant) is called. 71 # This is provided by the user or from another component. Since we can't establish 72 # dependency on what we don't know, force linker to not drop the symbol regardless 73 # of link line order. 74 target_link_libraries(${COMPONENT_LIB} INTERFACE "-u start_app") 75 76 if(NOT CONFIG_ESP_SYSTEM_SINGLE_CORE_MODE) 77 target_link_libraries(${COMPONENT_LIB} INTERFACE "-u start_app_other_cores") 78 endif() 79 80 # Disable stack protection in files which are involved in initialization of that feature 81 set_source_files_properties( 82 "startup.c" "stack_check.c" 83 PROPERTIES COMPILE_FLAGS 84 -fno-stack-protector) 85 86 include(${CMAKE_CURRENT_LIST_DIR}/ld/ld.cmake) 87endif() 88 89if(CONFIG_IDF_ENV_FPGA) 90 # Forces the linker to include fpga stubs from this component 91 target_link_libraries(${COMPONENT_LIB} INTERFACE "-u esp_common_include_fpga_overrides") 92endif() 93 94# Force linking UBSAN hooks. If UBSAN is not enabled, the hooks will ultimately be removed 95# due to -ffunction-sections -Wl,--gc-sections options. 96target_link_libraries(${COMPONENT_LIB} INTERFACE "-u __ubsan_include") 97 98 99# [refactor-todo] requirements due to init code, should be removable 100# once link-time registration of component init functions is used. 101if(CONFIG_APPTRACE_ENABLE) 102 idf_component_optional_requires(PRIVATE app_trace) 103endif() 104 105if(CONFIG_ESP_COREDUMP_ENABLE) 106 idf_component_optional_requires(PRIVATE espcoredump) 107endif() 108 109# [refactor-todo] requirement from the panic handler, 110# need to introduce panic "event" concept to remove this dependency (IDF-2194) 111idf_component_optional_requires(PRIVATE esp_gdbstub) 112 113idf_component_optional_requires(PRIVATE esp_app_format) 114 115if(CONFIG_PM_ENABLE) 116 idf_component_optional_requires(PRIVATE pm) 117endif() 118 119if(CONFIG_VFS_SUPPORT_IO) 120 idf_component_optional_requires(PRIVATE vfs) 121endif() 122 123if(CONFIG_SW_COEXIST_ENABLE OR CONFIG_EXTERNAL_COEX_ENABLE) 124 idf_component_optional_requires(PRIVATE esp_coex) 125endif() 126 127if(NOT BOOTLOADER_BUILD) 128 if(CONFIG_SPIRAM) 129 idf_component_optional_requires(PRIVATE esp_psram) 130 endif() 131endif() 132