CMakeLists.txt 2.7 KB

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