daily pastebin goal
5%
SHARE
TWEET

Untitled

a guest Mar 17th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. project(Stm32F767xxTemplate)
  2.  
  3. cmake_minimum_required(VERSION 3.2)
  4.  
  5. INCLUDE(CMakeForceCompiler)
  6.  
  7. ENABLE_LANGUAGE(C)
  8. ENABLE_LANGUAGE(CXX)
  9. ENABLE_LANGUAGE(ASM)
  10.  
  11. # Cross compile variables
  12. SET(CMAKE_SYSTEM_NAME Generic)
  13. set(CMAKE_SYSTEM_PROCESSOR arm)
  14. SET(CMAKE_SYSTEM_VERSION 1)
  15. SET(CMAKE_CROSSCOMPILING 1)
  16.  
  17. # https://stackoverflow.com/questions/10599038/can-i-skip-cmake-compiler-tests-or-avoid-error-unrecognized-option-rdynamic
  18. set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
  19. set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
  20.  
  21. # Configure compilers
  22. set(CMAKE_C_COMPILER arm-none-eabi-gcc)
  23. set(CMAKE_CXX_COMPILER arm-none-eabi-g++)
  24. set(CMAKE_ASM_COMPILER arm-none-eabi-as)
  25. set(CMAKE_C_AR arm-none-eabi-ar)
  26.  
  27. # Configure tools
  28. set(CMAKE_OBJCOPY arm-none-eabi-objcopy)
  29. set(CMAKE_OBJDUMP arm-none-eabi-objdump)
  30. set(CMAKE_SIZE arm-none-eabi-size)
  31.  
  32. # Configure output
  33. set (EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
  34.  
  35. # Add definitions
  36. add_definitions(-DARM_MATH_CM7 -DSTM32F767ZI -DUSE_FREERTOS -DUSE_HAL_DRIVER -DSTM32F767xx)
  37.  
  38. SET(LINKER_SCRIPT "${PROJECT_SOURCE_DIR}/Platform/STM32F767ZI_FLASH.ld")
  39. 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")
  40. 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")
  41.  
  42. # Collect sources
  43. file(GLOB_RECURSE PROJECT_SOURCES "Src/*.c")
  44. file(GLOB_RECURSE STM32HAL_SOURCES "HalF7/Src/*.c")
  45. file(GLOB_RECURSE SYSTEM_SOURCES "Platform/*.c")
  46. file(GLOB_RECURSE RTOS_SOURCES "FreeRTOS/*.c")
  47.  
  48. # LwIP sources
  49. file(GLOB_RECURSE LWIP_SOURCES "LwIP/src/api/*.c" "LwIP/src/core/*.c" "LwIP/src/core/ipv4/*.c")
  50. #include("${PROJECT_SOURCE_DIR}/LwIP/src/Filelists.cmake")
  51.  
  52. # Include dirs
  53. include_directories(
  54.   Cmsis/
  55.     HalF7/Inc/
  56.     Platform/
  57.     Src/
  58.   FreeRTOS/include
  59.   LwIP/src/include/lwip/
  60.  
  61. )
  62.  
  63. add_executable(${CMAKE_PROJECT_NAME}.elf ${PROJECT_SOURCES} ${CMSIS_SOURCES} ${STM32HAL_SOURCES} ${RTOS_SOURCES} ${SYSTEM_SOURCES} ${LWIP_SOURCES})
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top