-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathapollo-toolchain.cmake
44 lines (37 loc) · 1.16 KB
/
apollo-toolchain.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# CMake toolchain for the Apollo 3 microcontroller
#
# Author: TU Delft Sustainable Systems Laboratory
# License: MIT License
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(DEVICE "apollo3" CACHE STRING "")
set(CPU "cortex-m4" CACHE STRING "")
set(OUTPUT_SUFFIX ".elf" CACHE STRING "")
set(LINKER_SCRIPT "${PROJECT_SOURCE_DIR}/config/${DEVICE}.ld")
string(TOUPPER ${DEVICE} DEVICE_DEFINE)
set(DEVICE_DEFINE "PART_${DEVICE_DEFINE}")
set(CMAKE_C_COMPILER "arm-none-eabi-gcc")
set(CMAKE_CXX_COMPILER "arm-none-eabi-g++")
set(CMAKE_AR "arm-none-eabi-ar")
set(CMAKE_LINKER "arm-none-eabi-ld")
set(CMAKE_NM "arm-none-eabi-nm")
set(CMAKE_OBJDUMP "arm-none-eabi-objdump")
set(CMAKE_STRIP "arm-none-eabi-strip")
set(CMAKE_RANLIB "arm-none-eabi-ranlib")
set(CMAKE_SIZE "arm-none-eabi-size")
# General compiler flags
add_compile_options(
-mthumb
-mcpu=${CPU}
-D${DEVICE_DEFINE}
-DAM_${DEVICE_DEFINE}
-DAM_PACKAGE_BGA
-Dgcc
)
# Device linker flags
add_link_options(
-mthumb
-mcpu=${CPU}
-specs=nano.specs -specs=nosys.specs
-L${PROJECT_SOURCE_DIR}/config
)