aboutsummaryrefslogtreecommitdiffstats
path: root/tmk_core/avr.mk
diff options
context:
space:
mode:
authorGravatar Danny Nguyen <danny@80pct.com>2017-08-03 14:23:12 -0400
committerGravatar Jack Humbert <jack.humb@gmail.com>2017-08-03 20:56:21 -0400
commite0caf94323d5cc0baae38af11984902fb1a5375f (patch)
treebb77118d1e2d8a283d4257229ebea275d04dead7 /tmk_core/avr.mk
parent83b35bf6f68d16910b2acfaffa21c82f4ffbfd3a (diff)
downloadqmk_firmware-e0caf94323d5cc0baae38af11984902fb1a5375f.tar.gz
Move avrdude flashing script from individual keyboard rules.mk to common location and improve script.
Port detection script is now more informative and better handles first time flashing of a Pro Micro
Diffstat (limited to 'tmk_core/avr.mk')
-rw-r--r--tmk_core/avr.mk14
1 files changed, 14 insertions, 0 deletions
diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk
index 4af34ba57..0d0eec3bf 100644
--- a/tmk_core/avr.mk
+++ b/tmk_core/avr.mk
@@ -144,6 +144,20 @@ dfu-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep
fi
$(DFU_PROGRAMMER) $(MCU) reset
+avrdude: $(BUILD_DIR)/$(TARGET).hex
+ ls /dev/tty* > /tmp/1; \
+ echo "Detecting Pro Micro port, reset your Pro Micro now.\c"; \
+ while [ -z $$USB ]; do \
+ sleep 1; \
+ echo ".\c"; \
+ ls /dev/tty* > /tmp/2; \
+ USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \
+ done; \
+ echo ""; \
+ echo "Detected Pro Micro port at $$USB"; \
+ sleep 1; \
+ avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex
+
# Convert hex to bin.
flashbin: $(BUILD_DIR)/$(TARGET).hex
$(OBJCOPY) -Iihex -Obinary $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin