2013-06-30 14:57:44 -06:00
|
|
|
PROG = main
|
2013-03-27 22:47:17 -06:00
|
|
|
|
2013-06-30 14:57:44 -06:00
|
|
|
MCU = attiny84
|
2013-05-04 19:46:18 -06:00
|
|
|
|
2013-06-30 14:57:44 -06:00
|
|
|
CC = avr-gcc
|
|
|
|
CFLAGS += -mmcu=$(MCU)
|
|
|
|
CFLAGS += -Os
|
|
|
|
CFLAGS += -w
|
2013-03-07 23:55:05 -07:00
|
|
|
|
2013-06-30 14:57:44 -06:00
|
|
|
LDFLAGS += -mmcu=$(MCU)
|
|
|
|
|
|
|
|
AVDFLAGS += -p $(MCU)
|
|
|
|
AVDFLAGS += -c usbtiny
|
|
|
|
|
2013-12-26 11:47:30 -07:00
|
|
|
CLOCK_HZ = 16000000
|
2013-07-02 19:54:39 -06:00
|
|
|
FUSES += -U lfuse:w:0x7f:m
|
|
|
|
FUSES += -U hfuse:w:0xdd:m
|
2013-06-30 14:57:44 -06:00
|
|
|
FUSES += -U efuse:w:0xff:m
|
|
|
|
|
|
|
|
upload: .upload
|
|
|
|
|
|
|
|
.upload: $(PROG).hex
|
|
|
|
avrdude $(AVDFLAGS) -U flash:w:$<
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
fuses:
|
|
|
|
avrdude $(AVDFLAGS) $(FUSES)
|
|
|
|
|
|
|
|
main: main.o avr.o
|
2013-12-26 11:47:30 -07:00
|
|
|
blink: blink.o avr.o
|
2013-07-02 19:54:39 -06:00
|
|
|
avr.o: CFLAGS += -DCLOCK_HZ=$(CLOCK_HZ)
|
2013-06-30 14:57:44 -06:00
|
|
|
|
2013-12-26 11:47:30 -07:00
|
|
|
%.hex: %
|
2013-06-30 14:57:44 -06:00
|
|
|
avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature $< $@
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f $(PROG) *.o *.hex .upload
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|