diff options
author | Daniel Friesel <derf@finalrewind.org> | 2017-12-15 14:55:27 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2017-12-15 14:55:27 +0100 |
commit | 972126fd2406030dbd3abd1a705bb0ae1af9abb3 (patch) | |
tree | 74fea3d91fcaabebdd3c354fdc594ddedc09037e /src/arch/arduino-nano/Makefile.inc | |
parent | bfcfa4cf67bad25ccba5ff735967d4c6abff899c (diff) |
Add AVR (Arduino Nano) support
Diffstat (limited to 'src/arch/arduino-nano/Makefile.inc')
-rw-r--r-- | src/arch/arduino-nano/Makefile.inc | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/arch/arduino-nano/Makefile.inc b/src/arch/arduino-nano/Makefile.inc new file mode 100644 index 0000000..e8ecd82 --- /dev/null +++ b/src/arch/arduino-nano/Makefile.inc @@ -0,0 +1,40 @@ +# vim:ft=make + +MCU = atmega328p +PROGRAMMER ?= usbasp + +INCLUDES += -Iinclude/arduino-nano +COMMON_FLAGS += -mmcu=${MCU} -DF_CPU=16000000UL + +CC = avr-gcc +CXX = avr-g++ +NM = avr-nm +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump + +TARGETS += src/arch/arduino-nano/arch.cc +TARGETS += src/arch/arduino-nano/driver/gpio.cc +TARGETS += src/arch/arduino-nano/driver/stdout.cc +TARGETS += src/arch/arduino-nano/driver/uptime.cc + +OBJECTS = ${TARGETS:.cc=.o} + +.cc.o: + ${CXX} ${INCLUDES} ${COMMON_FLAGS} ${CXXFLAGS} -c -o $@ ${@:.o=.cc} + +build/system.elf: ${OBJECTS} + ${CXX} ${COMMON_FLAGS} ${CXXFLAGS} -Wl,--gc-sections -o $@ ${OBJECTS} + +build/system.hex: build/system.elf + ${OBJCOPY} -O ihex ${@:.hex=.elf} $@ + +program: build/system.hex + avrdude -p ${MCU} -c arduino -P /dev/ttyUSB0 -b 57600 -U flash:w:build/system.hex + +arch_clean: + rm -f ${OBJECTS} build/system.hex + +monitor: + screen /dev/ttyUSB0 115200 + +.PHONY: arch_clean monitor program |