From 83eba902a362dddbeaa847a51884a760ad7de012 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Fri, 21 Apr 2017 11:01:07 -0400 Subject: [PATCH] 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 --- src/avr/Makefile | 4 ++++ src/sam3x8e/Makefile | 5 +++++ 2 files changed, 9 insertions(+) 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