38 lines
515 B
Makefile
38 lines
515 B
Makefile
PROG = main
|
|
|
|
MCU = atmega328p
|
|
|
|
CC = avr-gcc
|
|
CFLAGS += -mmcu=$(MCU)
|
|
CFLAGS += -DF_CPU=16000000UL
|
|
CFLAGS += -Os
|
|
CFLAGS += -w
|
|
|
|
LDFLAGS += -mmcu=$(MCU)
|
|
|
|
AVDFLAGS += -p m328p
|
|
AVDFLAGS += -c arduino
|
|
AVDFLAGS += -b 115200
|
|
AVDFLAGS += -P /dev/ttyACM0
|
|
|
|
|
|
upload: .upload
|
|
|
|
.upload: $(PROG).hex
|
|
avrdude $(AVDFLAGS) -U flash:w:$<
|
|
touch $@
|
|
|
|
$(PROG).hex: $(PROG)
|
|
avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature $< $@
|
|
|
|
main: main.o avr.o
|
|
|
|
#main.o: avr.h
|
|
#avr.o: avr.h
|
|
|
|
clean:
|
|
rm -f $(PROG) *.o *.hex .upload
|
|
|
|
|
|
|
|
|