bomb/makefile

46 lines
950 B
Makefile
Raw Normal View History

2024-04-16 10:03:11 +00:00
MCU=attiny2313
F_CPU=8000000
PROG=usbasp
CC=avr-g++
OBJCOPY=avr-objcopy
CFLAGS=-Wall -g -O -mmcu=${MCU} -DF_CPU=${F_CPU} -I. -std=gnu++11
SRC=$(wildcard src/*.cpp)
2024-04-19 21:36:16 +00:00
LIB=$(wildcard lib/*/src/*.cpp)
2024-04-16 10:03:11 +00:00
default: clean build flash
build:
mkdir -p bin
2024-04-19 21:36:16 +00:00
${CC} ${CFLAGS} -o bin/main.bin ${SRC} ${LIB} -w
${CC} ${CFLAGS} -o bin/main.elf ${SRC} ${LIB} -w
2024-04-16 10:03:11 +00:00
${OBJCOPY} -j .text -j .data -O ihex bin/main.bin bin/main.hex
flash:
avrdude -V -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 /dev/ttyUSB0 1000000
eeprom:
sh -c "avrdude -p ${MCU} -c ${PROG} -t << END \
write eeprom 0 1 2 3 \
dump eeprom 0 16 \
quit \
END"
fuse:
avrdude -p ${MCU} -c ${PROG} -U lfuse:w:0xe4:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m
lock:
avrdude -p ${MCU} -c ${PROG} -U lock:w:0xC0:m