2020-11-27 04:49:27 +01:00
|
|
|
CC = avr-gcc
|
|
|
|
OBJCOPY = avr-objcopy
|
|
|
|
AVRDUDE = avrdude
|
|
|
|
CFLAGS = -Os -DF_CPU=16000000UL -mmcu=atmega328p
|
2020-12-14 20:22:04 +01:00
|
|
|
SERIAL = /dev/cu.usbmodem143401
|
|
|
|
ADDR = /Users/megidervishi/.opam/4.10.0/lib/heptagon/c
|
|
|
|
TARGET = prog
|
|
|
|
LIB = arduinolib
|
|
|
|
MAIN = main
|
|
|
|
|
2020-11-27 04:49:27 +01:00
|
|
|
|
|
|
|
.PHONY: all clean flash
|
|
|
|
|
|
|
|
all: $(TARGET).hex
|
|
|
|
|
|
|
|
flash: $(TARGET).hex
|
|
|
|
$(AVRDUDE) -F -V -c arduino -p ATMEGA328P -P $(SERIAL) -b 115200 \
|
|
|
|
-U flash:w:$<
|
|
|
|
|
2020-12-14 20:22:04 +01:00
|
|
|
|
2020-11-27 04:49:27 +01:00
|
|
|
$(TARGET).hex: $(TARGET)
|
|
|
|
$(OBJCOPY) -O ihex -R .eeprom $< $@
|
|
|
|
|
2020-12-14 20:22:04 +01:00
|
|
|
|
2020-11-27 04:49:27 +01:00
|
|
|
$(TARGET): $(TARGET).o
|
2020-12-14 20:22:04 +01:00
|
|
|
$(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
|
2020-11-27 04:49:27 +01:00
|
|
|
|
|
|
|
|
|
|
|
clean:
|
2020-12-14 20:22:04 +01:00
|
|
|
rm -f $(TARGET) $(TARGET).hex $(TARGET).o $(TARGET).log $(TARGET).mls
|
|
|
|
rm -f *.o *.epci
|
|
|
|
rm -r $(TARGET)_c
|
|
|
|
|
|
|
|
|