summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/arch/arduino-nano-168/Kconfig37
-rw-r--r--src/arch/arduino-nano-168/Makefile.inc166
l---------src/arch/arduino-nano-168/arch.cc1
l---------src/arch/arduino-nano-168/driver1
-rw-r--r--src/arch/arduino-nano-168/prompt1
-rw-r--r--src/arch/arduino-nano/Kconfig5
-rw-r--r--src/arch/arduino-nano/Makefile.inc5
7 files changed, 10 insertions, 206 deletions
diff --git a/src/arch/arduino-nano-168/Kconfig b/src/arch/arduino-nano-168/Kconfig
deleted file mode 100644
index 0d8b25c..0000000
--- a/src/arch/arduino-nano-168/Kconfig
+++ /dev/null
@@ -1,37 +0,0 @@
-config arch_arduino_nano_168_driver_adc
-bool "ADC (Analog-Digital-Converter)"
-select meta_driver_adc
-
-config arch_arduino_nano_168_driver_i2c
-bool "I2C"
-select meta_driver_i2c
-
-config arch_arduino_nano_168_driver_neopixel
-bool "WS2812b (NeoPixel)"
-select meta_driver_neopixel
-
-config arch_arduino_nano_168_driver_spi
-bool "SPI"
-select meta_driver_spi
-
-config arch_arduino_nano_168_driver_stdin
-bool "UART Input"
-select meta_driver_stdin
-
-config arch_arduino_nano_168_driver_timer
-bool "Timer with Interrupts"
-select meta_driver_timer
-
-choice arch_arduino_nano_168_timer1
-bool "Timer 1"
-optional
-
-config arch_arduino_nano_168_driver_uptime
-bool "Uptime Counter"
-select meta_driver_uptime
-
-config arch_arduino_nano_168_driver_counter
-bool "Cycle Counter"
-select meta_driver_counter
-
-endchoice
diff --git a/src/arch/arduino-nano-168/Makefile.inc b/src/arch/arduino-nano-168/Makefile.inc
deleted file mode 100644
index 21ccf2f..0000000
--- a/src/arch/arduino-nano-168/Makefile.inc
+++ /dev/null
@@ -1,166 +0,0 @@
-# vim:ft=make
-
-MCU = atmega168
-SERIAL_PORT ?= /dev/ttyUSB0
-BAUD = 19200
-
-cpu_freq ?= 16000000
-
-COMMON_FLAGS += -Werror=overflow
-COMMON_FLAGS += -mmcu=${MCU} -DMULTIPASS_ARCH_arduino_nano
-COMMON_FLAGS += -DF_CPU=${cpu_freq}UL
-COMMON_FLAGS += -DMULTIPASS_ARCH_HAS_I2C
-
-ifeq (${stack_usage}, )
- COMMON_FLAGS += -flto
-endif
-
-CC = avr-gcc
-CXX = avr-g++
-NM = avr-nm
-OBJCOPY = avr-objcopy
-OBJDUMP = avr-objdump
-
-ARCH_SHORTNAME = avr
-
-ifeq (${aspectc}, 1)
- CXX = ag++ -r build/repo.acp -v 0 --c_compiler avr-g++ -p . --Xcompiler
-endif
-
-CXX_TARGETS += src/arch/arduino-nano-168/arch.cc
-CXX_TARGETS += src/arch/arduino-nano-168/driver/gpio.cc
-CXX_TARGETS += src/arch/arduino-nano-168/driver/stdout.cc
-
-# Command-line driver selection
-
-ifneq ($(findstring softi2c,${drivers}), )
-else ifneq ($(findstring i2c,${arch_drivers}), )
- CONFIG_arch_arduino_nano_168_driver_i2c = y
-endif
-
-ifneq ($(findstring adc,${arch_drivers}), )
- CONFIG_arch_arduino_nano_168_driver_adc = y
-endif
-
-ifneq ($(findstring spi,${arch_drivers}), )
- CONFIG_arch_arduino_nano_168_driver_spi = y
-endif
-
-ifneq ($(findstring stdin,${arch_drivers}), )
- CONFIG_arch_arduino_nano_168_driver_stdin = y
-endif
-
-ifneq ($(findstring timer,${arch_drivers}), )
- CONFIG_arch_arduino_nano_168_driver_timer = y
-endif
-
-ifneq ($(findstring counter,${arch_drivers}), )
- CONFIG_arch_arduino_nano_168_driver_counter = y
-endif
-
-ifneq ($(findstring neopixel,${arch_drivers}), )
- CONFIG_arch_arduino_nano_168_driver_neopixel = y
-endif
-
-ifeq (${timer_s}, 1)
- CONFIG_arch_arduino_nano_168_driver_uptime = y
-endif
-
-# Kconfig driver selection
-
-ifdef CONFIG_arch_arduino_nano_168_driver_i2c
- CXX_TARGETS += src/arch/arduino-nano-168/driver/i2c.cc
-endif
-
-ifdef CONFIG_arch_arduino_nano_168_driver_adc
- CXX_TARGETS += src/arch/arduino-nano-168/driver/adc.cc
-endif
-
-ifdef CONFIG_arch_arduino_nano_168_driver_spi
- CXX_TARGETS += src/arch/arduino-nano-168/driver/spi.cc
-endif
-
-ifdef CONFIG_arch_arduino_nano_168_driver_stdin
- CXX_TARGETS += src/arch/arduino-nano-168/driver/stdin.cc
-endif
-
-ifdef CONFIG_arch_arduino_nano_168_driver_timer
- CXX_TARGETS += src/arch/arduino-nano-168/driver/timer.cc
-endif
-
-ifdef CONFIG_arch_arduino_nano_168_driver_counter
- CXX_TARGETS += src/arch/arduino-nano-168/driver/counter.cc
-endif
-
-ifdef CONFIG_arch_arduino_nano_168_driver_neopixel
- CXX_TARGETS += src/arch/arduino-nano-168/driver/neopixel.cc
-endif
-
-ifdef CONFIG_arch_arduino_nano_168_driver_uptime
- COMMON_FLAGS += -DTIMER_S
- CXX_TARGETS += src/arch/arduino-nano-168/driver/uptime.cc
-endif
-
-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
- uart_baud = 9600
-endif
-
-COMMON_FLAGS += -DBAUD=${uart_baud}UL
-
-OBJECTS = ${CXX_TARGETS:.cc=.o} ${C_TARGETS:.c=.o}
-
-.cc.o:
- ${QUIET}${CXX} ${INCLUDES} ${COMMON_FLAGS} ${CXXFLAGS} -c -o $@ ${@:.o=.cc}
-
-.c.o:
- ${QUIET}${CC} ${INCLUDES} ${COMMON_FLAGS} ${CFLAGS} -c -o $@ ${@:.o=.c}
-
-build/system.elf: ${OBJECTS}
- ${QUIET}mkdir -p build
- ${QUIET}${CXX} ${COMMON_FLAGS} ${CXXFLAGS} -Wl,--gc-sections -o $@ ${OBJECTS}
- ${QUIET}avr-size --format=avr --mcu=${MCU} $@
- ${QUIET}test $$(avr-size --format=avr --mcu=${MCU} build/system.elf | fgrep Program | grep -o '[0-9.]*%' | cut -d . -f 1) -lt 100
-
-build/system.hex: build/system.elf
- ${QUIET}${OBJCOPY} -O ihex ${@:.hex=.elf} $@
-
-program: build/system.hex
- ${QUIET}avrdude -p ${MCU} -c arduino -P ${SERIAL_PORT} -b ${BAUD} -U flash:w:build/system.hex
-
-arch_clean:
- ${QUIET}rm -f ${OBJECTS} build/system.hex
-
-monitor:
- ${QUIET}screen ${SERIAL_PORT} ${uart_baud}
-
-arch_help:
- @echo "arduino-nano specific flags:"
- @echo " SERIAL_PORT = ${SERIAL_PORT}"
- @echo " BAUD = ${BAUD} (only used for programming)"
-
-arch_info:
- @echo "CPU Freq: ${cpu_freq} Hz"
- @echo "Timer Freq: ${timer_freq} Hz"
- @echo "I2C Freq: ${i2c_freq} Hz"
- @echo "Counter Overflow: 65536/255"
- @echo "Monitor: ${SERIAL_PORT} ${uart_baud}"
-
-.PHONY: arch_clean arch_help arch_info monitor program
diff --git a/src/arch/arduino-nano-168/arch.cc b/src/arch/arduino-nano-168/arch.cc
deleted file mode 120000
index 808ad49..0000000
--- a/src/arch/arduino-nano-168/arch.cc
+++ /dev/null
@@ -1 +0,0 @@
-../arduino-nano/arch.cc \ No newline at end of file
diff --git a/src/arch/arduino-nano-168/driver b/src/arch/arduino-nano-168/driver
deleted file mode 120000
index d402f72..0000000
--- a/src/arch/arduino-nano-168/driver
+++ /dev/null
@@ -1 +0,0 @@
-../arduino-nano/driver \ No newline at end of file
diff --git a/src/arch/arduino-nano-168/prompt b/src/arch/arduino-nano-168/prompt
deleted file mode 100644
index 88c9b61..0000000
--- a/src/arch/arduino-nano-168/prompt
+++ /dev/null
@@ -1 +0,0 @@
-Arduino Nano (Mega168)
diff --git a/src/arch/arduino-nano/Kconfig b/src/arch/arduino-nano/Kconfig
index 7054d44..39de647 100644
--- a/src/arch/arduino-nano/Kconfig
+++ b/src/arch/arduino-nano/Kconfig
@@ -22,7 +22,12 @@ config arch_arduino_nano_driver_timer
bool "Timer with Interrupts"
select meta_driver_timer
+config arch_arduino_nano_mega168
+bool "Cheap Hardware (ATMega168)"
+default n
+
choice arch_arduino_nano_timer1
+
bool "Timer 1"
optional
diff --git a/src/arch/arduino-nano/Makefile.inc b/src/arch/arduino-nano/Makefile.inc
index a3412fb..b1b76f1 100644
--- a/src/arch/arduino-nano/Makefile.inc
+++ b/src/arch/arduino-nano/Makefile.inc
@@ -4,6 +4,11 @@ MCU = atmega328p
SERIAL_PORT ?= /dev/ttyUSB0
BAUD = 57600
+ifdef CONFIG_arch_arduino_nano_mega168
+ MCU = atmega168
+ BAUD = 19200
+endif
+
cpu_freq ?= 16000000
COMMON_FLAGS += -Werror=overflow