leddie/firmware/Makefile
2024-03-09 19:07:01 +01:00

22 lines
537 B
Makefile

MCU=atmega8
CFLAGS=-g -Wall --param=min-pagesize=0 -mcall-prologues -mmcu=$(MCU) -O2 -DF_CPU=16000000
LDFLAGS=-Wl,-gc-sections -Wl,-relax
CC=avr-gcc
TARGET=leddie-firmware
OBJECT_FILES=lib/light_ws2812.o lib/pm.o lib/mma8653.o lib/timers.o lib/button.o main.o
all: $(TARGET).hex
clean:
rm -f *.o *.hex *.obj *.hex
rm -f lib/*.o
%.hex: %.obj
avr-objcopy -R .eeprom -O ihex $< $@
%.obj: $(OBJECT_FILES)
$(CC) $(CFLAGS) $(OBJECT_FILES) $(LDFLAGS) -o $@
program: $(TARGET).hex
avrdude -p $(MCU) -c usbasp -U flash:w:$(TARGET).hex