From b2554d7bb3bbd1faf42737731f749b8a434e0db3 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 15 Nov 2018 07:22:20 +0100 Subject: restore arduino-nano Makefile --- src/arch/arduino-nano/Makefile.inc | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'src/arch/arduino-nano') 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:" -- cgit v1.2.3