]> git.donarmstrong.com Git - kiibohd-controller.git/blobdiff - Bootloader/CMakeLists.txt
Fixing bugs in mk20dx128vlf5 support
[kiibohd-controller.git] / Bootloader / CMakeLists.txt
index b8cb8a013195821a6887c986480c755d68544c11..41c2bccb1ffcc790cffc0125a1b01e0d8ffcf091 100644 (file)
 #| You _MUST_ clean the build directory if you change this value
 #|
 set( CHIP
-       "mk20dx128vlf5"    # McHCK    mk20dx128vlf5
+       #"mk20dx128vlf5"    # McHCK       mk20dx128vlf5
+       "mk20dx256vlh7"    # Kiibohd-dfu mk20dx256vlh7
 )
 
 
+
+###
+# Compiler Selection
+#
+
+#| *** EXPERIMENTAL ***
+#| Stick with gcc unless you know what you're doing
+#| Currently only arm is supported with clang
+set( COMPILER
+       "gcc"   # arm-none-eabi-gcc / avr-gcc - Default
+#       "clang" # arm-none-eabi
+       CACHE STRING "Compiler Type" )
+
+
+
 ###
 # Bootloader Configuration
 #
@@ -51,6 +67,14 @@ set( SRCS
        usb.c
 )
 
+# Only compile in if necessary
+if( CHIP STREQUAL "mk20dx256vlh7" )
+       set( SRCS ${SRCS}
+               debug.c
+       )
+endif()
+
+
 message( STATUS "Bootloader Source Files:" )
 message( "${SRCS}" )
 
@@ -112,6 +136,19 @@ endif()
 
 
 
+###
+# Disable -Wl,-search_paths_first for OSX (not supported by arm-none-eabi-gcc)
+#
+
+if ( APPLE )
+       string ( REPLACE "-Wl,-search_paths_first" "" CMAKE_C_LINK_FLAGS ${CMAKE_C_LINK_FLAGS} )
+       string ( REPLACE "-Wl,-search_paths_first" "" CMAKE_CXX_LINK_FLAGS ${CMAKE_CXX_LINK_FLAGS} )
+
+       message ( AUTHOR_WARNING "Bootloader binary may not fit on device (must be less than 4096 bytes). Macports arm-none-eabi-gcc 4.7.3 doesn't seem to work properly with -flto. However, even disabling it doesn't shrink the binary enough... 4.9.1 is known to work on Arch Linux." )
+endif ()
+
+
+
 ###
 # Build Targets
 #