1# Toolchain settings
2set(CMAKE_C_COMPILER    arm-none-eabi-gcc)
3set(CMAKE_CXX_COMPILER  arm-none-eabi-g++)
4set(AS                  arm-none-eabi-as)
5set(AR                  arm-none-eabi-ar)
6set(OBJCOPY             arm-none-eabi-objcopy)
7set(OBJDUMP             arm-none-eabi-objdump)
8set(SIZE                arm-none-eabi-size)
9
10set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
11set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
12set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
13set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
14
15# this makes the test compiles use static library option so that we don't need to pre-set linker flags and scripts
16set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
17
18set(CMAKE_C_FLAGS   "${MCPU_FLAGS} ${VFP_FLAGS} ${SPEC_FLAGS} -fdata-sections -ffunction-sections -mlong-calls" CACHE INTERNAL "c compiler flags")
19set(CMAKE_CXX_FLAGS "${MCPU_FLAGS} ${VFP_FLAGS} -fdata-sections -ffunction-sections -fno-rtti -fno-exceptions -mlong-calls" CACHE INTERNAL "cxx compiler flags")
20set(CMAKE_ASM_FLAGS "${MCPU_FLAGS} ${VFP_FLAGS} -x assembler-with-cpp" CACHE INTERNAL "asm compiler flags")
21set(CMAKE_EXE_LINKER_FLAGS "${MCPU_FLAGS} ${LD_FLAGS} -Wl,--gc-sections" CACHE INTERNAL "exe link flags")
22
23SET(CMAKE_C_FLAGS_DEBUG "-Og -g -ggdb3" CACHE INTERNAL "c debug compiler flags")
24SET(CMAKE_CXX_FLAGS_DEBUG "-Og -g -ggdb3" CACHE INTERNAL "cxx debug compiler flags")
25SET(CMAKE_ASM_FLAGS_DEBUG "-g -ggdb3" CACHE INTERNAL "asm debug compiler flags")
26
27SET(CMAKE_C_FLAGS_RELEASE "-O3" CACHE INTERNAL "c release compiler flags")
28SET(CMAKE_CXX_FLAGS_RELEASE "-O3" CACHE INTERNAL "cxx release compiler flags")
29SET(CMAKE_ASM_FLAGS_RELEASE "" CACHE INTERNAL "asm release compiler flags")