Neale Pickett
·
2026-02-11
Makefile
1MCU = attiny85
2
3CC = avr-gcc
4CFLAGS += -mmcu=$(MCU)
5CFLAGS += -Os
6CFLAGS += -w
7
8## XXX does this really need to be duplicated?
9LDFLAGS += -mmcu=$(MCU)
10
11all: $(TARGETS)
12
13blink.elf: blink.o
14 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
15
16%.hex: %.elf
17 avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature $< $@
18
19clean:
20 rm -f *.elf *.o *.hex
21
22
23
24##
25## Helpful targets for development
26##
27
28
29AVDFLAGS += -p $(MCU)
30AVDFLAGS += -c usbtiny
31
32upload: blink.hex
33 avrdude $(AVDFLAGS) -U flash:w:$<
34
35fuses: FUSES += -U lfuse:w:0x62:m
36fuses: FUSES += -U hfuse:w:0xDF:m
37fuses:
38 avrdude $(AVDFLAGS) $(FUSES)