mrf24j40/makefile

35 lines
845 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= $(wildcard src/*.cpp) test/usart/src/usart.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
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