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.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 b/LoadFile/load.teensy similarity index 97% rename from LoadFile/load rename to LoadFile/load.teensy index 569e91c..f2e5592 100755 --- a/LoadFile/load +++ b/LoadFile/load.teensy @@ -13,5 +13,5 @@ fi #| Loads the hex file onto the teensy teensy-loader-cli/teensy-loader-cli -mmcu=@MCU@ -w @TARGET_HEX@ -exit 0 +exit $? diff --git a/LoadFile/winload b/LoadFile/winload.teensy similarity index 98% rename from LoadFile/winload rename to LoadFile/winload.teensy index 17082c2..f22d704 100755 --- a/LoadFile/winload +++ b/LoadFile/winload.teensy @@ -13,5 +13,5 @@ fi #| Loads the hex file onto the teensy teensy-loader-cli/teensy-loader-cli -mmcu=@MCU@ -w @TARGET_HEX@ -exit 0 +exit $?