29 lines
682 B
Makefile
29 lines
682 B
Makefile
|
MCU?=atmega328p
|
||
|
F_CPU=8000000
|
||
|
PROG?=arduino
|
||
|
PORT?=COM5
|
||
|
CC=avr-g++
|
||
|
OBJCOPY=avr-objcopy
|
||
|
CFLAGS=-Wall -g -mmcu=${MCU} -DF_CPU=${F_CPU} -I.
|
||
|
TARGET=main
|
||
|
SRCS= src/*.cpp $(wildcard lib/*/src/*.cpp)
|
||
|
|
||
|
all: build flash
|
||
|
|
||
|
build:
|
||
|
${CC} ${CFLAGS} -o bin/${MODE}.bin ${SRCS} test/${MODE}/main.cpp -O2
|
||
|
${CC} ${CFLAGS} -o bin/${MODE}.elf ${SRCS} test/${MODE}/main.cpp -O2
|
||
|
${OBJCOPY} -j .text -j .data -O ihex bin/${MODE}.bin bin/${MODE}.hex
|
||
|
|
||
|
flash:
|
||
|
avrdude -p ${MCU} -c ${PROG} -P ${PORT} ${BAUD} -U flash:w:bin/${MODE}.hex
|
||
|
|
||
|
clean:
|
||
|
rm -f bin/*
|
||
|
|
||
|
term:
|
||
|
python3 lib/usart/term.py
|
||
|
|
||
|
avarice:
|
||
|
avarice --program --file bin/main.elf --part atmega32 --dragon :4242
|