CMakeLists.txt 4.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. PROJECT(stm32cmsis)
  2. CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
  3. ENABLE_LANGUAGE(ASM)
  4. IF(${STM32_FAMILY} STREQUAL "F1")
  5. IF(NOT STM32Cube_DIR)
  6. SET(STM32Cube_DIR "/opt/STM32Cube_FW_F1_V1.1.0")
  7. MESSAGE(STATUS "No STM32Cube_DIR specified, using default: " ${STM32Cube_DIR})
  8. ENDIF()
  9. SET(CMSIS_HEADERS
  10. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h
  11. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f100xb.h
  12. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f100xe.h
  13. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f101x6.h
  14. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f101xb.h
  15. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f101xe.h
  16. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f101xg.h
  17. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f102x6.h
  18. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f102xb.h
  19. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103x6.h
  20. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h
  21. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h
  22. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xg.h
  23. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f105xc.h
  24. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f107xc.h
  25. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h
  26. ${STM32Cube_DIR}/Drivers/CMSIS/Include/arm_common_tables.h
  27. ${STM32Cube_DIR}/Drivers/CMSIS/Include/arm_const_structs.h
  28. ${STM32Cube_DIR}/Drivers/CMSIS/Include/arm_math.h
  29. ${STM32Cube_DIR}/Drivers/CMSIS/Include/core_cm3.h
  30. ${STM32Cube_DIR}/Drivers/CMSIS/Include/core_cmFunc.h
  31. ${STM32Cube_DIR}/Drivers/CMSIS/Include/core_cmInstr.h
  32. ${STM32Cube_DIR}/Drivers/CMSIS/Include/core_cmSimd.h
  33. )
  34. SET(CMSIS_SOURCES
  35. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c
  36. )
  37. SET(CMSIS_LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/stm32f1.ld.in)
  38. SET(STARTUP_PREFIX ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f)
  39. ELSEIF(${STM32_FAMILY} STREQUAL "F4")
  40. IF(NOT STM32Cube_DIR)
  41. SET(STM32Cube_DIR "/opt/STM32Cube_FW_F4_V1.6.0")
  42. MESSAGE(STATUS "No STM32Cube_DIR specified, using default: " ${STM32Cube_DIR})
  43. ENDIF()
  44. SET(CMSIS_HEADERS
  45. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h
  46. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f401xc.h
  47. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f401xe.h
  48. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f405xx.h
  49. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f407xx.h
  50. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f411xe.h
  51. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f415xx.h
  52. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f417xx.h
  53. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f427xx.h
  54. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f429xx.h
  55. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f437xx.h
  56. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f439xx.h
  57. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f446xx.h
  58. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Include/system_stm32f4xx.h
  59. ${STM32Cube_DIR}/Drivers/CMSIS/Include/arm_common_tables.h
  60. ${STM32Cube_DIR}/Drivers/CMSIS/Include/arm_const_structs.h
  61. ${STM32Cube_DIR}/Drivers/CMSIS/Include/arm_math.h
  62. ${STM32Cube_DIR}/Drivers/CMSIS/Include/core_cm4.h
  63. ${STM32Cube_DIR}/Drivers/CMSIS/Include/core_cmFunc.h
  64. ${STM32Cube_DIR}/Drivers/CMSIS/Include/core_cmInstr.h
  65. ${STM32Cube_DIR}/Drivers/CMSIS/Include/core_cmSimd.h
  66. )
  67. SET(CMSIS_SOURCES
  68. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c
  69. )
  70. SET(CMSIS_LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/stm32f4.ld.in)
  71. SET(STARTUP_PREFIX ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f)
  72. ENDIF()
  73. FOREACH(CHIP_TYPE ${STM32_CHIP_TYPES})
  74. STRING(TOLOWER ${CHIP_TYPE} CHIP_TYPE_LOWER)
  75. LIST(APPEND CMSIS_STARTUP_FILES ${STARTUP_PREFIX}${CHIP_TYPE_LOWER}.s)
  76. ENDFOREACH()
  77. INSTALL(FILES ${CMSIS_HEADERS} DESTINATION include/stm32${STM32_FAMILY_LOWER})
  78. INSTALL(FILES ${CMSIS_STARTUP_FILES} ${CMSIS_LINKER_SCRIPT} DESTINATION share/cmsis/)
  79. INSTALL(FILES ${CMSIS_SOURCES} DESTINATION share/cmsis/)