27 lines
745 B
Makefile
27 lines
745 B
Makefile
TOOLCHAIN_DIR=/home/indigo/packs/avr8-gnu-toolchain-linux_x86_64
|
|
CC=$(TOOLCHAIN_DIR)/bin/avr-gcc
|
|
INC=$(TOOLCHAIN_DIR)/avr/include
|
|
OUT=payload.elf
|
|
SRCFILES := $(wildcard *.c)
|
|
OBJFILES := $(patsubst %.c,build/%.o,$(SRCFILES))
|
|
|
|
DEVICE=atmega165pa
|
|
F_CPU=8000000 #uses internal 8mhz RC clock
|
|
#F_CPU=10000000 #uses external 10mhz crystal to ensure accuracy. 10mhz is weird but I just had this one laying around
|
|
|
|
CCOPTS := -Wall -Wextra -I $(INC) -mmcu=$(DEVICE) -DF_CPU=$(F_CPU) -O1
|
|
|
|
|
|
make: $(OBJFILES)
|
|
$(CC) $(CCOPTS) -o $(OUT) $(OBJFILES)
|
|
|
|
build/%.o: %.c
|
|
if [ ! -d "build" ]; then mkdir -p build; fi
|
|
$(CC) $(CCOPTS) -c -o $@ $<
|
|
|
|
install: $(OUT)
|
|
doas avrdude -v -c usbtiny -p atmega165pa -U flash:w:payload.elf:e
|
|
|
|
clean:
|
|
rm -f *.o *.elf build/*
|