Christophe Favergeon | 6b604eb | 2019-05-17 13:46:33 +0200 | [diff] [blame^] | 1 | # 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) |
| 4 | SET(CMAKE_SYSTEM_NAME Linux) |
| 5 | SET(CMAKE_SYSTEM_PROCESSOR arm) |
| 6 | |
| 7 | |
| 8 | |
| 9 | SET(tools "C:/PROGRA~1/ARM/DEVELO~1.0/sw/ARMCOM~1.12") |
| 10 | |
| 11 | SET(CMAKE_C_COMPILER "${tools}/bin/armclang.exe") |
| 12 | SET(CMAKE_CXX_COMPILER "${tools}/bin/armclang.exe") |
| 13 | |
| 14 | SET(CMAKE_AR "${tools}/bin/armar.exe") |
| 15 | SET(CMAKE_CXX_COMPILER_AR "${tools}/bin/armar.exe") |
| 16 | SET(CMAKE_C_COMPILER_AR "${tools}/bin/armar.exe") |
| 17 | SET(CMAKE_LINKER "${tools}/bin/armlink.exe") |
| 18 | SET(CMAKE_C_LINK_EXECUTABLE "<CMAKE_LINKER> <LINK_FLAGS> -o <TARGET> <LINK_LIBRARIES> <OBJECTS>") |
| 19 | set(CMAKE_C_RESPONSE_FILE_LINK_FLAG "--via ") |
| 20 | SET(CMAKE_C_OUTPUT_EXTENSION .o) |
| 21 | SET(CMAKE_CXX_OUTPUT_EXTENSION .o) |
| 22 | SET(CMAKE_ASM_OUTPUT_EXTENSION .o) |
| 23 | # When library defined as STATIC, this line is needed to describe how the .a file must be |
| 24 | # create. Some changes to the line may be needed. |
| 25 | SET(CMAKE_C_CREATE_STATIC_LIBRARY "${tools}/bin/armar.exe -r -s --create <TARGET> <LINK_FLAGS> <OBJECTS>" ) |
| 26 | set(ARMAC6 ON) |
| 27 | # default core |
| 28 | |
| 29 | if(NOT ARM_CPU) |
| 30 | set( |
| 31 | ARM_CPU "cortex-a5" |
| 32 | CACHE STRING "Set ARM CPU. Default : cortex-a5" |
| 33 | ) |
| 34 | endif(NOT ARM_CPU) |
| 35 | |
| 36 | SET(CMAKE_C_FLAGS "-mcpu=${ARM_CPU} --target=arm-arm-none-eabi" CACHE INTERNAL "C compiler common flags") |
| 37 | SET(CMAKE_CXX_FLAGS "-mcpu=${ARM_CPU} --target=arm-arm-none-eabi" CACHE INTERNAL "C compiler common flags") |
| 38 | SET(CMAKE_ASM_FLAGS "-g -x assembler-with-cpp -masm=auto -mcpu=${ARM_CPU} --target=arm-arm-none-eabi" CACHE INTERNAL "ASM compiler common flags") |
| 39 | #SET(CMAKE_EXE_LINKER_FLAGS "-flto" CACHE INTERNAL "linker flags") |
| 40 | |
| 41 | # Where is the target environment |
| 42 | SET(CMAKE_FIND_ROOT_PATH "${tools}") |
| 43 | # Search for programs in the build host directories |
| 44 | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) |
| 45 | # For libraries and headers in the target directories |
| 46 | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) |
| 47 | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) |
| 48 | |