This repository has been archived on 2021-11-24. You can view files and clone it, but cannot push or open issues or pull requests.
fsfw_example_public/cmake/STM32FreeRTOSConfig.cmake

67 lines
1.9 KiB
CMake
Raw Normal View History

2021-04-27 17:22:34 +02:00
if(NOT DEFINED ENV{CROSS_COMPILE})
set(CROSS_COMPILE "arm-none-eabi")
message(STATUS
"No CROSS_COMPILE environmental variable set, using default ARM "
"cross compiler name ${CROSS_COMPILE}"
)
else()
set(CROSS_COMPILE "$ENV{CROSS_COMPILE}")
message(STATUS
"Using environmental variable CROSS_COMPILE as cross-compiler: "
"$ENV{CROSS_COMPILE}"
)
endif()
set(TGT_ARCH "arm" CACHE STRING "Target architecture")
set(TGT_MACH "stm32h743zi-nucleo" CACHE STRING "Target machine")
set(TGT_BSP "${TGT_ARCH}/${TGT_MACH}" CACHE STRING "Target BSP")
set(CROSS_COMPILE_CC "${CROSS_COMPILE}-gcc")
set(CROSS_COMPILE_CXX "${CROSS_COMPILE}-g++")
set(CROSS_COMPILE_SIZE "${CROSS_COMPILE}-size")
# At the very least, cross compile gcc and g++ have to be set!
find_program (CROSS_COMPILE_CC_FOUND ${CROSS_COMPILE_CC} REQUIRED)
find_program (CROSS_COMPILE_CXX_FOUND ${CROSS_COMPILE_CXX} REQUIRED)
# Size utility optional.
find_program (CMAKE_SIZE ${CROSS_COMPILE_SIZE})
set(CMAKE_CROSSCOMPILING TRUE)
# Define name of the target system
set(CMAKE_SYSTEM_NAME "Generic")
set(CMAKE_SYSTEM_PROCESSOR "arm")
# Define the compiler
set(CMAKE_C_COMPILER ${CROSS_COMPILE_CC})
set(CMAKE_CXX_COMPILER ${CROSS_COMPILE_CXX})
set(CMAKE_ASM_FLAGS "-x assembler-with-cpp")
set(ABI_FLAGS
-mcpu=cortex-m7
-mfpu=fpv5-d16
-mfloat-abi=hard
-mthumb
--specs=nosys.specs
--specs=nano.specs
)
string (REPLACE ";" " " ABI_FLAGS "${ABI_FLAGS}")
set(CMAKE_C_FLAGS
${ABI_FLAGS}
CACHE STRING "C flags for the STM32H743ZI-Nucleo with FreeRTOS"
)
set(CMAKE_CXX_FLAGS
"${CMAKE_C_FLAGS}"
CACHE STRING "C++ flags for the STM32H743ZI-Nucleo with FreeRTOS"
)
# search for programs in the build host directories
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)