CMakeLists.txt 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. idf_build_get_property(target IDF_TARGET)
  2. if(${target} STREQUAL "linux")
  3. return() # This component is not supported by the POSIX/Linux simulator
  4. endif()
  5. # Always compiled source files
  6. set(srcs)
  7. # Always included headers
  8. set(includes "include"
  9. "deprecated"
  10. "analog_comparator/include"
  11. "dac/include"
  12. "i2c/include"
  13. "i2s/include"
  14. "ledc/include"
  15. "parlio/include"
  16. "rmt/include"
  17. "sdio_slave/include"
  18. "sdspi/include"
  19. "sigma_delta/include"
  20. "temperature_sensor/include"
  21. "touch_sensor/include"
  22. "twai/include"
  23. "uart/include"
  24. "usb_serial_jtag/include")
  25. # Always included linker fragments
  26. set(ldfragments "linker.lf")
  27. # ADC related source files (dprecated)
  28. if(CONFIG_SOC_ADC_SUPPORTED)
  29. list(APPEND srcs "deprecated/adc_legacy.c")
  30. endif()
  31. if(CONFIG_SOC_ADC_DMA_SUPPORTED)
  32. list(APPEND srcs "deprecated/adc_dma_legacy.c")
  33. endif()
  34. # Analog comparator related source files
  35. if(CONFIG_SOC_ANA_CMPR_SUPPORTED)
  36. list(APPEND srcs "analog_comparator/ana_cmpr.c")
  37. if(CONFIG_SOC_ANA_CMPR_SUPPORT_ETM)
  38. list(APPEND srcs "analog_comparator/ana_cmpr_etm.c")
  39. endif()
  40. endif()
  41. # DAC related source files
  42. if(CONFIG_SOC_DAC_SUPPORTED)
  43. list(APPEND srcs "dac/dac_oneshot.c"
  44. "dac/dac_cosine.c"
  45. "dac/dac_continuous.c"
  46. "dac/dac_common.c"
  47. "dac/${target}/dac_dma.c"
  48. "deprecated/dac_common_legacy.c"
  49. "deprecated/${target}/dac_legacy.c")
  50. endif()
  51. # Parallel IO related source files
  52. if(CONFIG_SOC_PARLIO_SUPPORTED)
  53. list(APPEND srcs "parlio/parlio_common.c" "parlio/parlio_tx.c")
  54. endif()
  55. # GPTimer legacy driver
  56. if(CONFIG_SOC_GPTIMER_SUPPORTED)
  57. list(APPEND srcs "deprecated/timer_legacy.c")
  58. endif()
  59. # I2C related source files
  60. if(CONFIG_SOC_I2C_SUPPORTED)
  61. list(APPEND srcs "i2c/i2c.c"
  62. "i2c/i2c_master.c"
  63. "i2c/i2c_common.c"
  64. )
  65. if(CONFIG_SOC_I2C_SUPPORT_SLAVE)
  66. list(APPEND srcs "i2c/i2c_slave.c")
  67. endif()
  68. list(APPEND ldfragments "i2c/linker.lf")
  69. endif()
  70. # I2S related source files
  71. if(CONFIG_SOC_I2S_SUPPORTED)
  72. list(APPEND srcs "i2s/i2s_common.c"
  73. "i2s/i2s_platform.c"
  74. "i2s/i2s_std.c"
  75. "deprecated/i2s_legacy.c")
  76. if(CONFIG_SOC_I2S_SUPPORTS_PDM)
  77. list(APPEND srcs "i2s/i2s_pdm.c")
  78. endif()
  79. if(CONFIG_SOC_I2S_SUPPORTS_TDM)
  80. list(APPEND srcs "i2s/i2s_tdm.c")
  81. endif()
  82. endif()
  83. # LEDC related source files
  84. if(CONFIG_SOC_LEDC_SUPPORTED)
  85. list(APPEND srcs "ledc/ledc.c")
  86. list(APPEND ldfragments "ledc/linker.lf")
  87. endif()
  88. # MCPWM legacy driver
  89. if(CONFIG_SOC_MCPWM_SUPPORTED)
  90. list(APPEND srcs "deprecated/mcpwm_legacy.c")
  91. endif()
  92. # PCNT legacy driver
  93. if(CONFIG_SOC_PCNT_SUPPORTED)
  94. list(APPEND srcs "deprecated/pcnt_legacy.c")
  95. endif()
  96. # RMT related source files
  97. if(CONFIG_SOC_RMT_SUPPORTED)
  98. list(APPEND srcs "rmt/rmt_common.c"
  99. "rmt/rmt_encoder.c"
  100. "rmt/rmt_rx.c"
  101. "rmt/rmt_tx.c"
  102. "deprecated/rmt_legacy.c")
  103. list(APPEND ldfragments "rmt/linker.lf")
  104. endif()
  105. # SDIO Slave related source files
  106. if(CONFIG_SOC_SDIO_SLAVE_SUPPORTED)
  107. list(APPEND srcs "sdio_slave/sdio_slave.c")
  108. endif()
  109. # Sigma-Delta Modulation related source files
  110. if(CONFIG_SOC_SDM_SUPPORTED)
  111. list(APPEND srcs "sigma_delta/sdm.c"
  112. "deprecated/sigma_delta_legacy.c")
  113. endif()
  114. # SDSPI related source files
  115. if(CONFIG_SOC_GPSPI_SUPPORTED)
  116. list(APPEND srcs "sdspi/sdspi_crc.c"
  117. "sdspi/sdspi_host.c"
  118. "sdspi/sdspi_transaction.c")
  119. endif()
  120. # Temperature Sensor related source files
  121. if(CONFIG_SOC_TEMP_SENSOR_SUPPORTED)
  122. list(APPEND srcs "temperature_sensor/temperature_sensor.c"
  123. "deprecated/rtc_temperature_legacy.c")
  124. endif()
  125. # Touch Sensor related source files
  126. if(CONFIG_SOC_TOUCH_SENSOR_SUPPORTED)
  127. list(APPEND srcs "touch_sensor/touch_sensor_common.c"
  128. "touch_sensor/${target}/touch_sensor.c")
  129. list(APPEND includes "touch_sensor/${target}/include")
  130. endif()
  131. # TWAI related source files
  132. if(CONFIG_SOC_TWAI_SUPPORTED)
  133. list(APPEND srcs "twai/twai.c")
  134. list(APPEND ldfragments "twai/linker.lf")
  135. endif()
  136. # UART related source files
  137. if(CONFIG_SOC_UART_SUPPORTED)
  138. list(APPEND srcs "uart/uart.c")
  139. list(APPEND ldfragments "uart/linker.lf")
  140. endif()
  141. # USB Serial JTAG related source files
  142. if(CONFIG_SOC_USB_SERIAL_JTAG_SUPPORTED)
  143. list(APPEND srcs "usb_serial_jtag/usb_serial_jtag.c"
  144. "usb_serial_jtag/usb_serial_jtag_connection_monitor.c")
  145. endif()
  146. # Other source files
  147. if(${target} STREQUAL "esp32")
  148. list(APPEND srcs "deprecated/adc_i2s_deprecated.c")
  149. endif()
  150. if(BOOTLOADER_BUILD)
  151. # Bootloader shall NOT depend on the drivers
  152. idf_component_register()
  153. else()
  154. # (REQUIRES cannot hide soc headers, since many arguments in the driver headers are chip-dependent)
  155. # (Legacy drivers requires `esp_adc`, due to ADC HW resource mutex logics are there.
  156. # Can be removed together with legacy drivers)
  157. idf_component_register(SRCS "${srcs}"
  158. INCLUDE_DIRS ${includes}
  159. PRIV_REQUIRES efuse esp_timer esp_mm
  160. REQUIRES esp_pm esp_ringbuf freertos soc hal esp_hw_support
  161. # for backward compatibility, the driver component needs to
  162. # have a public dependency on other "esp_driver_foo" components
  163. esp_driver_gpio esp_driver_pcnt esp_driver_gptimer esp_driver_spi esp_driver_mcpwm
  164. esp_driver_sdmmc
  165. LDFRAGMENTS ${ldfragments}
  166. )
  167. endif()
  168. # If system needs to monitor USJ connection status, then usb_serial_jtag_connection_monitor object file has to be linked
  169. # to the binary, to allow tick hook to be registered
  170. if(CONFIG_USJ_NO_AUTO_LS_ON_CONNECTION OR
  171. (CONFIG_SOC_USB_SERIAL_JTAG_SUPPORT_LIGHT_SLEEP AND CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED))
  172. target_link_libraries(${COMPONENT_LIB} INTERFACE "-u usb_serial_jtag_connection_monitor_include")
  173. endif()