@ -89,11 +89,11 @@ DEBUG_HOST = localhost
#============================================================================
# Autodetect teensy loader
i f n d e f T E E N S Y _ L O A D E R _ C L I
ifneq ( , $( shell which teensy-loader-cli 2>/dev/null) )
TEENSY_LOADER_CLI ?= teensy-loader-cli
else
TEENSY_LOADER_CLI ?= teensy_loader_cli
endif
ifneq ( , $( shell which teensy-loader-cli 2>/dev/null) )
TEENSY_LOADER_CLI ?= teensy-loader-cli
else
TEENSY_LOADER_CLI ?= teensy_loader_cli
endif
e n d i f
# Generate a .qmk for the QMK-FF
@ -124,8 +124,12 @@ qmk: $(BUILD_DIR)/$(TARGET).hex
program : $( BUILD_DIR ) /$( TARGET ) .hex $( BUILD_DIR ) /$( TARGET ) .eep check -size
$( PROGRAM_CMD)
teensy : $( BUILD_DIR ) /$( TARGET ) .hex check -size cpfirmware
d e f i n e E X E C _ T E E N S Y
$( TEENSY_LOADER_CLI) -mmcu= $( MCU) -w -v $( BUILD_DIR) /$( TARGET) .hex
e n d e f
teensy : $( BUILD_DIR ) /$( TARGET ) .hex check -size cpfirmware
$( call EXEC_TEENSY)
BATCHISP ?= batchisp
@ -137,18 +141,32 @@ flip: $(BUILD_DIR)/$(TARGET).hex check-size
DFU_PROGRAMMER ?= dfu-programmer
GREP ?= grep
dfu : $( BUILD_DIR ) /$( TARGET ) .hex cpfirmware check -size
d e f i n e E X E C _ D F U
if [ " $( 1) " ] ; then \
echo " Flashing ' $( 1) ' for EE_HANDS split keyboard support. " ; \
fi ; \
until $( DFU_PROGRAMMER) $( MCU) get bootloader-version; do \
echo "Error: Bootloader not found. Trying again in 5s." ; \
sleep 5 ; \
done
done ; \
if $( DFU_PROGRAMMER) --version 2>& 1 | $( GREP) -q 0.7 ; then \
$( DFU_PROGRAMMER) $( MCU) erase --force; \
else \
$( DFU_PROGRAMMER) $( MCU) erase; \
fi
$( DFU_PROGRAMMER) $( MCU) flash $( BUILD_DIR) /$( TARGET) .hex
$( DFU_PROGRAMMER) $( MCU) erase --force; \
if [ " $( 1) " ] ; then \
$( DFU_PROGRAMMER) $( MCU) flash --eeprom $( QUANTUM_PATH) /split_common/$( 1) ; \
fi ; \
else \
$( DFU_PROGRAMMER) $( MCU) erase; \
if [ " $( 1) " ] ; then \
$( DFU_PROGRAMMER) $( MCU) flash-eeprom $( QUANTUM_PATH) /split_common/$( 1) ; \
fi ; \
fi ; \
$( DFU_PROGRAMMER) $( MCU) flash $( BUILD_DIR) /$( TARGET) .hex; \
$( DFU_PROGRAMMER) $( MCU) reset
e n d e f
dfu : $( BUILD_DIR ) /$( TARGET ) .hex cpfirmware check -size
$( call EXEC_DFU)
dfu-start :
$( DFU_PROGRAMMER) $( MCU) reset
@ -170,34 +188,10 @@ dfu-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep
$( DFU_PROGRAMMER) $( MCU) reset
dfu-split-left : $( BUILD_DIR ) /$( TARGET ) .hex cpfirmware check -size
until $( DFU_PROGRAMMER) $( MCU) get bootloader-version; do \
echo "Error: Bootloader not found. Trying again in 5s." ; \
sleep 5 ; \
done
if $( DFU_PROGRAMMER) --version 2>& 1 | $( GREP) -q 0.7 ; then \
$( DFU_PROGRAMMER) $( MCU) erase --force; \
$( DFU_PROGRAMMER) $( MCU) flash --eeprom $( QUANTUM_PATH) /split_common/eeprom-lefthand.eep; \
else \
$( DFU_PROGRAMMER) $( MCU) erase; \
$( DFU_PROGRAMMER) $( MCU) flash-eeprom $( QUANTUM_PATH) /split_common/eeprom-lefthand.eep; \
fi
$( DFU_PROGRAMMER) $( MCU) flash $( BUILD_DIR) /$( TARGET) .hex
$( DFU_PROGRAMMER) $( MCU) reset
$( call EXEC_DFU,eeprom-lefthand.eep)
dfu-split-right : $( BUILD_DIR ) /$( TARGET ) .hex cpfirmware check -size
until $( DFU_PROGRAMMER) $( MCU) get bootloader-version; do \
echo "Error: Bootloader not found. Trying again in 5s." ; \
sleep 5 ; \
done
if $( DFU_PROGRAMMER) --version 2>& 1 | $( GREP) -q 0.7 ; then \
$( DFU_PROGRAMMER) $( MCU) erase --force; \
$( DFU_PROGRAMMER) $( MCU) flash --eeprom $( QUANTUM_PATH) /split_common/eeprom-righthand.eep; \
else \
$( DFU_PROGRAMMER) $( MCU) erase; \
$( DFU_PROGRAMMER) $( MCU) flash-eeprom $( QUANTUM_PATH) /split_common/eeprom-righthand.eep; \
fi
$( DFU_PROGRAMMER) $( MCU) flash $( BUILD_DIR) /$( TARGET) .hex
$( DFU_PROGRAMMER) $( MCU) reset
$( call EXEC_DFU,eeprom-righthand.eep)
d e f i n e E X E C _ A V R D U D E
USB = ; \
@ -245,8 +239,12 @@ avrdude-split-left: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware
avrdude-split-right : $( BUILD_DIR ) /$( TARGET ) .hex check -size cpfirmware
$( call EXEC_AVRDUDE,eeprom-righthand.eep)
usbasp : $( BUILD_DIR ) /$( TARGET ) .hex check -size cpfirmware
d e f i n e E X E C _ U S B A S P
avrdude -p $( MCU) -c usbasp -U flash:w:$( BUILD_DIR) /$( TARGET) .hex
e n d e f
usbasp : $( BUILD_DIR ) /$( TARGET ) .hex check -size cpfirmware
$( call EXEC_USBASP)
# Convert hex to bin.
@ -323,3 +321,16 @@ production: $(BUILD_DIR)/$(TARGET).hex bootloader cpfirmware
@cat $( TARGET) _bootloader.hex >> $( TARGET) _production.hex
echo "File sizes:"
$( SIZE) $( TARGET) .hex $( TARGET) _bootloader.hex $( TARGET) _production.hex
flash : $( BUILD_DIR ) /$( TARGET ) .hex check -size cpfirmware
i f e q ( $( strip $ ( BOOTLOADER ) ) , c a t e r i n a )
$( call EXEC_AVRDUDE)
e l s e i f e q ( $( strip $ ( BOOTLOADER ) ) , h a l f k a y )
$( call EXEC_TEENSY)
e l s e i f e q ( d f u , $( findstring dfu ,$ ( BOOTLOADER ) ) )
$( call EXEC_DFU)
e l s e i f e q ( $( strip $ ( BOOTLOADER ) ) , U S B a s p )
$( call EXEC_USBASP)
e l s e
$( PRINT_OK) ; $( SILENT) || printf "&(MSG_FLASH_BOOTLOADER)"
e n d i f