CMakeLists.txt 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. cmake_minimum_required(VERSION 3.13)
  2. set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake)
  3. if(NOT TEST_FAMILIES)
  4. # Can't test H7 because it needs some non-free components
  5. set(TEST_FAMILIES F0 F1 F2 F3 F4 F7 G0 G4 L0 L1 L4)
  6. endif()
  7. # Nucleo boards can have different devices on it
  8. set(DEVICE_STM32F0xx_Nucleo_32 F031K6)
  9. set(DEVICE_STM32F0xx_Nucleo F030R8)
  10. set(DEVICE_STM32F1xx_Nucleo F103RB)
  11. set(DEVICE_STM32F2xx_Nucleo_144 F207ZG)
  12. set(DEVICE_STM32F3xx_Nucleo_32 F303K8)
  13. set(DEVICE_STM32F3xx_Nucleo F334R8)
  14. set(DEVICE_STM32F3xx_Nucleo_144 F303ZE)
  15. set(DEVICE_STM32F4xx_Nucleo_144 F429ZI)
  16. set(DEVICE_STM32F4xx_Nucleo F446RE)
  17. set(DEVICE_STM32F7xx_Nucleo_144 F746ZG)
  18. set(DEVICE_STM32G0xx_Nucleo G070RB)
  19. set(DEVICE_STM32G0xx_Nucleo_32 G031K8)
  20. set(DEVICE_STM32G4xx_Nucleo G474RE)
  21. set(DEVICE_STM32L0xx_Nucleo L053R8)
  22. set(DEVICE_STM32L0xx_Nucleo_32 L011K4)
  23. set(DEVICE_STM32L1xx_Nucleo L152RE)
  24. set(DEVICE_STM32L4xx_Nucleo L412RB)
  25. set(DEVICE_STM32L4xx_Nucleo_32 L412KB)
  26. set(DEVICE_STM32L4xx_Nucleo_144 L496ZG)
  27. set(DEFINES_STM32469I_EVAL USE_IOEXPANDER)
  28. set(DEFINES_STM32F769I_EVAL USE_IOEXPANDER)
  29. set(DEFINES_STM32L476G_EVAL USE_IOEXPANDER)
  30. set(DEFINES_STM32L4R9I_EVAL USE_ROCKTECH_480x272)
  31. # Ban some boards because their BSP need non-free components
  32. set(BANNED_BOARDS STM32756G_EVAL)
  33. project(bsp-test C ASM)
  34. set(CMAKE_INCLUDE_CURRENT_DIR TRUE)
  35. if(FETCH_ST_SOURCES)
  36. stm32_fetch_cube(${TEST_FAMILIES})
  37. endif()
  38. find_package(CMSIS REQUIRED)
  39. find_package(HAL REQUIRED)
  40. find_package(BSP REQUIRED)
  41. set(SOURCES main.c)
  42. foreach(FAMILY ${TEST_FAMILIES})
  43. foreach(BOARD ${BSP_${FAMILY}_BOARDS})
  44. string(REPLACE "-" "_" BOARD ${BOARD})
  45. if(BOARD IN_LIST BANNED_BOARDS)
  46. continue()
  47. endif()
  48. add_executable(bsp-test-${BOARD} ${SOURCES})
  49. target_link_libraries(bsp-test-${BOARD}
  50. BSP::STM32::${BOARD}
  51. HAL::STM32::${FAMILY}
  52. STM32::NoSys
  53. )
  54. if(DEVICE_${BOARD})
  55. target_link_libraries(bsp-test-${BOARD} CMSIS::STM32::${DEVICE_${BOARD}})
  56. endif()
  57. if(DEFINES_${BOARD})
  58. target_compile_definitions(bsp-test-${BOARD} PRIVATE ${DEFINES_${BOARD}})
  59. endif()
  60. foreach(COMP ${BSP_${FAMILY}_COMPONENTS})
  61. string(TOUPPER ${COMP} COMP)
  62. # Workaround - F3 has both CS43L22 and CS43L52 that conflicts
  63. if((FAMILY STREQUAL F3) AND (COMP STREQUAL CS43L22))
  64. continue()
  65. endif()
  66. target_link_libraries(bsp-test-${BOARD} BSP::STM32::${FAMILY}::${COMP})
  67. endforeach()
  68. endforeach()
  69. endforeach()