FindSTM32HAL.cmake 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. IF(STM32_FAMILY STREQUAL "F1")
  2. SET(HAL_HEADERS
  3. stm32f1xx_hal.h
  4. stm32f1xx_hal_adc.h
  5. stm32f1xx_hal_adc_ex.h
  6. stm32f1xx_hal_can.h
  7. stm32f1xx_hal_can_ex.h
  8. stm32f1xx_hal_cec.h
  9. stm32f1xx_hal_cortex.h
  10. stm32f1xx_hal_crc.h
  11. stm32f1xx_hal_dac.h
  12. stm32f1xx_hal_dac_ex.h
  13. stm32f1xx_hal_def.h
  14. stm32f1xx_hal_dma.h
  15. stm32f1xx_hal_dma_ex.h
  16. stm32f1xx_hal_eth.h
  17. stm32f1xx_hal_flash.h
  18. stm32f1xx_hal_flash_ex.h
  19. stm32f1xx_hal_gpio.h
  20. stm32f1xx_hal_gpio_ex.h
  21. stm32f1xx_hal_hcd.h
  22. stm32f1xx_hal_i2c.h
  23. stm32f1xx_hal_i2s.h
  24. stm32f1xx_hal_irda.h
  25. stm32f1xx_hal_iwdg.h
  26. stm32f1xx_hal_nand.h
  27. stm32f1xx_hal_nor.h
  28. stm32f1xx_hal_pccard.h
  29. stm32f1xx_hal_pcd.h
  30. stm32f1xx_hal_pcd_ex.h
  31. stm32f1xx_hal_pwr.h
  32. stm32f1xx_hal_rcc.h
  33. stm32f1xx_hal_rcc_ex.h
  34. stm32f1xx_hal_rtc.h
  35. stm32f1xx_hal_rtc_ex.h
  36. stm32f1xx_hal_sd.h
  37. stm32f1xx_hal_smartcard.h
  38. stm32f1xx_hal_spi.h
  39. stm32f1xx_hal_sram.h
  40. stm32f1xx_hal_tim.h
  41. stm32f1xx_hal_tim_ex.h
  42. stm32f1xx_hal_uart.h
  43. stm32f1xx_hal_usart.h
  44. stm32f1xx_hal_wwdg.h
  45. stm32f1xx_ll_fsmc.h
  46. stm32f1xx_ll_sdmmc.h
  47. stm32f1xx_ll_usb.h
  48. )
  49. SET(HAL_SRCS
  50. stm32f1xx_hal.c
  51. stm32f1xx_hal_adc.c
  52. stm32f1xx_hal_adc_ex.c
  53. stm32f1xx_hal_can.c
  54. stm32f1xx_hal_cec.c
  55. stm32f1xx_hal_cortex.c
  56. stm32f1xx_hal_crc.c
  57. stm32f1xx_hal_dac.c
  58. stm32f1xx_hal_dac_ex.c
  59. stm32f1xx_hal_dma.c
  60. stm32f1xx_hal_eth.c
  61. stm32f1xx_hal_flash.c
  62. stm32f1xx_hal_flash_ex.c
  63. stm32f1xx_hal_gpio.c
  64. stm32f1xx_hal_gpio_ex.c
  65. stm32f1xx_hal_hcd.c
  66. stm32f1xx_hal_i2c.c
  67. stm32f1xx_hal_i2s.c
  68. stm32f1xx_hal_irda.c
  69. stm32f1xx_hal_iwdg.c
  70. stm32f1xx_hal_nand.c
  71. stm32f1xx_hal_nor.c
  72. stm32f1xx_hal_pccard.c
  73. stm32f1xx_hal_pcd.c
  74. stm32f1xx_hal_pcd_ex.c
  75. stm32f1xx_hal_pwr.c
  76. stm32f1xx_hal_rcc.c
  77. stm32f1xx_hal_rcc_ex.c
  78. stm32f1xx_hal_rtc.c
  79. stm32f1xx_hal_rtc_ex.c
  80. stm32f1xx_hal_sd.c
  81. stm32f1xx_hal_smartcard.c
  82. stm32f1xx_hal_spi.c
  83. stm32f1xx_hal_spi_ex.c
  84. stm32f1xx_hal_sram.c
  85. stm32f1xx_hal_tim.c
  86. stm32f1xx_hal_tim_ex.c
  87. stm32f1xx_hal_uart.c
  88. stm32f1xx_hal_usart.c
  89. stm32f1xx_hal_wwdg.c
  90. stm32f1xx_ll_fsmc.c
  91. stm32f1xx_ll_sdmmc.c
  92. stm32f1xx_ll_usb.c
  93. )
  94. ELSEIF(STM32_FAMILY STREQUAL "F4")
  95. SET(HAL_HEADERS
  96. stm32f4xx_hal.h
  97. stm32f4xx_hal_adc.h
  98. stm32f4xx_hal_adc_ex.h
  99. stm32f4xx_hal_can.h
  100. stm32f4xx_hal_cec.h
  101. stm32f4xx_hal_cortex.h
  102. stm32f4xx_hal_crc.h
  103. stm32f4xx_hal_cryp.h
  104. stm32f4xx_hal_cryp_ex.h
  105. stm32f4xx_hal_dac.h
  106. stm32f4xx_hal_dac_ex.h
  107. stm32f4xx_hal_dcmi.h
  108. stm32f4xx_hal_dcmi_ex.h
  109. stm32f4xx_hal_def.h
  110. stm32f4xx_hal_dma.h
  111. stm32f4xx_hal_dma2d.h
  112. stm32f4xx_hal_dma_ex.h
  113. stm32f4xx_hal_eth.h
  114. stm32f4xx_hal_flash.h
  115. stm32f4xx_hal_flash_ex.h
  116. stm32f4xx_hal_flash_ramfunc.h
  117. stm32f4xx_hal_fmpi2c.h
  118. stm32f4xx_hal_fmpi2c_ex.h
  119. stm32f4xx_hal_gpio.h
  120. stm32f4xx_hal_gpio_ex.h
  121. stm32f4xx_hal_hash.h
  122. stm32f4xx_hal_hash_ex.h
  123. stm32f4xx_hal_hcd.h
  124. stm32f4xx_hal_i2c.h
  125. stm32f4xx_hal_i2c_ex.h
  126. stm32f4xx_hal_i2s.h
  127. stm32f4xx_hal_i2s_ex.h
  128. stm32f4xx_hal_irda.h
  129. stm32f4xx_hal_iwdg.h
  130. stm32f4xx_hal_ltdc.h
  131. stm32f4xx_hal_nand.h
  132. stm32f4xx_hal_nor.h
  133. stm32f4xx_hal_pccard.h
  134. stm32f4xx_hal_pcd.h
  135. stm32f4xx_hal_pcd_ex.h
  136. stm32f4xx_hal_pwr.h
  137. stm32f4xx_hal_pwr_ex.h
  138. stm32f4xx_hal_qspi.h
  139. stm32f4xx_hal_rcc.h
  140. stm32f4xx_hal_rcc_ex.h
  141. stm32f4xx_hal_rng.h
  142. stm32f4xx_hal_rtc.h
  143. stm32f4xx_hal_rtc_ex.h
  144. stm32f4xx_hal_sai.h
  145. stm32f4xx_hal_sai_ex.h
  146. stm32f4xx_hal_sd.h
  147. stm32f4xx_hal_sdram.h
  148. stm32f4xx_hal_smartcard.h
  149. stm32f4xx_hal_spdifrx.h
  150. stm32f4xx_hal_spi.h
  151. stm32f4xx_hal_sram.h
  152. stm32f4xx_hal_tim.h
  153. stm32f4xx_hal_tim_ex.h
  154. stm32f4xx_hal_uart.h
  155. stm32f4xx_hal_usart.h
  156. stm32f4xx_hal_wwdg.h
  157. stm32f4xx_ll_fmc.h
  158. stm32f4xx_ll_fsmc.h
  159. stm32f4xx_ll_sdmmc.h
  160. stm32f4xx_ll_usb.h
  161. )
  162. SET(HAL_SRCS
  163. stm32f4xx_hal.c
  164. stm32f4xx_hal_adc.c
  165. stm32f4xx_hal_adc_ex.c
  166. stm32f4xx_hal_can.c
  167. stm32f4xx_hal_cec.c
  168. stm32f4xx_hal_cortex.c
  169. stm32f4xx_hal_crc.c
  170. stm32f4xx_hal_cryp.c
  171. stm32f4xx_hal_cryp_ex.c
  172. stm32f4xx_hal_dac.c
  173. stm32f4xx_hal_dac_ex.c
  174. stm32f4xx_hal_dcmi.c
  175. stm32f4xx_hal_dcmi_ex.c
  176. stm32f4xx_hal_dma.c
  177. stm32f4xx_hal_dma2d.c
  178. stm32f4xx_hal_dma_ex.c
  179. stm32f4xx_hal_eth.c
  180. stm32f4xx_hal_flash.c
  181. stm32f4xx_hal_flash_ex.c
  182. stm32f4xx_hal_flash_ramfunc.c
  183. stm32f4xx_hal_fmpi2c.c
  184. stm32f4xx_hal_fmpi2c_ex.c
  185. stm32f4xx_hal_gpio.c
  186. stm32f4xx_hal_hash.c
  187. stm32f4xx_hal_hash_ex.c
  188. stm32f4xx_hal_hcd.c
  189. stm32f4xx_hal_i2c.c
  190. stm32f4xx_hal_i2c_ex.c
  191. stm32f4xx_hal_i2s.c
  192. stm32f4xx_hal_i2s_ex.c
  193. stm32f4xx_hal_irda.c
  194. stm32f4xx_hal_iwdg.c
  195. stm32f4xx_hal_ltdc.c
  196. stm32f4xx_hal_nand.c
  197. stm32f4xx_hal_nor.c
  198. stm32f4xx_hal_pccard.c
  199. stm32f4xx_hal_pcd.c
  200. stm32f4xx_hal_pcd_ex.c
  201. stm32f4xx_hal_pwr.c
  202. stm32f4xx_hal_pwr_ex.c
  203. stm32f4xx_hal_qspi.c
  204. stm32f4xx_hal_rcc.c
  205. stm32f4xx_hal_rcc_ex.c
  206. stm32f4xx_hal_rng.c
  207. stm32f4xx_hal_rtc.c
  208. stm32f4xx_hal_rtc_ex.c
  209. stm32f4xx_hal_sai.c
  210. stm32f4xx_hal_sai_ex.c
  211. stm32f4xx_hal_sd.c
  212. stm32f4xx_hal_sdram.c
  213. stm32f4xx_hal_smartcard.c
  214. stm32f4xx_hal_spdifrx.c
  215. stm32f4xx_hal_spi.c
  216. stm32f4xx_hal_sram.c
  217. stm32f4xx_hal_tim.c
  218. stm32f4xx_hal_tim_ex.c
  219. stm32f4xx_hal_uart.c
  220. stm32f4xx_hal_usart.c
  221. stm32f4xx_hal_wwdg.c
  222. stm32f4xx_ll_fmc.c
  223. stm32f4xx_ll_fsmc.c
  224. stm32f4xx_ll_sdmmc.c
  225. stm32f4xx_ll_usb.c
  226. )
  227. ENDIF()
  228. STRING(TOLOWER ${STM32_FAMILY} STM32_FAMILY_LOWER)
  229. FIND_PATH(STM32HAL_INCLUDE_DIR ${HAL_HEADERS}
  230. PATH_SUFFIXES include stm32${STM32_FAMILY_LOWER}
  231. )
  232. FOREACH(HAL_SRC ${HAL_SRCS})
  233. SET(HAL_SRC_FILE HAL_SRC_FILE-NOTFOUND)
  234. FIND_FILE(HAL_SRC_FILE NAMES ${HAL_SRC} PATHS ${CMAKE_FIND_ROOT_PATH} PATH_SUFFIXES share/stm32hal/${STM32_FAMILY_LOWER} stm32hal/${STM32_FAMILY_LOWER})
  235. LIST(APPEND STM32HAL_SOURCES ${HAL_SRC_FILE})
  236. ENDFOREACH()
  237. INCLUDE(FindPackageHandleStandardArgs)
  238. FIND_PACKAGE_HANDLE_STANDARD_ARGS(STM32HAL DEFAULT_MSG STM32HAL_INCLUDE_DIR STM32HAL_SOURCES)