CMakeLists.txt 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. idf_build_get_property(target IDF_TARGET)
  2. set(requires soc)
  3. set(priv_requires efuse spi_flash bootloader_support)
  4. set(srcs "cpu.c" "esp_memory_utils.c")
  5. if(NOT BOOTLOADER_BUILD)
  6. list(APPEND srcs "esp_clk.c"
  7. "clk_ctrl_os.c"
  8. "hw_random.c"
  9. "intr_alloc.c"
  10. "mac_addr.c"
  11. "periph_ctrl.c"
  12. "rtc_module.c"
  13. "sleep_modes.c"
  14. "sleep_gpio.c"
  15. "sleep_mac_bb.c"
  16. "regi2c_ctrl.c"
  17. "adc_share_hw_ctrl.c")
  18. if(NOT CONFIG_IDF_TARGET_ESP32 AND NOT CONFIG_IDF_TARGET_ESP32S2)
  19. list(APPEND srcs "sleep_retention.c")
  20. endif()
  21. # [refactor-todo]: requires "driver" for GPIO and RTC (by sleep_gpio and sleep_modes)
  22. list(APPEND priv_requires driver esp_timer)
  23. if(CONFIG_IDF_TARGET_ESP32 OR CONFIG_IDF_TARGET_ESP32S2)
  24. list(APPEND srcs "rtc_wdt.c")
  25. endif()
  26. if(CONFIG_SOC_GDMA_SUPPORTED)
  27. list(APPEND srcs "gdma.c" "port/async_memcpy_impl_gdma.c")
  28. endif()
  29. if(CONFIG_SOC_CP_DMA_SUPPORTED)
  30. list(APPEND srcs "port/async_memcpy_impl_cp_dma.c")
  31. endif()
  32. if(CONFIG_SOC_GDMA_SUPPORTED OR CONFIG_SOC_CP_DMA_SUPPORTED)
  33. list(APPEND srcs "esp_async_memcpy.c")
  34. endif()
  35. if(CONFIG_SOC_SYSTIMER_SUPPORTED)
  36. list(APPEND srcs "port/${target}/systimer.c")
  37. endif()
  38. else()
  39. # Requires "_esp_error_check_failed()" function
  40. list(APPEND priv_requires "esp_system")
  41. endif()
  42. idf_component_register(SRCS ${srcs}
  43. INCLUDE_DIRS include include/soc include/soc/${target}
  44. PRIV_INCLUDE_DIRS port/include include/esp_private
  45. REQUIRES ${requires}
  46. PRIV_REQUIRES "${priv_requires}"
  47. LDFRAGMENTS linker.lf)
  48. idf_build_get_property(target IDF_TARGET)
  49. add_subdirectory(port/${target})
  50. if(NOT BOOTLOADER_BUILD)
  51. if(CONFIG_SPIRAM)
  52. idf_component_optional_requires(PRIVATE esp_psram)
  53. endif()
  54. endif()
  55. target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")