-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
44 lines (32 loc) · 931 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
38
39
40
41
42
43
44
PRG = 2820gpssim
OBJ = 2820gpssim.o
MCU_TARGET = attiny2313
PROGRAMMER = usbasp # or stk500 etc.
AVRDUDE_TARGET = t2313
PORT = /dev/ttyUSB0
#F_CPU = 20000000
HFUSE = 0xdf
LFUSE = 0xe4
OPTIMIZE = -Os
DEFS =
LIBS =
CC = avr-gcc
override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
override LDFLAGS = -Wl,-Map,$(PRG).map
OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump
all: $(PRG).elf hex
hex: $(PRG).hex
%.hex: %.elf
$(OBJCOPY) -j .text -j .data -O ihex $< $@
$(PRG).elf: $(OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
clean:
$(RM) *.o *.map *.elf *.hex
program:
avrdude -p $(AVRDUDE_TARGET) -c $(PROGRAMMER) -P $(PORT) \
-U flash:w:$(PRG).hex
fuses:
avrdude -p $(AVRDUDE_TARGET) -c $(PROGRAMMER) -P $(PORT) \
-U hfuse:w:$(HFUSE):m \
-U lfuse:w:$(LFUSE):m