2021-08-29 09:56:16 +00:00
|
|
|
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
|
2021-09-12 23:01:14 +00:00
|
|
|
SRCS= $(wildcard src/*.cpp) test/usart/src/usart.cpp
|
2021-08-29 09:56:16 +00:00
|
|
|
|
|
|
|
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
|
2021-09-13 02:00:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
fuse:
|
|
|
|
avrdude -p ${MCU} -c ${PROG} -P ${PORT} -U lfuse:w:0xe4:m -U hfuse:w:0xd2:m
|
|
|
|
|
|
|
|
lock:
|
|
|
|
avrdude -p ${MCU} -c ${PROG} -P ${PORT} -U lock:w:0xC0:m
|