From: Jacob Alexander Date: Sun, 14 Sep 2014 23:22:27 +0000 (-0700) Subject: Adding convenience loader scripts for DFU based microcontrollers X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=3b06d8f6ae2ed8af492a26b8a356ce49c56cebd6;p=kiibohd-controller.git Adding convenience loader scripts for DFU based microcontrollers --- diff --git a/Lib/CMake/build.cmake b/Lib/CMake/build.cmake index 1d7b8af..a58bc1f 100644 --- a/Lib/CMake/build.cmake +++ b/Lib/CMake/build.cmake @@ -79,3 +79,25 @@ add_custom_target( SizeAfter ALL COMMENT "Chip usage for ${CHIP}" ) + + +### +# Setup Loader Script and Program +# + +#| First check for DFU based controllers +if( DEFINED DFU ) + configure_file( LoadFile/load.dfu load NEWLINE_STYLE UNIX ) + +#| Next check for Teensy based +elseif ( DEFINED TEENSY ) + # Provides the user with the correct teensy-loader-cli command for the built .HEX file + # Windows + if( CMAKE_SYSTEM_NAME MATCHES "Windows" ) + configure_file( LoadFile/winload.teensy load NEWLINE_STYLE UNIX ) + # Default + else() + configure_file( LoadFile/load.teensy load NEWLINE_STYLE UNIX ) + endif() +endif() + diff --git a/Lib/CMake/modules.cmake b/Lib/CMake/modules.cmake index a3351c1..fc8685b 100644 --- a/Lib/CMake/modules.cmake +++ b/Lib/CMake/modules.cmake @@ -264,19 +264,3 @@ if( CTAGS_EXECUTABLE ) ) endif() - - -### -# Setup Loader Script and Program -# - -#| Provides the user with the correct teensy-loader-cli command for the built .HEX file -#| Windows -if( CMAKE_SYSTEM_NAME MATCHES "Windows" ) - configure_file( LoadFile/winload load NEWLINE_STYLE UNIX ) -#| Default -else() - configure_file( LoadFile/load load NEWLINE_STYLE UNIX ) -endif() - - diff --git a/LoadFile/load b/LoadFile/load deleted file mode 100755 index 569e91c..0000000 --- a/LoadFile/load +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -#| First check to see teensy-loader-cli has been compiled -if [ ! -e teensy-loader-cli/teensy-loader-cli ]; then - # Compile teensy-loader-cli - mkdir -p teensy-loader-cli - cd teensy-loader-cli - cmake -G "Unix Makefiles" @CMAKE_SOURCE_DIR@/LoadFile - make - cd - -fi - -#| Loads the hex file onto the teensy -teensy-loader-cli/teensy-loader-cli -mmcu=@MCU@ -w @TARGET_HEX@ - -exit 0 - diff --git a/LoadFile/load.dfu b/LoadFile/load.dfu new file mode 100755 index 0000000..8eead30 --- /dev/null +++ b/LoadFile/load.dfu @@ -0,0 +1,8 @@ +#!/bin/bash + +# Load via dfu-util +# Used for McHCK based uCs +dfu-util -D @TARGET_BIN@ + +exit $? + diff --git a/LoadFile/load.teensy b/LoadFile/load.teensy new file mode 100755 index 0000000..f2e5592 --- /dev/null +++ b/LoadFile/load.teensy @@ -0,0 +1,17 @@ +#!/bin/bash + +#| First check to see teensy-loader-cli has been compiled +if [ ! -e teensy-loader-cli/teensy-loader-cli ]; then + # Compile teensy-loader-cli + mkdir -p teensy-loader-cli + cd teensy-loader-cli + cmake -G "Unix Makefiles" @CMAKE_SOURCE_DIR@/LoadFile + make + cd - +fi + +#| Loads the hex file onto the teensy +teensy-loader-cli/teensy-loader-cli -mmcu=@MCU@ -w @TARGET_HEX@ + +exit $? + diff --git a/LoadFile/winload b/LoadFile/winload deleted file mode 100755 index 17082c2..0000000 --- a/LoadFile/winload +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -#| First check to see teensy-loader-cli has been compiled -if [ ! -e teensy-loader-cli/teensy-loader-cli ]; then - # Compile teensy-loader-cli - mkdir -p teensy-loader-cli - cd teensy-loader-cli - cmake -G "Unix Makefiles" $(cygpath -u @CMAKE_SOURCE_DIR@/LoadFile) - make - cd - -fi - -#| Loads the hex file onto the teensy -teensy-loader-cli/teensy-loader-cli -mmcu=@MCU@ -w @TARGET_HEX@ - -exit 0 - diff --git a/LoadFile/winload.teensy b/LoadFile/winload.teensy new file mode 100755 index 0000000..f22d704 --- /dev/null +++ b/LoadFile/winload.teensy @@ -0,0 +1,17 @@ +#!/bin/bash + +#| First check to see teensy-loader-cli has been compiled +if [ ! -e teensy-loader-cli/teensy-loader-cli ]; then + # Compile teensy-loader-cli + mkdir -p teensy-loader-cli + cd teensy-loader-cli + cmake -G "Unix Makefiles" $(cygpath -u @CMAKE_SOURCE_DIR@/LoadFile) + make + cd - +fi + +#| Loads the hex file onto the teensy +teensy-loader-cli/teensy-loader-cli -mmcu=@MCU@ -w @TARGET_HEX@ + +exit $? +