2020-12-10 21:17:19 +00:00
|
|
|
MCU=atmega32
|
|
|
|
F_CPU=8000000
|
|
|
|
PROG=dragon_jtag
|
|
|
|
DEBUGGER = dragon
|
|
|
|
PORT=/dev/ttyUSB0
|
|
|
|
|
|
|
|
|
|
|
|
CC=avr-g++
|
|
|
|
OBJCOPY=avr-objcopy
|
2020-12-25 11:57:38 +00:00
|
|
|
CFLAGS=-Wall -g -mmcu=${MCU} -DF_CPU=${F_CPU} -I. -Wno-format -Wno-cpp
|
2020-12-10 21:17:19 +00:00
|
|
|
TARGET=main
|
|
|
|
SRCS=src/*.cpp test/main.cpp lib/*/src/*.cpp
|
|
|
|
|
|
|
|
default: build flash
|
|
|
|
|
|
|
|
build:
|
2020-12-25 12:00:52 +00:00
|
|
|
mkdir -p bin
|
2020-12-10 21:17:19 +00:00
|
|
|
${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 avarice
|
|
|
|
avr-gdb -ex "target remote :4242" bin/main.elf
|
|
|
|
|
|
|
|
avarice:
|
|
|
|
sleep 1
|
|
|
|
avarice --file bin/main.elf --part ${MCU} --${DEBUGGER} :4242 &{
|
|
|
|
|
|
|
|
term:
|
|
|
|
screen ${PORT} 1000000
|