makefile fuse check
This commit is contained in:
parent
6c7ed17b96
commit
c071f0b28e
|
@ -3,6 +3,13 @@
|
|||
# Author: Tristan Krause
|
||||
# Creation Date: 2019-03-22
|
||||
|
||||
# MCU Options
|
||||
LFUSE = D2
|
||||
HFUSE = 91
|
||||
EFUSE = FF
|
||||
F_CPU = 20000000
|
||||
DEBUG = -DB15F_DEBUG
|
||||
|
||||
# Environment
|
||||
COMPILER_PATH = avr-g++
|
||||
OBJCOPY_PATH = avr-objcopy
|
||||
|
@ -10,14 +17,15 @@ OBJCOPY_PATH = avr-objcopy
|
|||
# Optionen
|
||||
PROGRAMMER = avrispmkII
|
||||
OUTPUT = B15F.elf
|
||||
HEX = B15F.hex
|
||||
MCU = atmega1284p
|
||||
CFLAGS = -Wall -Wextra -std=c++14 -O3 -mmcu=$(MCU) -DF_CPU=20000000 -DB15F_DEBUG
|
||||
HEX = B15F.hex
|
||||
MCU = atmega1284p
|
||||
CFLAGS = -Wall -Wextra -std=c++14 -O3 -mmcu=$(MCU) -DF_CPU=$(F_CPU) $(DEBUG)
|
||||
LDFLAGS =
|
||||
OBJECTS = main.o spi.o mcp23s17.o tlc5615.o adu.o selftest.o global_vars.o usart.o requests.o interrupts.o
|
||||
|
||||
|
||||
COMPILE = $(COMPILER_PATH) $(CFLAGS)
|
||||
FUSES = (E:$(EFUSE), H:$(HFUSE), L:$(LFUSE))
|
||||
|
||||
B15F: $(OBJECTS)
|
||||
@echo "Linking..."
|
||||
|
@ -34,7 +42,12 @@ clean:
|
|||
@echo "Cleaning..."
|
||||
rm -f $(OBJECTS) $(OUTPUT) $(HEX)
|
||||
|
||||
upload: B15F
|
||||
checkfuses:
|
||||
@echo ""
|
||||
@echo "Checking fuses..."
|
||||
bash -c 'diff -B <( echo "$(FUSES)" ) <( avrdude -Pusb -p $(MCU) -c $(PROGRAMMER) 2>&1 | grep "safemode: Fuses OK" | tail -c 19 ) >/dev/null || avrdude -Pusb -p $(MCU) -c $(PROGRAMMER) -U lfuse:w:0x$(LFUSE):m -U hfuse:w:0x$(HFUSE):m -U efuse:w:0x$(EFUSE):m'
|
||||
|
||||
upload: B15F checkfuses
|
||||
avrdude -Pusb -p $(MCU) -c $(PROGRAMMER) -U flash:w:$(HEX)
|
||||
|
||||
.cpp.o:
|
||||
|
|
Loading…
Reference in a new issue