-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·37 lines (28 loc) · 878 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
AVRDUDE_PROGRAMMER := avrisp2
TARGET := fdioCV2.hex
ELF := fdioCV2.elf
SRCS := $(wildcard *.c)
CC := avr-gcc
OBJCOPY := avr-objcopy
OBJDUMP := avr-objdump
ADDRDEF := addrdef.txt
CCFLAGS = -std=c99 -mmcu=atmega1284p -O3 -Wall -fno-strict-aliasing
AVFLAGS = -c ${AVRDUDE_PROGRAMMER} -p m1284p -P usb
LDFLAGS = -Wl,--section-start=.boot=0x1E000
LIBS = -lm
OCFLAGS = -j .text -j .data -j .boot -O ihex
.PHONY: all clean distclean
all:: ${TARGET}
${TARGET}: ${ELF}
${OBJCOPY} ${OCFLAGS} $< $@
${ELF}: ${SRCS}
${CC} ${CCFLAGS} ${LDFLAGS} -o $@ ${SRCS} ${LIBS}
clean::
-rm -f *~ *.o *.dep ${TARGET} ${ELF}
program: ${TARGET}
avrdude ${AVFLAGS} -U flash:w:${TARGET} -U eeprom:w:config.hex
eeprom:
avrdude ${AVFLAGS} -U eeprom:w:config.hex
fuse:
avrdude ${AVFLAGS} -U lfuse:w:0xF6:m -U hfuse:w:0xD9:m -U efuse:w:0xFF:m
distclean:: clean