1 ###| CMAKE Kiibohd Controller |###
3 # Jacob Alexander 2011-2013
4 # Due to this file's usefulness:
6 # Released into the Public Domain
8 # Freescale ARM CMake Build Configuration
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 )
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" )
29 # ARM Defines and Linker Options
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
36 #| "mk20dx128" # Teensy 3.0
37 set( CHIP "mk20dx128" )
39 message( STATUS "Chip Selected:" )
44 #| You _MUST_ set this to match the board you are using
45 #| type "make clean" after changing this, so all files will be rebuilt
47 #| "cortex-m4" # Teensy 3.0
48 set( CPU "cortex-m4" )
50 message( STATUS "CPU Selected:" )
54 #| Extra Compiler Sources
55 #| Mostly for convenience functions like interrupt handlers
61 #| Compiler flag to set the C Standard level.
63 #| gnu89 = c89 plus GCC extensions
64 #| c99 = ISO C99 standard (not yet fully implemented)
65 #| gnu99 = c99 plus GCC extensions
66 set( CSTANDARD "-std=gnu99" )
70 #| -Wall...: warning level
71 set( WARN "-Wall -g" )
75 #| -f...: tuning, see GCC manual
76 set( TUNING "-mthumb -nostdlib" )
79 #| Optimization level, can be [0, 1, 2, 3, s].
80 #| 0 = turn off optimization. s = optimize for size.
81 #| (Note: 3 is not always the best optimization level.)
90 #| Processor frequency.
91 #| Normally the first thing your program should do is set the clock prescaler,
92 #| so your program will run at the correct speed. You should also set this
93 #| variable to same clock speed. The _delay_ms() macro uses this, and many
94 #| examples use this variable to calculate timings. Do not add a "UL" here.
95 set( F_CPU "48000000" )
99 #| Compiler flags to generate dependency files.
100 set( GENDEPFLAGS "-MMD" )
104 add_definitions( "-mcpu=${CPU} -DF_CPU=${F_CPU} -D_${CHIP}_=1 -O${OPT} ${TUNING} ${WARN} ${CSTANDARD} ${GENDEPFLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}" )
108 set( LINKER_FLAGS "-mcpu=${CPU} -Wl,-Map=${TARGET}.map,--cref -Wl,--gc-sections -mthumb -T${CMAKE_CURRENT_SOURCE_DIR}/Lib/${CHIP}.ld" )
111 #| Hex Flags (XXX, CMake seems to have issues if you quote the arguments for the custom commands...)
112 set( HEX_FLAGS -O ${FORMAT} -R .eeprom )
116 set( LSS_FLAGS -h -S -z )