]> git.donarmstrong.com Git - kiibohd-controller.git/blobdiff - Lib/CMake/arm.cmake
Fixing clang compilation and supporting clang-tidy
[kiibohd-controller.git] / Lib / CMake / arm.cmake
index 3efbe7c0169955ae1ec45bd9b08881e300def093..31fe0cd9ea7b05e105d80149ac4e362f97874f53 100644 (file)
@@ -1,6 +1,6 @@
 ###| CMAKE Kiibohd Controller |###
 #
-# Jacob Alexander 2011-2014
+# Jacob Alexander 2011-2016
 # Due to this file's usefulness:
 #
 # Released into the Public Domain
@@ -46,26 +46,35 @@ message( "${CHIP}" )
 set( MCU "${CHIP}" ) # For loading script compatibility
 
 
-#| Chip Size Database
+#| Chip Size and CPU Frequency Database
+#| Processor frequency.
+#|   Normally the first thing your program should do is set the clock prescaler,
+#|   so your program will run at the correct speed.  You should also set this
+#|   variable to same clock speed.  The _delay_ms() macro uses this, and many
+#|   examples use this variable to calculate timings.  Do not add a "UL" here.
 #| MCHCK Based / Kiibohd-dfu
 if ( "${CHIP}" MATCHES "mk20dx128vlf5" )
        set( SIZE_RAM    16384 )
        set( SIZE_FLASH 126976 )
+       set( F_CPU "48000000" )
 
 #| Kiibohd-dfu
 elseif ( "${CHIP}" MATCHES "mk20dx256vlh7" )
        set( SIZE_RAM    65536 )
        set( SIZE_FLASH 253952 )
+       set( F_CPU "72000000" )
 
 #| Teensy 3.0
 elseif ( "${CHIP}" MATCHES "mk20dx128" )
        set( SIZE_RAM    16384 )
        set( SIZE_FLASH 131072 )
+       set( F_CPU "48000000" )
 
 #| Teensy 3.1
 elseif ( "${CHIP}" MATCHES "mk20dx256" )
        set( SIZE_RAM    65536 )
        set( SIZE_FLASH 262144 )
+       set( F_CPU "48000000" ) # XXX Also supports 72 MHz, but may requires code changes
 
 #| Unknown ARM
 else ()
@@ -102,6 +111,13 @@ set( COMPILER_SRCS
        Lib/delay.c
 )
 
+#| Clang needs a few more functions for linking
+if ( "${COMPILER}" MATCHES "clang" )
+       set( COMPILER_SRCS ${COMPILER_SRCS}
+               Lib/clang.c
+       )
+endif ()
+
 message( STATUS "Compiler Source Files:" )
 message( "${COMPILER_SRCS}" )
 
@@ -159,14 +175,6 @@ endif()
 set( OPT "s" )
 
 
-#| Processor frequency.
-#|   Normally the first thing your program should do is set the clock prescaler,
-#|   so your program will run at the correct speed.  You should also set this
-#|   variable to same clock speed.  The _delay_ms() macro uses this, and many
-#|   examples use this variable to calculate timings.  Do not add a "UL" here.
-set( F_CPU "48000000" )
-
-
 #| Dependency Files
 #| Compiler flags to generate dependency files.
 set( GENDEPFLAGS "-MMD" )