]> git.donarmstrong.com Git - kiibohd-controller.git/blobdiff - arm.cmake
Fixing loading script for ARM targets and the teensy loader cli
[kiibohd-controller.git] / arm.cmake
index 1b6a8ce89db27cc8ecfac6b581b7b80eaa812374..7fe1e05d99bf167c24a73cc37956fb0bd6bcd9ae 100644 (file)
--- a/arm.cmake
+++ b/arm.cmake
@@ -36,6 +36,10 @@ set( SIZE    "arm-none-eabi-size"    )
 #| "mk20dx128"        # Teensy   3.0
 set( CHIP "mk20dx128" )
 
+message( STATUS "Chip Selected:" )
+message( "${CHIP}" )
+set( MCU "${CHIP}" ) # For loading script compatibility
+
 
 #| CPU Type
 #| You _MUST_ set this to match the board you are using
@@ -44,13 +48,25 @@ set( CHIP "mk20dx128" )
 #| "cortex-m4"        # Teensy   3.0
 set( CPU "cortex-m4" )
 
+message( STATUS "CPU Selected:" )
+message( "${CPU}" )
+
 
 #| Extra Compiler Sources
 #| Mostly for convenience functions like interrupt handlers
 set( COMPILER_SRCS
        Lib/${CHIP}.c
+       Lib/delay.c
 )
 
+message( STATUS "Compiler Source Files:" )
+message( "${COMPILER_SRCS}" )
+
+
+#| USB Defines
+set( VENDOR_ID  "0x16C0" )
+set( PRODUCT_ID "0x0487" )
+
 
 #| Compiler flag to set the C Standard level.
 #|     c89   = "ANSI" C
@@ -67,7 +83,8 @@ set( WARN "-Wall -g" )
 
 #| Tuning Options
 #|  -f...:        tuning, see GCC manual
-set( TUNING "-mthumb -nostdlib" )
+#| NOTE: -fshort-wchar is specified to allow USB strings be passed conveniently
+set( TUNING "-mthumb -nostdlib -fdata-sections -ffunction-sections -fshort-wchar" )
 
 
 #| Optimization level, can be [0, 1, 2, 3, s]. 
@@ -95,11 +112,11 @@ set( GENDEPFLAGS "-MMD" )
 
 
 #| Compiler Flags
-add_definitions( "-mcpu=${CPU} -DF_CPU=${F_CPU} -O${OPT} ${TUNING} ${WARN} ${CSTANDARD} ${GENDEPFLAGS}" )
+add_definitions( "-mcpu=${CPU} -DF_CPU=${F_CPU} -D_${CHIP}_=1 -O${OPT} ${TUNING} ${WARN} ${CSTANDARD} ${GENDEPFLAGS}" )
 
 
 #| Linker Flags
-set( LINKER_FLAGS "-mcpu=${CPU} -Wl,-Map=${TARGET}.map,--cref -Wl,--gc-sections -mthumb -T${CMAKE_CURRENT_SOURCE_DIR}/Lib/${CHIP}.ld" )
+set( LINKER_FLAGS "-mcpu=${CPU} -Wl,-Map=${TARGET}.map,--cref -Wl,--gc-sections -mthumb -Wl,--no-wchar-size-warning -T${CMAKE_CURRENT_SOURCE_DIR}/Lib/${CHIP}.ld" )
 
 
 #| Hex Flags (XXX, CMake seems to have issues if you quote the arguments for the custom commands...)