Initial commit

This commit is contained in:
2020-10-26 13:47:13 +13:00
parent 2ee81db7fe
commit c96c080177
8 changed files with 840 additions and 0 deletions

29
makefile Normal file
View File

@@ -0,0 +1,29 @@
MCU=atmega16
F_CPU=8000000
PROG=dragon_jtag
DEBUGGER = dragon
PORT=/dev/ttyUSB0
CC=avr-g++
OBJCOPY=avr-objcopy
CFLAGS=-Wall -g -mmcu=${MCU} -DF_CPU=${F_CPU} -I.
TARGET=main
SRCS=src/*.cpp
default: build flash
build:
${CC} ${CFLAGS} -o bin/${TARGET}.bin ${SRCS}
${CC} ${CFLAGS} -o bin/${TARGET}.elf ${SRCS}
${OBJCOPY} -j .text -j .data -O ihex bin/${TARGET}.bin bin/${TARGET}.hex
flash:
avrdude -p ${MCU} -c ${PROG} -U flash:w:bin/main.hex
clean:
rm -f bin/*
debug: flash
sleep 1
avarice --program --file bin/main.elf --part ${MCU} --${DEBUGGER} :4242 &
avr-gdb -ex "target remote :4242" bin/main.elf