attiny10-lantern/makefile

32 lines
890 B
Makefile
Raw Normal View History

2021-02-04 15:14:26 +01:00
CC = avr-gcc
UC = attiny10
COMPOPT = -mmcu=$(UC) -DF_CPU=8000000 -g -Os -flto -mtiny-stack -maccumulate-args -fno-inline-small-functions -mcall-prologues -fno-caller-saves -ffunction-sections
LINKOPT = -mmcu=$(UC) -flto -mrelax -Wl,--gc-sections
OBJ = attiny10-lantern.o light_ws2812.o
.PHONY: clean upload
all: attiny10-lantern.elf
attiny10-lantern.elf: $(OBJ)
$(CC) $(LINKOPT) -o attiny10-lantern.elf $(OBJ)
avr-size --mcu=attiny10 -C attiny10-lantern.elf
attiny10-lantern.o: attiny10-lantern.cpp
$(CC) $(COMPOPT) -c attiny10-lantern.cpp
light_ws2812.o: light_ws2812.c
$(CC) $(COMPOPT) -c light_ws2812.c
clean:
rm -f *.o *.elf
install: attiny10-lantern.elf
avrdude -C /etc/avrdude.conf -c usbasp -p t10 -U flash:w:attiny10-lantern.elf
avr-size --mcu=attiny10 -C attiny10-lantern.elf
# Binary Size: 990 byte
# -flto: 844 byte
# -mtiny-stack: 842 byte
# Code adv: 818 byte