43 lines
764 B
Makefile
43 lines
764 B
Makefile
|
CC = avr-gcc
|
||
|
OBJCOPY = avr-objcopy
|
||
|
AVRDUDE = avrdude
|
||
|
CFLAGS = -Os -DF_CPU=16000000UL -mmcu=atmega328p
|
||
|
SERIAL = /dev/cu.usbmodem143401
|
||
|
ADDR = $(shell heptc -where)/c
|
||
|
TARGET = prog
|
||
|
LIB = arduinolib
|
||
|
MAIN = main
|
||
|
|
||
|
|
||
|
.PHONY: all clean flash
|
||
|
|
||
|
all: $(TARGET).hex
|
||
|
|
||
|
flash: $(TARGET).hex
|
||
|
$(AVRDUDE) -F -V -c arduino -p ATMEGA328P -P $(SERIAL) -b 115200 \
|
||
|
-U flash:w:$<
|
||
|
|
||
|
|
||
|
$(TARGET).hex: $(TARGET)
|
||
|
$(OBJCOPY) -O ihex -R .eeprom $< $@
|
||
|
|
||
|
|
||
|
$(TARGET): $(TARGET).o
|
||
|
$(CC) $(CFLAGS) -o $@ *.o
|
||
|
|
||
|
$(TARGET).o : $(TARGET).c
|
||
|
$(CC) -g $(CFLAGS) -c -I $(ADDR) -I . $(LIB).c $(TARGET)_c/*.c $(MAIN).c
|
||
|
|
||
|
|
||
|
$(TARGET).c:
|
||
|
heptc $(LIB).epi
|
||
|
heptc -target c $(TARGET).ept
|
||
|
|
||
|
|
||
|
clean:
|
||
|
rm -f $(TARGET) $(TARGET).hex $(TARGET).o $(TARGET).log $(TARGET).mls
|
||
|
rm -f *.o *.epci
|
||
|
rm -r $(TARGET)_c
|
||
|
|
||
|
|