CMakeLists.txt 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. idf_build_get_property(target IDF_TARGET)
  2. set(srcs "mpu_hal.c"
  3. "efuse_hal.c"
  4. "${target}/efuse_hal.c"
  5. "mmu_hal.c")
  6. set(includes "${target}/include" "include" "platform_port/include")
  7. if(NOT CONFIG_HAL_WDT_USE_ROM_IMPL)
  8. list(APPEND srcs "wdt_hal_iram.c")
  9. endif()
  10. if(NOT ${target} STREQUAL "esp32")
  11. list(APPEND srcs "cache_hal.c")
  12. endif()
  13. if(${target} STREQUAL "esp32h2")
  14. if(CONFIG_IDF_TARGET_ESP32H2_BETA_VERSION_1)
  15. list(APPEND includes "${target}/include/rev1")
  16. elseif(CONFIG_IDF_TARGET_ESP32H2_BETA_VERSION_2)
  17. list(APPEND includes "${target}/include/rev2")
  18. endif()
  19. endif()
  20. if(NOT BOOTLOADER_BUILD)
  21. list(APPEND srcs
  22. "rtc_io_hal.c"
  23. "spi_hal.c"
  24. "spi_hal_iram.c"
  25. "spi_slave_hal.c"
  26. "spi_slave_hal_iram.c"
  27. "timer_hal.c"
  28. "timer_hal_iram.c"
  29. "ledc_hal.c"
  30. "ledc_hal_iram.c"
  31. "i2c_hal.c"
  32. "i2c_hal_iram.c"
  33. "gpio_hal.c"
  34. "uart_hal.c"
  35. "uart_hal_iram.c"
  36. "spi_flash_hal.c"
  37. "spi_flash_hal_iram.c"
  38. "spi_flash_encrypt_hal_iram.c"
  39. "sha_hal.c"
  40. "adc_hal_common.c"
  41. "adc_oneshot_hal.c")
  42. if(CONFIG_SOC_SYSTIMER_SUPPORTED AND NOT CONFIG_HAL_SYSTIMER_USE_ROM_IMPL)
  43. list(APPEND srcs "systimer_hal.c")
  44. endif()
  45. if(CONFIG_SOC_RMT_SUPPORTED)
  46. list(APPEND srcs "rmt_hal.c")
  47. endif()
  48. if(CONFIG_SOC_PCNT_SUPPORTED)
  49. list(APPEND srcs "pcnt_hal.c")
  50. endif()
  51. if(CONFIG_SOC_MCPWM_SUPPORTED)
  52. list(APPEND srcs "mcpwm_hal.c")
  53. endif()
  54. if(CONFIG_SOC_TWAI_SUPPORTED)
  55. list(APPEND srcs "twai_hal.c" "twai_hal_iram.c")
  56. endif()
  57. if(CONFIG_SOC_GDMA_SUPPORTED)
  58. list(APPEND srcs "gdma_hal.c")
  59. endif()
  60. if(CONFIG_SOC_I2S_SUPPORTED)
  61. list(APPEND srcs "i2s_hal.c")
  62. endif()
  63. if(CONFIG_SOC_SDM_SUPPORTED)
  64. list(APPEND srcs "sdm_hal.c")
  65. endif()
  66. if(CONFIG_ETH_USE_ESP32_EMAC)
  67. list(APPEND srcs "emac_hal.c")
  68. endif()
  69. if(CONFIG_SOC_ADC_DMA_SUPPORTED)
  70. list(APPEND srcs "adc_hal.c")
  71. endif()
  72. if(CONFIG_SOC_LCDCAM_SUPPORTED)
  73. list(APPEND srcs "lcd_hal.c")
  74. endif()
  75. if(CONFIG_SOC_ECC_SUPPORTED)
  76. list(APPEND srcs "ecc_hal.c")
  77. endif()
  78. if(${target} STREQUAL "esp32")
  79. list(APPEND srcs
  80. "dac_hal.c"
  81. "sdio_slave_hal.c"
  82. "touch_sensor_hal.c"
  83. "aes_hal.c"
  84. "esp32/brownout_hal.c"
  85. "esp32/touch_sensor_hal.c"
  86. "esp32/gpio_hal_workaround.c")
  87. endif()
  88. if(${target} STREQUAL "esp32s2")
  89. list(APPEND srcs
  90. "dac_hal.c"
  91. "spi_flash_hal_gpspi.c"
  92. "spi_slave_hd_hal.c"
  93. "touch_sensor_hal.c"
  94. "usb_hal.c"
  95. "usb_phy_hal.c"
  96. "xt_wdt_hal.c"
  97. "aes_hal.c"
  98. "esp32s2/brownout_hal.c"
  99. "esp32s2/cp_dma_hal.c"
  100. "esp32s2/touch_sensor_hal.c"
  101. "esp32s2/dac_hal.c"
  102. "usbh_hal.c")
  103. endif()
  104. if(${target} STREQUAL "esp32s3")
  105. list(APPEND srcs
  106. "ds_hal.c"
  107. "spi_flash_hal_gpspi.c"
  108. "spi_slave_hd_hal.c"
  109. "touch_sensor_hal.c"
  110. "usb_hal.c"
  111. "usb_phy_hal.c"
  112. "xt_wdt_hal.c"
  113. "aes_hal.c"
  114. "esp32s3/brownout_hal.c"
  115. "esp32s3/hmac_hal.c"
  116. "esp32s3/touch_sensor_hal.c"
  117. "esp32s3/rtc_cntl_hal.c"
  118. "usbh_hal.c")
  119. endif()
  120. if(${target} STREQUAL "esp32c3")
  121. list(APPEND srcs
  122. "ds_hal.c"
  123. "spi_flash_hal_gpspi.c"
  124. "spi_slave_hd_hal.c"
  125. "xt_wdt_hal.c"
  126. "aes_hal.c"
  127. "esp32c3/brownout_hal.c"
  128. "esp32c3/hmac_hal.c"
  129. "esp32c3/rtc_cntl_hal.c")
  130. endif()
  131. if(${target} STREQUAL "esp32h2")
  132. list(APPEND srcs
  133. "ds_hal.c"
  134. "spi_flash_hal_gpspi.c"
  135. "spi_slave_hd_hal.c"
  136. "aes_hal.c"
  137. "esp32h2/brownout_hal.c"
  138. "esp32h2/hmac_hal.c"
  139. "esp32h2/rtc_cntl_hal.c")
  140. endif()
  141. if(${target} STREQUAL "esp32c2")
  142. list(APPEND srcs
  143. "spi_flash_hal_gpspi.c"
  144. "spi_slave_hd_hal.c"
  145. "esp32c2/brownout_hal.c"
  146. "esp32c2/rtc_cntl_hal.c")
  147. endif()
  148. endif()
  149. idf_component_register(SRCS ${srcs}
  150. INCLUDE_DIRS ${includes}
  151. PRIV_INCLUDE_DIRS ${priv_include}
  152. REQUIRES soc esp_rom
  153. LDFRAGMENTS linker.lf)
  154. target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
  155. if(CONFIG_HAL_DEFAULT_ASSERTION_LEVEL EQUAL 1)
  156. target_link_libraries(${COMPONENT_LIB} INTERFACE "-u abort")
  157. elseif(CONFIG_HAL_DEFAULT_ASSERTION_LEVEL EQUAL 2)
  158. target_link_libraries(${COMPONENT_LIB} INTERFACE "-u __assert_func")
  159. endif()