Advertisement
evantill2

CMakeLists.txt

Oct 11th, 2022
1,700
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CMake 1.99 KB | None | 0 0
  1. cmake_minimum_required(VERSION 3.16)
  2.  
  3. message(STATUS "CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}")
  4.  
  5. set(STM32_TOOLCHAIN_PATH /Applications/STMicroelectronics/STM32CubeIDE.app/Contents/Eclipse/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.macos64_1.0.0.202111181127/tools/bin)
  6.  
  7. set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/extern/stm32-cmake/cmake/stm32_gcc.cmake)
  8.  
  9. set( STM32_CUBE_L4_PATH ${CMAKE_CURRENT_SOURCE_DIR}/extern/STM32CubeL4)
  10.  
  11. project(TESTCMAKE20221004 C CXX ASM)
  12.  
  13. set(CMSIS_COMP_LIST
  14.   STM32L431RC
  15.   STM32L4_M4
  16.   RTOS_V2
  17. )
  18.  
  19. set(HAL_COMP_LIST
  20.   STM32L4
  21.   CORTEX
  22.   DMA
  23.   EXTI
  24.   FLASH
  25.   GPIO
  26.   I2C
  27.   IWDG
  28.   PWR
  29.   RCC
  30.   TIM
  31.   UART
  32. )
  33.  
  34. set(FREERTOS_COMP_LIST
  35.   ARM_CM4F
  36.   STM32L4
  37. )
  38.  
  39. find_package(CMSIS COMPONENTS "${CMSIS_COMP_LIST}" REQUIRED)
  40. find_package(HAL COMPONENTS "${HAL_COMP_LIST}" REQUIRED)
  41. find_package(FreeRTOS COMPONENTS "${FREERTOS_COMP_LIST}" REQUIRED)
  42.  
  43. set(PROJECT_SOURCES
  44.   Core/Src/dma.c
  45.   Core/Src/freertos.c
  46.   Core/Src/gpio.c
  47.   Core/Src/iwdg.c
  48.   Core/Src/main.c
  49.   Core/Src/stm32l4xx_hal_msp.c
  50.   Core/Src/stm32l4xx_hal_timebase_tim.c
  51.   Core/Src/stm32l4xx_it.c
  52.   Core/Src/syscalls.c
  53.   Core/Src/sysmem.c
  54.   #Core/Src/system_stm32l4xx.c
  55.   Core/Src/usart.c
  56. )
  57.  
  58. add_executable(TESTCMAKE20221004 ${PROJECT_SOURCES})
  59.  
  60. target_include_directories(TESTCMAKE20221004 PRIVATE Core/Inc)
  61.  
  62. target_link_libraries(TESTCMAKE20221004
  63.   CMSIS::STM32::L431RC
  64.   HAL::STM32::L4::CORTEX
  65.   HAL::STM32::L4::DMA
  66.   HAL::STM32::L4::EXTI
  67.   HAL::STM32::L4::FLASH
  68.   HAL::STM32::L4::GPIO
  69.   HAL::STM32::L4::I2C
  70.   HAL::STM32::L4::IWDG
  71.   HAL::STM32::L4::PWR
  72.   HAL::STM32::L4::PWREx
  73.   HAL::STM32::L4::RCC
  74.   HAL::STM32::L4::RCCEx
  75.   HAL::STM32::L4::TIM
  76.   HAL::STM32::L4::TIMEx
  77.   HAL::STM32::L4::UART
  78.   HAL::STM32::L4::UARTEx
  79.   STM32::NoSys
  80.   FreeRTOS::STM32::L4::Timers
  81.   FreeRTOS::STM32::L4::Heap::4
  82.   FreeRTOS::STM32::L4::ARM_CM4F
  83.   CMSIS::STM32::L4::RTOS_V2
  84. )
  85.  
  86. stm32_print_size_of_target(TESTCMAKE20221004)
  87.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement