CMakeLists.txt 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. idf_build_get_property(target IDF_TARGET)
  2. set(srcs
  3. "gpio/gpio.c"
  4. "gpio/rtc_io.c"
  5. "gptimer.c"
  6. "i2c.c"
  7. "ledc.c"
  8. "sdspi_crc.c"
  9. "sdspi_host.c"
  10. "sdspi_transaction.c"
  11. "spi_common.c"
  12. "spi_master.c"
  13. "spi_slave.c"
  14. "spi_bus_lock.c"
  15. "uart.c")
  16. # deprecated source files
  17. list(APPEND srcs "deprecated/timer_legacy.c")
  18. set(includes "include" "deprecated")
  19. if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${target}/include")
  20. list(APPEND includes "${target}/include")
  21. endif()
  22. if(CONFIG_SOC_ADC_SUPPORTED)
  23. list(APPEND srcs "deprecated/adc_legacy.c")
  24. endif()
  25. if(CONFIG_SOC_ADC_DMA_SUPPORTED)
  26. list(APPEND srcs "deprecated/adc_dma_legacy.c")
  27. endif()
  28. if(CONFIG_SOC_MCPWM_SUPPORTED)
  29. list(APPEND srcs "mcpwm/mcpwm_cap.c"
  30. "mcpwm/mcpwm_cmpr.c"
  31. "mcpwm/mcpwm_com.c"
  32. "mcpwm/mcpwm_fault.c"
  33. "mcpwm/mcpwm_gen.c"
  34. "mcpwm/mcpwm_oper.c"
  35. "mcpwm/mcpwm_sync.c"
  36. "mcpwm/mcpwm_timer.c"
  37. "deprecated/mcpwm_legacy.c")
  38. endif()
  39. if(CONFIG_SOC_DEDICATED_GPIO_SUPPORTED)
  40. list(APPEND srcs "gpio/dedic_gpio.c")
  41. endif()
  42. if(CONFIG_SOC_SDM_SUPPORTED)
  43. list(APPEND srcs "sdm.c" "deprecated/sigma_delta_legacy.c")
  44. endif()
  45. if(CONFIG_SOC_RMT_SUPPORTED)
  46. list(APPEND srcs "rmt/rmt_common.c" "rmt/rmt_encoder.c" "rmt/rmt_rx.c" "rmt/rmt_tx.c" "deprecated/rmt_legacy.c")
  47. endif()
  48. if(CONFIG_SOC_PCNT_SUPPORTED)
  49. list(APPEND srcs "pulse_cnt.c" "deprecated/pcnt_legacy.c")
  50. endif()
  51. if(CONFIG_SOC_SDMMC_HOST_SUPPORTED)
  52. list(APPEND srcs "sdmmc_transaction.c" "sdmmc_host.c")
  53. endif()
  54. if(CONFIG_SOC_I2S_SUPPORTED)
  55. list(APPEND srcs "i2s/i2s_common.c"
  56. "i2s/i2s_std.c"
  57. "deprecated/i2s_legacy.c")
  58. if(CONFIG_SOC_I2S_SUPPORTS_PDM)
  59. list(APPEND srcs "i2s/i2s_pdm.c")
  60. endif()
  61. if(CONFIG_SOC_I2S_SUPPORTS_TDM)
  62. list(APPEND srcs "i2s/i2s_tdm.c")
  63. endif()
  64. endif()
  65. if(CONFIG_SOC_TEMP_SENSOR_SUPPORTED)
  66. list(APPEND srcs "temperature_sensor.c"
  67. "deprecated/rtc_temperature_legacy.c")
  68. endif()
  69. if(CONFIG_SOC_TWAI_SUPPORTED)
  70. list(APPEND srcs "twai.c")
  71. endif()
  72. if(CONFIG_SOC_USB_SERIAL_JTAG_SUPPORTED)
  73. list(APPEND srcs "usb_serial_jtag.c")
  74. endif()
  75. if(CONFIG_SOC_SPI_SUPPORT_SLAVE_HD_VER2)
  76. list(APPEND srcs "spi_slave_hd.c")
  77. endif()
  78. if(CONFIG_SOC_TOUCH_SENSOR_SUPPORTED)
  79. list(APPEND srcs "touch_sensor_common.c" "${target}/touch_sensor.c")
  80. endif()
  81. if(CONFIG_SOC_SDIO_SLAVE_SUPPORTED)
  82. list(APPEND srcs "sdio_slave.c")
  83. endif()
  84. if(${target} STREQUAL "esp32")
  85. list(APPEND srcs "dac_common.c"
  86. "deprecated/adc_i2s_deprecated.c"
  87. "esp32/dac.c")
  88. endif()
  89. if(${target} STREQUAL "esp32s2")
  90. list(APPEND srcs "dac_common.c"
  91. "esp32s2/dac.c")
  92. endif()
  93. if(BOOTLOADER_BUILD)
  94. # Bootloader shall NOT depend on the drivers
  95. idf_component_register()
  96. else()
  97. # (REQUIRES cannot hide soc headers, since many arguments in the driver headers are chip-dependent)
  98. # (Legacy drivers requires `esp_adc`, due to ADC HW resource mutex logics are there.
  99. # Can be removed together with legacy drivers)
  100. idf_component_register(SRCS "${srcs}"
  101. INCLUDE_DIRS ${includes}
  102. PRIV_INCLUDE_DIRS "include/driver"
  103. PRIV_REQUIRES efuse esp_timer
  104. REQUIRES esp_pm esp_ringbuf freertos soc hal esp_hw_support
  105. LDFRAGMENTS linker.lf)
  106. endif()