aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2017-04-21 11:01:07 -0400
committerKevin O'Connor <kevin@koconnor.net>2017-04-21 11:01:07 -0400
commit83eba902a362dddbeaa847a51884a760ad7de012 (patch)
tree6f345eca2e555a92c04057c8092d66993892d9ec /src
parentec805aee2e1d1376f3f015116575369f44e5ad90 (diff)
downloadkutter-83eba902a362dddbeaa847a51884a760ad7de012.tar.gz
kutter-83eba902a362dddbeaa847a51884a760ad7de012.tar.xz
kutter-83eba902a362dddbeaa847a51884a760ad7de012.zip
build: Support makefile rule with default flashing commands
Support a "make flash FLASH_DEVICE=/dev/ttyACM0" rule with the default commands for flashing a device. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src')
-rw-r--r--src/avr/Makefile4
-rw-r--r--src/sam3x8e/Makefile5
2 files changed, 9 insertions, 0 deletions
diff --git a/src/avr/Makefile b/src/avr/Makefile
index 75021d28..4e6631b5 100644
--- a/src/avr/Makefile
+++ b/src/avr/Makefile
@@ -19,3 +19,7 @@ target-y += $(OUT)klipper.elf.hex
$(OUT)klipper.elf.hex: $(OUT)klipper.elf
@echo " Creating hex file $@"
$(Q)$(OBJCOPY) -j .text -j .data -O ihex $< $@
+
+flash: $(OUT)klipper.elf.hex
+ @echo " Flashing $(FLASH_DEVICE) via avrdude"
+ $(Q)avrdude -p$(CONFIG_MCU) -cwiring -P"$(FLASH_DEVICE)" -D -U"flash:w:$(OUT)klipper.elf.hex:i"
diff --git a/src/sam3x8e/Makefile b/src/sam3x8e/Makefile
index 16f300ac..f6986b1d 100644
--- a/src/sam3x8e/Makefile
+++ b/src/sam3x8e/Makefile
@@ -27,3 +27,8 @@ target-y += $(OUT)klipper.bin
$(OUT)klipper.bin: $(OUT)klipper.elf
@echo " Creating hex file $@"
$(Q)$(OBJCOPY) -O binary $< $@
+
+flash: $(OUT)klipper.bin
+ @echo " Flashing $(FLASH_DEVICE) via bossac"
+ $(Q)stty -F "$(FLASH_DEVICE)" 1200
+ $(Q)bossac -i -p "$(FLASH_DEVICE:/dev/%=%)" -R -e -w -v -b $(OUT)klipper.bin