aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--firmware/e300/battery/Makefile8
-rw-r--r--firmware/e300/battery/main.c1
2 files changed, 7 insertions, 2 deletions
diff --git a/firmware/e300/battery/Makefile b/firmware/e300/battery/Makefile
index c2d530e36..1ce0bf279 100644
--- a/firmware/e300/battery/Makefile
+++ b/firmware/e300/battery/Makefile
@@ -39,17 +39,18 @@ MMCU = attiny88
PROGRAMMER = jtag3isp
PORT = usb
AVRDUDE = avrdude -p $(MMCU) -c $(PROGRAMMER) -P $(PORT) -V
+FUSES = -U hfuse:w:hfuse.hex:i -U lfuse:w:lfuse.hex:i -U efuse:w:efuse.hex:i -u
##################################################
# Global Targets
##################################################
-all: $(TARGET).hex size
+all: $(TARGET).hex size hfuse.hex lfuse.hex efuse.hex
clean:
$(RM) *.o *.elf *.hex
install: all
- $(AVRDUDE) -U flash:w:$(TARGET).hex:i
+ $(AVRDUDE) -U flash:w:$(TARGET).hex:i $(FUSES)
size: $(TARGET).hex
@$(SIZE) --format=SysV --mcu=$(MMCU) $(TARGET).elf
@@ -67,6 +68,9 @@ lfuse.hex: fuses.hex
hfuse.hex: fuses.hex
$(SREC) $< -Intel -crop 0x01 0x02 -offset -0x01 -O $@ -Intel
+efuse.hex: fuses.hex
+ $(SREC) $< -Intel -crop 0x02 0x03 -offset -0x02 -O $@ -Intel
+
$(TARGET).hex: $(TARGET).elf
$(OBJCOPY) -R .eeprom -R .fuse -O ihex $< $@
diff --git a/firmware/e300/battery/main.c b/firmware/e300/battery/main.c
index eec9e8293..723816924 100644
--- a/firmware/e300/battery/main.c
+++ b/firmware/e300/battery/main.c
@@ -35,6 +35,7 @@
FUSES = {
.low = (FUSE_CKSEL0 & FUSE_SUT0),
.high = (FUSE_EESAVE & FUSE_SPIEN),
+ .extended = EFUSE_DEFAULT,
};