From 0334488f3deeb1daa099db118cf0e0f59325f639 Mon Sep 17 00:00:00 2001 From: Anders Blomdell <anders.blomdell@control.lth.se> Date: Tue, 20 Nov 2018 12:28:36 +0100 Subject: [PATCH] Make .Verify check fuses also --- Makefile | 3 +++ lib/avr/Makefile.common | 25 ++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 09c96df..dcd5805 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 6341ec7..93d6f9b 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) \ -- GitLab