diff options
author | Brett Weiland <brett_weiland@bpcspace.com> | 2023-10-27 07:10:26 -0500 |
---|---|---|
committer | Brett Weiland <brett_weiland@bpcspace.com> | 2023-10-27 07:10:26 -0500 |
commit | e811d778ea51ac1e25588a9cc957fca4f532ea5a (patch) | |
tree | d28999567bad4613143d016bfb6d376c22f9e3a2 /makefile |
init
Diffstat (limited to 'makefile')
-rw-r--r-- | makefile | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/makefile b/makefile new file mode 100644 index 0000000..2cd372d --- /dev/null +++ b/makefile @@ -0,0 +1,26 @@ +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/* |