diff --git a/Makefile b/Makefile index 09c96dfe8320a56c42307ced99e969b50a6f14a9..dcd58050f3ce9a322eeeb55aa1dbeec04d000936 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,9 @@ all: %.LOAD: make -C $$(./tools/find_avr_targets $*) $@ +%.VERIFY: + make -C $$(./tools/find_avr_targets $*) $@ + %.FUSE: make -C $$(./tools/find_avr_targets $*) $@ diff --git a/lib/avr/Makefile.common b/lib/avr/Makefile.common index 6341ec794db8c3764ee9eff191086a4a4a24a6fe..93d6f9b31e0658c0bff8ab93475598944c8e34e2 100644 --- a/lib/avr/Makefile.common +++ b/lib/avr/Makefile.common @@ -62,7 +62,7 @@ OBJECTS=$($(1).C:%=compiled/$(1)/%.o) --erase \ --upload if=compiled/$(TARGET)/$*.sr -%.VERIFY: compiled/$(TARGET)/%.sr +%.VERIFY: %.VERIFY_FUSE compiled/$(TARGET)/%.sr avrdude -P usb -c avrisp2 -p $(CHIP) \ -U flash:v:compiled/$(TARGET)/$*.sr:s @@ -70,6 +70,29 @@ OBJECTS=$($(1).C:%=compiled/$(1)/%.o) avrdude -P usb -c avrisp2 -p $(CHIP) \ -U flash:w:compiled/$(TARGET)/$*.sr:s +%.VERIFY_FUSE: + @if [ -n "$($(TARGET).FUSE_L)" ] ; then \ + echo avrdude -P usb -c avrisp2 -p $(CHIP) \ + -U lfuse:v:$($(TARGET).FUSE_L):m >&2 \ + ; avrdude -qq -P usb -c avrisp2 -p $(CHIP) \ + -U lfuse:v:$($(TARGET).FUSE_L):m \ + || (echo "failed to program FUSE_L with $($(TARGET).FUSE_L)" >&2 && exit 1) \ + ; fi + @if [ -n "$($(TARGET).FUSE_H)" ] ; then \ + echo avrdude -P usb -c avrisp2 -p $(CHIP) \ + -U hfuse:v:$($(TARGET).FUSE_H):m >&2 \ + ; avrdude -qq -P usb -c avrisp2 -p $(CHIP) \ + -U hfuse:v:$($(TARGET).FUSE_H):m \ + || (echo "failed to program FUSE_H with $($(TARGET).FUSE_H)" >&2 && exit 1) \ + ; fi + @if [ -n "$($(TARGET).FUSE_E)" ] ; then \ + echo avrdude -P usb -c avrisp2 -p $(CHIP) \ + -U efuse:v:$($(TARGET).FUSE_E):m >&2 \ + ; avrdude -qq -P usb -c avrisp2 -p $(CHIP) \ + -U efuse:v:$($(TARGET).FUSE_E):m \ + || (echo "failed to program FUSE_E with $($(TARGET).FUSE_E)" >&2 && exit 1) \ + ; fi + %.FUSE: @if [ -n "$($(TARGET).FUSE_L)" ] ; then \ echo avrdude -P usb -c avrisp2 -p $(CHIP) \