Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cmake_minimum_required(VERSION 3.16)
- #set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/extern/stm32-cmake/cmake/stm32_gcc.cmake)
- #set(STM32_CUBE_L4_PATH ${CMAKE_CURRENT_SOURCE_DIR}/extern/STM32CubeL4)
- #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)
- if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
- message(FATAL_ERROR "Specify path of stm32_gcc.cmake in CMAKE_TOOLCHAIN_FILE")
- endif()
- if(NOT DEFINED STM32_CUBE_L4_PATH)
- message(FATAL_ERROR "Specify stm32 L4 cube path in STM32_CUBE_L4_PATH")
- endif()
- if(NOT DEFINED STM32_TOOLCHAIN_PATH)
- message(FATAL_ERROR "Specify path to arm-none-eabi-gcc directory in STM32_TOOLCHAIN_PATH")
- endif()
- project(TESTCMAKE20221004 C CXX ASM)
- message(STATUS "CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}")
- message(STATUS "CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}")
- message(STATUS "STM32_CUBE_L4_PATH=${STM32_CUBE_L4_PATH}")
- set(CMSIS_COMP_LIST
- STM32L431RC
- STM32L4_M4
- RTOS_V2
- )
- set(HAL_COMP_LIST
- STM32L4
- CORTEX
- DMA
- EXTI
- FLASH
- GPIO
- I2C
- IWDG
- PWR
- RCC
- TIM
- UART
- )
- set(FREERTOS_COMP_LIST
- ARM_CM4F
- STM32L4
- )
- find_package(CMSIS COMPONENTS "${CMSIS_COMP_LIST}" REQUIRED)
- find_package(HAL COMPONENTS "${HAL_COMP_LIST}" REQUIRED)
- find_package(FreeRTOS COMPONENTS ${FREERTOS_COMP_LIST} REQUIRED)
- set(PROJECT_SOURCES
- Core/Src/dma.c
- Core/Src/freertos.c
- Core/Src/gpio.c
- Core/Src/iwdg.c
- Core/Src/main.c
- Core/Src/stm32l4xx_hal_msp.c
- Core/Src/stm32l4xx_hal_timebase_tim.c
- Core/Src/stm32l4xx_it.c
- Core/Src/syscalls.c
- Core/Src/sysmem.c
- #Core/Src/system_stm32l4xx.c
- Core/Src/usart.c
- Core/Src/app/mainTask.c
- Core/Src/app/interface/ledLife_hal.c
- Core/Src/app/interface/watchdog_hal.c
- Core/Src/lib/misc/stm32_console.c
- )
- add_executable(TESTCMAKE20221004 ${PROJECT_SOURCES})
- target_link_libraries(TESTCMAKE20221004
- CMSIS::STM32::L431RC
- HAL::STM32::L4::CORTEX
- HAL::STM32::L4::DMA
- HAL::STM32::L4::EXTI
- HAL::STM32::L4::FLASH
- HAL::STM32::L4::GPIO
- HAL::STM32::L4::I2C
- HAL::STM32::L4::IWDG
- HAL::STM32::L4::PWR
- HAL::STM32::L4::PWREx
- HAL::STM32::L4::RCC
- HAL::STM32::L4::RCCEx
- HAL::STM32::L4::TIM
- HAL::STM32::L4::TIMEx
- HAL::STM32::L4::UART
- HAL::STM32::L4::UARTEx
- STM32::NoSys
- FreeRTOS::STM32::L4::Timers
- FreeRTOS::STM32::L4::Heap::4
- FreeRTOS::STM32::L4::ARM_CM4F
- CMSIS::STM32::L4::RTOS_V2
- )
- target_include_directories(TESTCMAKE20221004 PRIVATE
- Core/Inc
- Core/Src/lib
- Core/Src/lib/misc
- Core/Src/app/interface
- )
- stm32_print_size_of_target(TESTCMAKE20221004)
- if(HAL_FOUND)
- message(STATUS "using HAL Driver : add compile definition USE_HAL_DRIVER")
- # Needed by stm32_console see docs/analyse/stm32_console_deps.puml
- target_compile_definitions(TESTCMAKE20221004 PRIVATE USE_HAL_DRIVER)
- endif()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement