CMakeLists.txt 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. PROJECT(stm32cmsis)
  2. CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
  3. ENABLE_LANGUAGE(ASM)
  4. IF(${STM32_FAMILY} STREQUAL "F1")
  5. IF(NOT STM32F1_StdPeriphLib_DIR)
  6. SET(STM32F1_StdPeriphLib_DIR "/opt/STM32F10x_StdPeriph_Lib_V3.5.0")
  7. MESSAGE(STATUS "No STM32F1_StdPeriphLib_DIR specified, using default: " ${STM32F1_StdPeriphLib_DIR})
  8. ENDIF()
  9. INCLUDE_DIRECTORIES(
  10. ${STM32F1_StdPeriphLib_DIR}/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x/
  11. ${STM32F1_StdPeriphLib_DIR}/Libraries/CMSIS/CM3/CoreSupport/
  12. )
  13. SET(CMSIS_HEADERS
  14. ${STM32F1_StdPeriphLib_DIR}/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x/system_stm32f10x.h
  15. ${STM32F1_StdPeriphLib_DIR}/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x/stm32f10x.h
  16. ${STM32F1_StdPeriphLib_DIR}/Libraries/CMSIS/CM3/CoreSupport/core_cm3.h
  17. )
  18. SET(CMSIS_SOURCES
  19. ${STM32F1_StdPeriphLib_DIR}/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x/system_stm32f10x.c
  20. )
  21. SET(CMSIS_LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/stm32f1_flash.ld.in)
  22. SET(STARTUP_PREFIX ${STM32F1_StdPeriphLib_DIR}/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x/startup/gcc_ride7/startup_stm32f10x_)
  23. ELSEIF(${STM32_FAMILY} STREQUAL "F4")
  24. IF(NOT STM32Cube_DIR)
  25. SET(STM32Cube_DIR "/opt/STM32Cube_FW_F4_V1.6.0")
  26. MESSAGE(STATUS "No STM32Cube_DIR specified, using default: " ${STM32Cube_DIR})
  27. ENDIF()
  28. INCLUDE_DIRECTORIES(
  29. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Include
  30. ${STM32Cube_DIR}/Drivers/CMSIS/Include
  31. )
  32. SET(CMSIS_HEADERS
  33. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h
  34. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f401xc.h
  35. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f401xe.h
  36. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f405xx.h
  37. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f407xx.h
  38. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f411xe.h
  39. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f415xx.h
  40. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f417xx.h
  41. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f427xx.h
  42. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f429xx.h
  43. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f437xx.h
  44. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f439xx.h
  45. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f446xx.h
  46. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Include/system_stm32f4xx.h
  47. ${STM32Cube_DIR}/Drivers/CMSIS/Include/arm_common_tables.h
  48. ${STM32Cube_DIR}/Drivers/CMSIS/Include/arm_const_structs.h
  49. ${STM32Cube_DIR}/Drivers/CMSIS/Include/arm_math.h
  50. ${STM32Cube_DIR}/Drivers/CMSIS/Include/core_cm4.h
  51. ${STM32Cube_DIR}/Drivers/CMSIS/Include/core_cmFunc.h
  52. ${STM32Cube_DIR}/Drivers/CMSIS/Include/core_cmInstr.h
  53. ${STM32Cube_DIR}/Drivers/CMSIS/Include/core_cmSimd.h
  54. )
  55. SET(CMSIS_SOURCES
  56. ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c
  57. )
  58. SET(CMSIS_LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/stm32f4.ld.in)
  59. SET(STARTUP_PREFIX ${STM32Cube_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f)
  60. ENDIF()
  61. FOREACH(CHIP_TYPE ${STM32_CHIP_TYPES})
  62. STRING(TOLOWER ${CHIP_TYPE} CHIP_TYPE_LOWER)
  63. LIST(APPEND CMSIS_STARTUP_FILES ${STARTUP_PREFIX}${CHIP_TYPE_LOWER}.s)
  64. ENDFOREACH()
  65. INSTALL(FILES ${CMSIS_HEADERS} DESTINATION include/stm32${STM32_FAMILY_LOWER})
  66. INSTALL(FILES ${CMSIS_STARTUP_FILES} ${CMSIS_LINKER_SCRIPT} DESTINATION share/cmsis/)
  67. INSTALL(FILES ${CMSIS_SOURCES} DESTINATION share/cmsis/)