summaryrefslogtreecommitdiff
path: root/src/arch/arduino-nano/Makefile.inc
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2018-11-15 07:22:20 +0100
committerDaniel Friesel <derf@finalrewind.org>2018-11-15 07:22:20 +0100
commitb2554d7bb3bbd1faf42737731f749b8a434e0db3 (patch)
treee324561310643dd288a0d05c6687901db19dd11e /src/arch/arduino-nano/Makefile.inc
parent290b099a39406d110a8f15dc7f23558afb1dab48 (diff)
restore arduino-nano Makefile
Diffstat (limited to 'src/arch/arduino-nano/Makefile.inc')
-rw-r--r--src/arch/arduino-nano/Makefile.inc27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/arch/arduino-nano/Makefile.inc b/src/arch/arduino-nano/Makefile.inc
index 9a3c1e3..30d9638 100644
--- a/src/arch/arduino-nano/Makefile.inc
+++ b/src/arch/arduino-nano/Makefile.inc
@@ -8,6 +8,7 @@ cpu_freq ?= 16000000
COMMON_FLAGS += -Werror=overflow
COMMON_FLAGS += -mmcu=${MCU} -DMULTIPASS_ARCH_arduino_nano
+COMMON_FLAGS += -DF_CPU=${cpu_freq}UL
COMMON_FLAGS += -flto
COMMON_FLAGS += -DMULTIPASS_ARCH_HAS_I2C
@@ -39,12 +40,30 @@ ifneq ($(findstring timer,${arch_drivers}), )
CXX_TARGETS += src/arch/arduino-nano/driver/timer.cc
endif
-ifneq (${cpu_freq}, )
- COMMON_FLAGS += -DF_CPU=${cpu_freq}UL
+ifeq (${cpu_freq}, 16000000)
+ uart_baud = 57600
+else ifeq (${cpu_freq}, 8000000)
+ uart_baud = 38400
+else ifeq (${cpu_freq}, 4000000)
+ uart_baud = 38400
+else ifeq (${cpu_freq}, 2000000)
+ uart_baud = 19200
+else ifeq (${cpu_freq}, 1000000)
+ uart_baud = 9600
+else ifeq (${cpu_freq}, 500000)
+ uart_baud = 4800
+else ifeq (${cpu_freq}, 250000)
+ uart_baud = 2400
+else ifeq (${cpu_freq}, 125000)
+ uart_baud = 1200
+else ifeq (${cpu_freq}, 62500)
+ uart_baud = 300
else
- COMMON_FLAGS += -DF_CPU=16000000UL
+ uart_baud = 9600
endif
+COMMON_FLAGS += -DBAUD=${uart_baud}UL
+
OBJECTS = ${CXX_TARGETS:.cc=.o} ${C_TARGETS:.c=.o}
.cc.o:
@@ -67,7 +86,7 @@ arch_clean:
${QUIET}rm -f ${OBJECTS} build/system.hex
monitor:
- ${QUIET}screen ${PORT} 19200
+ ${QUIET}screen ${PORT} ${uart_baud}
arch_help:
@echo "arduino-nano specific flags:"