MCU?=atmega32 F_CPU=8000000 PROG?=dragon_jtag DEBUGGER = dragon PORT?=/dev/ttyUSB0 TYPE?=DEBUG CC=avr-g++ OBJCOPY=avr-objcopy CFLAGS=-Wall -g -O -mmcu=${MCU} -DF_CPU=${F_CPU} -I. -std=gnu++11 -D${TYPE} -Wno-write-strings TARGET=main SRCS=src/eeprom.cpp test/main.cpp test/usart/src/usart.cpp default: build flash build: ${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} -P ${PORT} ${BAUD} -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 eeprom.sh