mca-pendel/sketches/led-driver/Makefile

32 lines
579 B
Makefile
Raw Normal View History

2018-03-23 00:03:12 +01:00
CFLAGS = -Os -Wall --std=c11 -g
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
2018-03-23 00:03:12 +01:00
ASM = led-driver.asm
2018-03-15 15:45:51 +01:00
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 $@ $^
2018-03-23 00:03:12 +01:00
$(ASM): $(BIN)
avr-objdump -d -g -l -S $^ > $@
2018-03-15 15:45:51 +01:00
$(HEX): $(BIN)
avr-objcopy -O ihex -j .text -j .data $^ $@
2018-03-23 00:03:12 +01:00
asm: $(ASM)
2018-03-15 15:45:51 +01:00
flash: $(HEX)
2018-03-23 00:03:12 +01:00
avrdude -p $(CHIP) -c arduino -B 115200 -P /dev/ttyACM0 -v -v -e -Uflash:w:$(HEX):a
2018-03-15 15:45:51 +01:00
clean:
2018-03-23 00:03:12 +01:00
$(RM) $(OBJ_FILES) $(BIN) $(HEX) $(ASM)