1idf_build_get_property(target IDF_TARGET) 2 3set(requires soc) 4set(priv_requires efuse bootloader_support spi_flash) 5if(${target} STREQUAL "esp32") 6 list(APPEND requires efuse) 7endif() 8 9set(srcs "compare_set.c" "cpu_util.c") 10if(NOT BOOTLOADER_BUILD) 11 list(APPEND srcs "esp_async_memcpy.c" 12 "esp_clk.c" 13 "clk_ctrl_os.c" 14 "hw_random.c" 15 "intr_alloc.c" 16 "mac_addr.c" 17 "sleep_modes.c" 18 "sleep_gpio.c" 19 "sleep_mac_bb.c" 20 "regi2c_ctrl.c") 21 if(NOT CONFIG_IDF_TARGET_ESP32 AND NOT CONFIG_IDF_TARGET_ESP32S2) 22 list(APPEND srcs "sleep_retention.c") 23 endif() 24 list(APPEND requires esp_ipc) 25else() 26 # Requires "_esp_error_check_failed()" function 27 list(APPEND priv_requires "esp_system") 28endif() 29 30idf_component_register(SRCS ${srcs} 31 INCLUDE_DIRS include include/soc include/soc/${target} 32 PRIV_INCLUDE_DIRS port/include 33 REQUIRES ${requires} 34 PRIV_REQUIRES "${priv_requires}" 35 LDFRAGMENTS linker.lf) 36 37idf_build_get_property(target IDF_TARGET) 38add_subdirectory(port/${target}) 39 40if(CONFIG_IDF_TARGET_ESP32 AND CONFIG_SPIRAM_CACHE_WORKAROUND AND NOT BOOTLOADER_BUILD) 41 # Note: Adding as a PUBLIC compile option here causes this option to propagate to all 42 # components that depend on esp32. 43 # 44 # To handle some corner cases, the same flag is set in project_include.cmake 45 target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-issue) 46 # also, make sure we link with this option so correct toolchain libs are pulled in 47 target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-issue) 48 # set strategy selected 49 # note that we don't need to set link options as the library linked is independent of this 50 if(CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_DUPLDST) 51 target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=dupldst) 52 target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=dupldst) 53 endif() 54 if(CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_MEMW) 55 target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=memw) 56 target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=memw) 57 endif() 58 if(CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_NOPS) 59 target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=nops) 60 target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=nops) 61 endif() 62endif() 63