26 lines
511 B
Makefile
26 lines
511 B
Makefile
CC = avr-gcc
|
|
OBJCOPY = avr-objcopy
|
|
AVRDUDE = avrdude
|
|
CFLAGS = -Os -DF_CPU=16000000UL -mmcu=atmega328p
|
|
SERIAL = /dev/ttyACM0
|
|
TARGET = led
|
|
|
|
.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 $@ $<
|
|
|
|
$(TARGET).o: $(TARGET).c
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
clean:
|
|
rm -f $(TARGET) $(TARGET).hex $(TARGET).o
|