Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- project(Stm32F767xxTemplate)
- cmake_minimum_required(VERSION 3.2)
- INCLUDE(CMakeForceCompiler)
- ENABLE_LANGUAGE(C)
- ENABLE_LANGUAGE(CXX)
- ENABLE_LANGUAGE(ASM)
- # Cross compile variables
- SET(CMAKE_SYSTEM_NAME Generic)
- set(CMAKE_SYSTEM_PROCESSOR arm)
- SET(CMAKE_SYSTEM_VERSION 1)
- SET(CMAKE_CROSSCOMPILING 1)
- # https://stackoverflow.com/questions/10599038/can-i-skip-cmake-compiler-tests-or-avoid-error-unrecognized-option-rdynamic
- set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
- set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
- # Configure compilers
- set(CMAKE_C_COMPILER arm-none-eabi-gcc)
- set(CMAKE_CXX_COMPILER arm-none-eabi-g++)
- set(CMAKE_ASM_COMPILER arm-none-eabi-as)
- set(CMAKE_C_AR arm-none-eabi-ar)
- # Configure tools
- set(CMAKE_OBJCOPY arm-none-eabi-objcopy)
- set(CMAKE_OBJDUMP arm-none-eabi-objdump)
- set(CMAKE_SIZE arm-none-eabi-size)
- # Configure output
- set (EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
- # Add definitions
- add_definitions(-DARM_MATH_CM7 -DSTM32F767ZI -DUSE_FREERTOS -DUSE_HAL_DRIVER -DSTM32F767xx)
- SET(LINKER_SCRIPT "${PROJECT_SOURCE_DIR}/Platform/STM32F767ZI_FLASH.ld")
- SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--gc-sections --specs=nosys.specs -mthumb -mcpu=cortex-m7 -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mabi=aapcs" CACHE INTERNAL "executable linker flags")
- SET(CMAKE_C_FLAGS "-mthumb -fno-builtin -mcpu=cortex-m7 -mfpu=fpv5-sp-d16 -mfloat-abi=hard -Wall -std=gnu99 -ffunction-sections -fdata-sections -fomit-frame-pointer -mabi=aapcs -fno-unroll-loops -ffast-math -ftree-vectorize -fno-lto" CACHE INTERNAL "c compiler flags")
- # Collect sources
- file(GLOB_RECURSE PROJECT_SOURCES "Src/*.c")
- file(GLOB_RECURSE STM32HAL_SOURCES "HalF7/Src/*.c")
- file(GLOB_RECURSE SYSTEM_SOURCES "Platform/*.c")
- file(GLOB_RECURSE RTOS_SOURCES "FreeRTOS/*.c")
- # LwIP sources
- file(GLOB_RECURSE LWIP_SOURCES "LwIP/src/api/*.c" "LwIP/src/core/*.c" "LwIP/src/core/ipv4/*.c")
- #include("${PROJECT_SOURCE_DIR}/LwIP/src/Filelists.cmake")
- # Include dirs
- include_directories(
- Cmsis/
- HalF7/Inc/
- Platform/
- Src/
- FreeRTOS/include
- LwIP/src/include/lwip/
- )
- add_executable(${CMAKE_PROJECT_NAME}.elf ${PROJECT_SOURCES} ${CMSIS_SOURCES} ${STM32HAL_SOURCES} ${RTOS_SOURCES} ${SYSTEM_SOURCES} ${LWIP_SOURCES})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement