blob: 75535c475cefd9407af917cd75fae464dc7bb76d [file] [log] [blame]
Christophe Favergeon6b604eb2019-05-17 13:46:33 +02001# Setting Linux is forcing th extension to be .o instead of .obj when building on WIndows.
2# It is important because armlink is failing when files have .obj extensions (error with
3# scatter file section not found)
4SET(CMAKE_SYSTEM_NAME Linux)
5SET(CMAKE_SYSTEM_PROCESSOR arm)
6
7
8
Christophe Favergeon3b2a0ee2019-06-12 13:29:14 +02009#SET(tools "C:/PROGRA~1/ARM/DEVELO~1.0/sw/ARMCOM~1.12")
Christophe Favergeon6b604eb2019-05-17 13:46:33 +020010
Christophe Favergeon3b2a0ee2019-06-12 13:29:14 +020011find_program(CMAKE_C_COMPILER NAMES armclang armclang.exe)
12find_program(CMAKE_CXX_COMPILER NAMES armclang armclang.exe)
13find_program(CMAKE_ASM_COMPILER NAMES armclang armclang.exe)
Christophe Favergeon6b604eb2019-05-17 13:46:33 +020014
Christophe Favergeon3b2a0ee2019-06-12 13:29:14 +020015#SET(CMAKE_C_COMPILER "${tools}/bin/armclang.exe")
16#SET(CMAKE_CXX_COMPILER "${tools}/bin/armclang.exe")
17#SET(CMAKE_ASM_COMPILER "${tools}/bin/armclang.exe")
18
19find_program(CMAKE_AR NAMES armar armar.exe)
20
21#SET(CMAKE_AR "${tools}/bin/armar.exe")
22find_program(CMAKE_CXX_COMPILER_AR NAMES armar armar.exe)
23find_program(CMAKE_C_COMPILER_AR NAMES armar armar.exe)
24
25find_program(CMAKE_LINKER NAMES armlink armlink.exe)
26#SET(CMAKE_LINKER "${tools}/bin/armlink.exe")
27
Christophe Favergeon6b604eb2019-05-17 13:46:33 +020028SET(CMAKE_C_LINK_EXECUTABLE "<CMAKE_LINKER> <LINK_FLAGS> -o <TARGET> <LINK_LIBRARIES> <OBJECTS>")
Christophe Favergeon3b2a0ee2019-06-12 13:29:14 +020029SET(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_LINKER> <LINK_FLAGS> -o <TARGET> <LINK_LIBRARIES> <OBJECTS>")
30
31SET(CMAKE_C_RESPONSE_FILE_LINK_FLAG "--via ")
Christophe Favergeon6b604eb2019-05-17 13:46:33 +020032SET(CMAKE_C_OUTPUT_EXTENSION .o)
33SET(CMAKE_CXX_OUTPUT_EXTENSION .o)
34SET(CMAKE_ASM_OUTPUT_EXTENSION .o)
35# When library defined as STATIC, this line is needed to describe how the .a file must be
36# create. Some changes to the line may be needed.
Christophe Favergeon3b2a0ee2019-06-12 13:29:14 +020037SET(CMAKE_C_CREATE_STATIC_LIBRARY "<CMAKE_AR> -r -s --create <TARGET> <LINK_FLAGS> <OBJECTS>" )
38SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "<CMAKE_AR> -r -s --create <TARGET> <LINK_FLAGS> <OBJECTS>" )
39
40#SET(CMAKE_ASM_CREATE_STATIC_LIBRARY "${tools}/bin/armar.exe -r -s --create <TARGET> <LINK_FLAGS> <OBJECTS>" )
41
42
Christophe Favergeon6b604eb2019-05-17 13:46:33 +020043set(ARMAC6 ON)
44# default core
45
46if(NOT ARM_CPU)
47 set(
48 ARM_CPU "cortex-a5"
49 CACHE STRING "Set ARM CPU. Default : cortex-a5"
50 )
51endif(NOT ARM_CPU)
52
Christophe Favergeonc67252c2020-06-18 11:11:51 +020053if (AARCH64)
54SET(CMAKE_C_FLAGS "-mcpu=${ARM_CPU} --target=aarch64-arm-none-eabi" CACHE INTERNAL "C compiler common flags")
55SET(CMAKE_CXX_FLAGS "-mcpu=${ARM_CPU} --target=aarch64-arm-none-eabi" CACHE INTERNAL "C compiler common flags")
56SET(CMAKE_ASM_FLAGS "-g -x assembler-with-cpp -masm=auto -mcpu=${ARM_CPU} --target=aarch64-arm-none-eabi" CACHE INTERNAL "ASM compiler common flags")
57else()
Christophe Favergeon6b604eb2019-05-17 13:46:33 +020058SET(CMAKE_C_FLAGS "-mcpu=${ARM_CPU} --target=arm-arm-none-eabi" CACHE INTERNAL "C compiler common flags")
59SET(CMAKE_CXX_FLAGS "-mcpu=${ARM_CPU} --target=arm-arm-none-eabi" CACHE INTERNAL "C compiler common flags")
60SET(CMAKE_ASM_FLAGS "-g -x assembler-with-cpp -masm=auto -mcpu=${ARM_CPU} --target=arm-arm-none-eabi" CACHE INTERNAL "ASM compiler common flags")
Christophe Favergeonc67252c2020-06-18 11:11:51 +020061endif()
Christophe Favergeon3b2a0ee2019-06-12 13:29:14 +020062#SET(CMAKE_ASM_FLAGS "--cpu=${ARM_CPU}" CACHE INTERNAL "ASM compiler common flags")
Christophe Favergeon6b604eb2019-05-17 13:46:33 +020063#SET(CMAKE_EXE_LINKER_FLAGS "-flto" CACHE INTERNAL "linker flags")
64
65# Where is the target environment
Christophe Favergeon3b2a0ee2019-06-12 13:29:14 +020066#SET(CMAKE_FIND_ROOT_PATH "${tools}")
Christophe Favergeon6b604eb2019-05-17 13:46:33 +020067# Search for programs in the build host directories
68SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
69# For libraries and headers in the target directories
70SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
71SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
72
Christophe Favergeon3b2a0ee2019-06-12 13:29:14 +020073#include(CMakePrintHelpers)
74#cmake_print_variables(${ASM_DIALECT})