2018-03-15 15:45:51 +01:00
|
|
|
CFLAGS = -O3 -Wall --std=c11
|
2018-03-16 05:30:47 +01:00
|
|
|
CHIP = atmega328p
|
2018-03-15 15:45:51 +01:00
|
|
|
SOURCE_FILES = $(wildcard *.c)
|
|
|
|
OBJ_FILES = $(SOURCE_FILES:%.c=%.o)
|
|
|
|
BIN = led-driver.bin
|
|
|
|
HEX = led-driver.hex
|
|
|
|
|
|
|
|
default: $(HEX)
|
|
|
|
|
|
|
|
%.o: %.c
|
2018-03-16 05:30:47 +01:00
|
|
|
avr-gcc $(CFLAGS) -mmcu=$(CHIP) -o $@ $<
|
2018-03-15 15:45:51 +01:00
|
|
|
|
|
|
|
$(BIN): $(OBJ_FILES)
|
|
|
|
avr-gcc $(CFLAGS) -o $@ $^
|
|
|
|
|
|
|
|
$(HEX): $(BIN)
|
|
|
|
avr-objcopy -O ihex -j .text -j .data $^ $@
|
|
|
|
|
|
|
|
flash: $(HEX)
|
2018-03-16 05:30:47 +01:00
|
|
|
avrdude -p $(CHIP) -c arduino -B 115200 -P /dev/ttyACM1 -v -v -e -Uflash:w:$(HEX):a
|
2018-03-15 15:45:51 +01:00
|
|
|
|
|
|
|
clean:
|
|
|
|
$(RM) $(OBJ_FILES) $(BIN) $(HEX)
|