]> git.donarmstrong.com Git - kiibohd-controller.git/blob - arm.cmake
Updating CMake build system to prepare for Teensy 3 integration.
[kiibohd-controller.git] / arm.cmake
1 ###| CMAKE Kiibohd Controller |###
2 #
3 # Jacob Alexander 2011-2013
4 # Due to this file's usefulness:
5 #
6 # Released into the Public Domain
7 #
8 # Freescale ARM CMake Build Configuration
9 #
10 ###
11
12
13
14 #| Set the Compilers (must be set first)
15 include( CMakeForceCompiler )
16 cmake_force_c_compiler  ( arm-none-eabi-gcc AVRCCompiler )
17 cmake_force_cxx_compiler( arm-none-eabi-g++ AVRCxxCompiler )
18
19
20 #| Compiler Binaries
21 set( OBJCOPY "arm-none-eabi-objcopy" )
22 set( OBJDUMP "arm-none-eabi-objdump" )
23 set( NM      "arm-none-eabi-nm"      )
24 set( SIZE    "arm-none-eabi-size"    )
25
26
27
28 ###
29 # ARM Defines and Linker Options
30 #
31
32 #| Chip Name (Linker)
33 #| You _MUST_ set this to match the board you are using
34 #| type "make clean" after changing this, so all files will be rebuilt
35 #|
36 #| "mk20dx128"        # Teensy   3.0
37 set( CHIP "mk20dx128" )
38
39
40 #| CPU Type
41 #| You _MUST_ set this to match the board you are using
42 #| type "make clean" after changing this, so all files will be rebuilt
43 #|
44 #| "cortex-m4"        # Teensy   3.0
45 set( CPU "cortex-m4" )
46
47
48 #| Extra Compiler Sources
49 #| Mostly for convenience functions like interrupt handlers
50 set( COMPILER_SRCS
51         Lib/${CHIP}.c
52 )
53
54
55 #| Compiler flag to set the C Standard level.
56 #|     c89   = "ANSI" C
57 #|     gnu89 = c89 plus GCC extensions
58 #|     c99   = ISO C99 standard (not yet fully implemented)
59 #|     gnu99 = c99 plus GCC extensions
60 set( CSTANDARD "-std=gnu99" )
61
62
63 #| Warning Options
64 #|  -Wall...:     warning level
65 set( WARN "-Wall -g" )
66
67
68 #| Tuning Options
69 #|  -f...:        tuning, see GCC manual
70 set( TUNING "-mthumb -nostdlib" )
71
72
73 #| Optimization level, can be [0, 1, 2, 3, s]. 
74 #|     0 = turn off optimization. s = optimize for size.
75 #|     (Note: 3 is not always the best optimization level.)
76 set( OPT "s" )
77
78
79 #| Output Format
80 #| srec, ihex, binary
81 set( FORMAT "ihex" )
82
83
84 #| Processor frequency.
85 #|   Normally the first thing your program should do is set the clock prescaler,
86 #|   so your program will run at the correct speed.  You should also set this
87 #|   variable to same clock speed.  The _delay_ms() macro uses this, and many
88 #|   examples use this variable to calculate timings.  Do not add a "UL" here.
89 set( F_CPU "48000000" )
90
91
92 #| Dependency Files
93 #| Compiler flags to generate dependency files.
94 set( GENDEPFLAGS "-MMD" )
95
96
97 #| Compiler Flags
98 add_definitions( "-mcpu=${CPU} -DF_CPU=${F_CPU} -O${OPT} ${TUNING} ${WARN} ${CSTANDARD} ${GENDEPFLAGS}" )
99
100
101 #| Linker Flags
102 set( LINKER_FLAGS "-mcpu=${CPU} -Wl,-Map=${TARGET}.map,--cref -Wl,--gc-sections -mthumb -T${CMAKE_CURRENT_SOURCE_DIR}/Lib/${CHIP}.ld" )
103
104
105 #| Hex Flags (XXX, CMake seems to have issues if you quote the arguments for the custom commands...)
106 set( HEX_FLAGS -O ${FORMAT} -R .eeprom )
107
108
109 #| Lss Flags
110 set( LSS_FLAGS -h -S -z )
111