diff options
73 files changed, 950 insertions, 191 deletions
@@ -1,6 +1,9 @@ *.o *.su +/.config +/.config.old /build +/Kconfig /src/app/aemr/main.cc /src/app/prototest/nanopb.pb.h /src/app/prototest/nanopb.pb.cc @@ -1,116 +1,206 @@ -default: build/system.elf +# Only load .config when app/arch are not specified on commandline +ifneq (${app}, ) + CONFIG_app = ${app} +else + -include .config +endif + +ifneq (${arch}, ) + CONFIG_arch = ${arch} +endif + +# Make cannot include "foo"/Makefile.inc, so remove quotes from config entries +quote=" +app_dir = $(subst ${quote},,${CONFIG_app}) +arch_dir = $(subst ${quote},,${CONFIG_arch}) -INCLUDES = -Iinclude -Iinclude/arch/${arch} +INCLUDES = -Iinclude -Iinclude/arch/${arch_dir} COMMON_FLAGS = -g -Os -Wall -Wextra CFLAGS = -std=c99 CXXFLAGS = -std=c++14 -fno-rtti -fno-threadsafe-statics -fno-exceptions +QUIET = @ + ASM_TARGETS = C_TARGETS = -CXX_TARGETS = src/app/${app}/main.cc src/os/object/cpp_helpers.cc src/os/object/outputstream.cc - -QUIET = @ +CXX_TARGETS = src/app/${app_dir}/main.cc src/os/object/cpp_helpers.cc src/os/object/outputstream.cc -ifneq (${verbose}, ) +ifdef verbose QUIET = endif +ifneq (${app_dir}, ) + include src/app/${app_dir}/Makefile.inc +endif + ifneq (${stack_usage}, ) COMMON_FLAGS += -fstack-usage endif -ifneq (${app}, ) - include src/app/${app}/Makefile.inc -endif +# Allow .config driver entries to be overriddenvia commandline / environment ifneq ($(findstring dummy,${drivers}), ) + CONFIG_driver_dummy = y +endif + +ifneq ($(findstring lm75,${drivers}), ) + CONFIG_driver_lm75 = y +endif + +ifneq ($(findstring s5851a,${drivers}), ) + CONFIG_driver_s5851a = y +endif + +ifneq ($(findstring am2320,${drivers}), ) + CONFIG_driver_am2320 = y +endif + +ifneq ($(findstring bme280,${drivers}), ) + CONFIG_driver_bme280 = y +endif + +ifneq ($(findstring bme680,${drivers}), ) + CONFIG_driver_bme680 = y +endif + +ifneq ($(findstring ccs811,${drivers}), ) + CONFIG_driver_ccs811 = y +endif + +ifneq ($(findstring eeprom24lc64,${drivers}), ) + CONFIG_driver_eeprom24lc64 = y +endif + +ifneq ($(findstring max44006,${drivers}), ) + CONFIG_driver_max44006 = y +endif + +ifneq ($(findstring max44009,${drivers}), ) + CONFIG_driver_max44009 = y +endif + +ifneq ($(findstring hdc1080,${drivers}), ) + CONFIG_driver_hdc1080 = y +endif + +ifneq ($(findstring mpu9250,${drivers}), ) + CONFIG_driver_mpu9250 = y +endif + +ifneq ($(findstring mmsimple,${drivers}), ) + CONFIG_driver_mmsimple = y +endif + +ifneq ($(findstring mmsubstate,${drivers}), ) + CONFIG_driver_mmsubstate = y +endif + +ifneq ($(findstring nrf24l01,${drivers}), ) + CONFIG_driver_nrf24l01 = y +endif + +ifneq ($(findstring sharp96,${drivers}), ) + CONFIG_driver_sharp96 = y +endif + +ifneq ($(findstring resistive_load,${drivers}), ) + CONFIG_driver_resistive_load = y +endif + +ifneq ($(findstring softi2c,${drivers}), ) + CONFIG_driver_softi2c = y +endif + +# Load drivers + +ifdef CONFIG_driver_dummy CXX_TARGETS += src/driver/dummy.cc COMMON_FLAGS += -DDRIVER_DUMMY endif -ifneq ($(findstring lm75,${drivers}), ) +ifdef CONFIG_driver_lm75 CXX_TARGETS += src/driver/lm75.cc COMMON_FLAGS += -DDRIVER_LM75 endif -ifneq ($(findstring s5851a,${drivers}), ) +ifdef CONFIG_driver_s5851a CXX_TARGETS += src/driver/s5851a.cc COMMON_FLAGS += -DDRIVER_S5851A endif -ifneq ($(findstring am2320,${drivers}), ) +ifdef CONFIG_driver_am2320 CXX_TARGETS += src/driver/am2320.cc COMMON_FLAGS += -DDRIVER_AM2320 endif -ifneq ($(findstring bme280,${drivers}), ) +ifdef CONFIG_driver_bme280 CXX_TARGETS += src/driver/bme280.cc src/driver/bme680_util.cc COMMON_FLAGS += -DDRIVER_BME280 endif -ifneq ($(findstring bme680,${drivers}), ) +ifdef CONFIG_driver_bme680 CXX_TARGETS += src/driver/bme680.cc src/driver/bme680_util.cc COMMON_FLAGS += -DDRIVER_BME680 endif -ifneq ($(findstring ccs811,${drivers}), ) +ifdef CONFIG_driver_ccs811 CXX_TARGETS += src/driver/ccs811.cc COMMON_FLAGS += -DDRIVER_CCS811 endif -ifneq ($(findstring eeprom24lc64,${drivers}), ) +ifdef CONFIG_driver_eeprom24lc64 CXX_TARGETS += src/driver/eeprom24lc64.cc COMMON_FLAGS += -DDRIVER_EEPROM24LC64 endif -ifneq ($(findstring max44006,${drivers}), ) +ifdef CONFIG_driver_max44006 CXX_TARGETS += src/driver/max44006.cc COMMON_FLAGS += -DDRIVER_MAX44006 endif -ifneq ($(findstring max44009,${drivers}), ) +ifdef CONFIG_driver_max44009 CXX_TARGETS += src/driver/max44009.cc COMMON_FLAGS += -DDRIVER_MAX44009 endif -ifneq ($(findstring hdc1080,${drivers}), ) +ifdef CONFIG_driver_hdc1080 CXX_TARGETS += src/driver/hdc1080.cc COMMON_FLAGS += -DDRIVER_HDC1080 endif -ifneq ($(findstring mpu9250,${drivers}), ) +ifdef CONFIG_driver_mpu9250 CXX_TARGETS += src/driver/mpu9250.cc COMMON_FLAGS += -DDRIVER_MPU9250 endif -ifneq ($(findstring mmsimple,${drivers}), ) +ifdef CONFIG_driver_mmsimple CXX_TARGETS += src/driver/mmsimple.cc COMMON_FLAGS += -DDRIVER_MMSIMPLE endif -ifneq ($(findstring mmsubstate,${drivers}), ) +ifdef CONFIG_driver_mmsubstate CXX_TARGETS += src/driver/mmsubstate.cc COMMON_FLAGS += -DDRIVER_MMSUBSTATE endif -ifneq ($(findstring nrf24l01,${drivers}), ) +ifdef CONFIG_driver_nrf24l01 CXX_TARGETS += src/driver/nrf24l01.cc - ifeq (${arch}, msp430fr5994lp) + ifeq (${arch_dir}, msp430fr5994lp) nrf24l01_cs_pin ?= p1_3 nrf24l01_en_pin ?= p6_2 nrf24l01_irq_pin ?= p8_3 endif - ifeq (${arch}, msp430fr5969lp) + ifeq (${arch_dir}, msp430fr5969lp) nrf24l01_en_pin ?= p4_3 nrf24l01_cs_pin ?= p2_4 nrf24l01_irq_pin ?= p1_5 endif - ifeq (${arch}, arduino-nano) + ifeq (${arch_dir}, arduino-nano) nrf24l01_en_pin ?= pc1 nrf24l01_cs_pin ?= pc0 nrf24l01_irq_pin ?= pc2 endif - ifeq (${arch}, arduino-nano-168) + ifeq (${arch_dir}, arduino-nano-168) nrf24l01_en_pin ?= pc1 nrf24l01_cs_pin ?= pc0 nrf24l01_irq_pin ?= pc2 @@ -121,19 +211,19 @@ ifneq ($(findstring nrf24l01,${drivers}), ) COMMON_FLAGS += -DNRF24L01_IRQ_PIN=GPIO::${nrf24l01_irq_pin} endif -ifneq ($(findstring sharp96,${drivers}), ) +ifdef CONFIG_driver_sharp96 CXX_TARGETS += src/driver/sharp96.cc - ifeq (${arch}, msp430fr5969lp) + ifeq (${arch_dir}, msp430fr5969lp) sharp96_power_pin ?= p4_2 sharp96_en_pin ?= p4_3 sharp96_cs_pin ?= p2_4 endif - ifeq (${arch}, msp430fr5994lp) + ifeq (${arch_dir}, msp430fr5994lp) sharp96_power_pin ?= p1_2 sharp96_en_pin ?= p6_2 sharp96_cs_pin ?= p1_3 endif - ifeq (${arch}, msp430fr5994lp-256k) + ifeq (${arch_dir}, msp430fr5994lp-256k) sharp96_power_pin ?= p1_2 sharp96_en_pin ?= p6_2 sharp96_cs_pin ?= p1_3 @@ -144,7 +234,7 @@ ifneq ($(findstring sharp96,${drivers}), ) COMMON_FLAGS += -DSHARP96_CS_PIN=GPIO::${sharp96_cs_pin} endif -ifneq ($(findstring resistive_load,${drivers}), ) +ifdef CONFIG_driver_resistive_load CXX_TARGETS += src/driver/resistive_load.cc resistor1_pin ?= p3_0 resistor2_pin ?= p3_1 @@ -157,17 +247,25 @@ ifneq ($(findstring resistive_load,${drivers}), ) COMMON_FLAGS += -DRESISTIVE_LOAD_PIN4=GPIO::${resistor4_pin} endif -ifneq ($(findstring softi2c,${drivers}), ) +ifdef CONFIG_driver_softi2c CXX_TARGETS += src/driver/soft_i2c.cc COMMON_FLAGS += -DDRIVER_SOFTI2C endif +# Configure drivers (TODO: Kconfig) + ifneq (${i2c_freq}, ) - COMMON_FLAGS += -DF_I2C=${i2c_freq} + CONFIG_i2c_freq = ${i2c_freq} +endif +ifdef CONFIG_i2c_freq + COMMON_FLAGS += -DF_I2C=${CONFIG_i2c_freq} endif ifneq (${timer_freq}, ) - COMMON_FLAGS += -DF_TIMER=${timer_freq} + CONFIG_timer_freq = ${timer_freq} +endif +ifdef CONFIG_timer_freq + COMMON_FLAGS += -DF_TIMER=${CONFIG_timer_freq} endif ifeq (${softi2c_pullup}, internal) @@ -191,43 +289,42 @@ ifeq (${softi2c_timer}, 1) COMMON_FLAGS += -DSOFTI2C_TIMER endif -ifeq (${kout_nop}, 1) - COMMON_FLAGS += -DKOUT_NOP -endif - -ifeq (${timer_cycles}, 1) - COMMON_FLAGS += -DTIMER_CYCLES -endif - ifeq (${timer_us}, 1) COMMON_FLAGS += -DTIMER_US endif -ifeq (${timer_s}, 1) - COMMON_FLAGS += -DTIMER_S -endif - ifeq (${loop}, 1) COMMON_FLAGS += -DWITH_LOOP endif +ifdef CONFIG_loop + COMMON_FLAGS += -DWITH_LOOP +endif ifeq (${wakeup}, 1) COMMON_FLAGS += -DWITH_WAKEUP endif +ifdef CONFIG_wakeup + COMMON_FLAGS += -DWITH_WAKEUP +endif ifeq (${ostream}, 1) COMMON_FLAGS += -DWITH_OSTREAM endif +ifdef CONFIG_ostream + COMMON_FLAGS += -DWITH_OSTREAM +endif ifeq (${trace_malloc}, 1) CXX_TARGETS += src/lib/mpmalloc.cc COMMON_FLAGS += -DMULTIPASS_TRACE_MALLOC endif -ifneq (${arch}, ) - include src/arch/${arch}/Makefile.inc +ifneq (${arch_dir}, ) + include src/arch/${arch_dir}/Makefile.inc endif +default: build/system.elf + stack: default ${QUIET}test -n "${OBJDUMP}" ${QUIET}test -n "${ARCH_SHORTNAME}" @@ -238,13 +335,19 @@ stackm: default ${QUIET}test -n "${ARCH_SHORTNAME}" ${QUIET}script/static-stack-analyze.pl --machine-readable ${OBJDUMP} ${ARCH_SHORTNAME} ${OBJECTS} +Kconfig: script/mkconfig + ${QUIET}script/mkconfig > Kconfig + +config: Kconfig + ${QUIET}kconfig-qconf Kconfig + clean: arch_clean rm -f build/system.elf help: arch_help @echo @echo "common flags:" - @echo " timer_cycles timer_us timer_s -- enable specific timers. May be mutually exclusive" + @echo " timer_us timer_s -- enable specific timers. May be mutually exclusive" @echo " loop -- enable loop() function" @echo " i2c_freq -- I2C Frequency in Hz" @echo " timer_freq -- Timer frequency in Hz" @@ -260,8 +363,8 @@ help: arch_help @echo " trace_malloc -- trace mpmalloc/mpcalloc/mprealloc calls on stdout" @echo " stack_usage -- Generate .su files for stack usage estimation (-> make stack)" @echo - @echo "${arch} drivers:" - @ls -1 src/arch/${arch}/driver | fgrep .c | cut -d . -f 1 | sed 's/^/ /' + @echo "${arch_dir} drivers:" + @ls -1 src/arch/${arch_dir}/driver | fgrep .c | cut -d . -f 1 | sed 's/^/ /' @echo @echo "common drivers:" @ls -1 src/driver | fgrep .c | cut -d . -f 1 | sed 's/^/ /' @@ -275,4 +378,4 @@ info: arch_info @echo "CXXFLAGS: ${CXXFLAGS}" @echo "Selected (common/arch) drivers: ${drivers} / ${arch_drivers}" -.PHONY: clean default stack stackm help info +.PHONY: clean config default stack stackm help info diff --git a/script/mkconfig b/script/mkconfig new file mode 100755 index 0000000..b6d50a3 --- /dev/null +++ b/script/mkconfig @@ -0,0 +1,92 @@ +#!/bin/sh + +cat <<EOF + +menu "System" + +config loop +bool "Regularly call loop()" + +config wakeup +bool "Call wakeup() on wakeup" + +config ostream +bool "C++ ostream support in stdout" + +config i2c_freq +int "I2C Frequency [Hz]" +range 1000 100000 +default 100000 +depends on meta_driver_i2c + +config timer_freq +int "Timer Frequency" +range 1 10000 +default 10 +depends on meta_driver_timer + +endmenu + +choice Architecture +bool "Architecture" + +EOF + +for arch in $(ls -1 src/arch); do + echo config arch_${arch} | tr - _ + echo bool '"'"$(cat src/arch/${arch}/prompt)"'"' + echo +done + +echo endchoice +echo + +for arch in $(ls -1 src/arch); do + echo config arch + echo string + echo default '"'"${arch}"'"' + echo depends on arch_${arch} | tr - _ + echo +done + +for arch in $(ls -1 src/arch); do + if [ -e "src/arch/${arch}/Kconfig" ]; then + echo menu '"'"$(cat src/arch/${arch}/prompt) Configuration"'"' + echo depends on arch_${arch} | tr - _ + echo + cat "src/arch/${arch}/Kconfig" + echo + echo endmenu + echo + fi +done + +cat <<EOF +choice Application +bool "Application" + +EOF + +for app in $(ls -1 src/app); do + echo config app_${app} | tr - _ + if [ -e "src/app/${app}/Kconfig" ]; then + echo bool + cat src/app/${app}/Kconfig + else + echo bool '"'${app}'"' + fi + echo +done + +echo endchoice +echo + +for app in $(ls -1 src/app); do + echo config app + echo string + echo default '"'"${app}"'"' + echo depends on app_${app} | tr - _ + echo +done + +cat src/driver/Kconfig diff --git a/src/app/aemr/Kconfig b/src/app/aemr/Kconfig new file mode 100644 index 0000000..9c5fc80 --- /dev/null +++ b/src/app/aemr/Kconfig @@ -0,0 +1,2 @@ +prompt "Automatic Energy Model Refinement" +depends on !loop && !wakeup diff --git a/src/app/aemr/Makefile.inc b/src/app/aemr/Makefile.inc index 6e2dda3..7ed7630 100644 --- a/src/app/aemr/Makefile.inc +++ b/src/app/aemr/Makefile.inc @@ -1 +1,3 @@ -override arch_drivers += ,counter +ifdef app + override arch_drivers += ,counter +endif diff --git a/src/app/blinkencat3/Kconfig b/src/app/blinkencat3/Kconfig new file mode 100644 index 0000000..f9230ea --- /dev/null +++ b/src/app/blinkencat3/Kconfig @@ -0,0 +1,2 @@ +prompt "Blinkencat 3" +depends on (arch_arduino_nano || arch_arduino_nano_168) && meta_driver_neopixel && !loop && !wakeup diff --git a/src/app/blinkencat3/Makefile.inc b/src/app/blinkencat3/Makefile.inc index 1bf2b59..2d2d859 100644 --- a/src/app/blinkencat3/Makefile.inc +++ b/src/app/blinkencat3/Makefile.inc @@ -1,2 +1,4 @@ -override loop = 1 -override arch_drivers += ,neopixel +ifdef app + override loop = 1 + override arch_drivers += ,neopixel +endif diff --git a/src/app/button-and-motion-logger/Kconfig b/src/app/button-and-motion-logger/Kconfig new file mode 100644 index 0000000..fe5d888 --- /dev/null +++ b/src/app/button-and-motion-logger/Kconfig @@ -0,0 +1,2 @@ +prompt "Button and Motion Logger" +depends on meta_driver_adc && driver_mpu9250 && !loop && !wakeup diff --git a/src/app/button-and-motion-logger/Makefile.inc b/src/app/button-and-motion-logger/Makefile.inc index f433287..eff5706 100644 --- a/src/app/button-and-motion-logger/Makefile.inc +++ b/src/app/button-and-motion-logger/Makefile.inc @@ -1,2 +1,4 @@ -arch_drivers += ,adc,i2c -override drivers += ,mpu9250 +ifdef app + override arch_drivers += ,adc,i2c + override drivers += ,mpu9250 +endif diff --git a/src/app/ccs811test/Kconfig b/src/app/ccs811test/Kconfig new file mode 100644 index 0000000..a219a0f --- /dev/null +++ b/src/app/ccs811test/Kconfig @@ -0,0 +1,2 @@ +prompt "CCS811 Logger" +depends on driver_ccs811 && loop && !wakeup diff --git a/src/app/ccs811test/Makefile.inc b/src/app/ccs811test/Makefile.inc index 4889e55..6bc097a 100644 --- a/src/app/ccs811test/Makefile.inc +++ b/src/app/ccs811test/Makefile.inc @@ -1,3 +1,5 @@ -override arch_drivers += ,i2c -override drivers += ,ccs811 -loop ?= 1 +ifdef app + override arch_drivers += ,i2c + override drivers += ,ccs811 + override loop = 1 +endif diff --git a/src/app/countertest/Kconfig b/src/app/countertest/Kconfig new file mode 100644 index 0000000..141c3f6 --- /dev/null +++ b/src/app/countertest/Kconfig @@ -0,0 +1,2 @@ +prompt "Cycle Counter Test" +depends on meta_driver_counter && loop && !wakeup diff --git a/src/app/countertest/Makefile.inc b/src/app/countertest/Makefile.inc index f8a5514..0bf380e 100644 --- a/src/app/countertest/Makefile.inc +++ b/src/app/countertest/Makefile.inc @@ -1,2 +1,4 @@ -loop ?= 1 -override arch_drivers += ,counter +ifdef app + override loop = 1 + override arch_drivers += ,counter +endif diff --git a/src/app/donothing/Makefile.inc b/src/app/donothing/Makefile.inc index 0608a82..bf22978 100644 --- a/src/app/donothing/Makefile.inc +++ b/src/app/donothing/Makefile.inc @@ -1,3 +1,4 @@ -timer_cycles = 0 -timer_s = 0 -loop = 0 +ifdef app + override timer_s = 0 + override loop = 0 +endif diff --git a/src/app/i2cbench/Makefile.inc b/src/app/i2cbench/Makefile.inc index 15ce127..c5241fd 100644 --- a/src/app/i2cbench/Makefile.inc +++ b/src/app/i2cbench/Makefile.inc @@ -1,4 +1,6 @@ -arch_drivers += ,i2c +ifdef app + override arch_drivers += ,i2c +endif ifneq (${i2cbench_setos}, ) COMMON_FLAGS += -DI2CBENCH_SETOS=${i2cbench_setos} diff --git a/src/app/i2cdetect/Kconfig b/src/app/i2cdetect/Kconfig new file mode 100644 index 0000000..d0415f0 --- /dev/null +++ b/src/app/i2cdetect/Kconfig @@ -0,0 +1,2 @@ +prompt "I2C Bus Scanner" +depends on meta_driver_i2c diff --git a/src/app/i2cdetect/Makefile.inc b/src/app/i2cdetect/Makefile.inc index 7620800..c76489c 100644 --- a/src/app/i2cdetect/Makefile.inc +++ b/src/app/i2cdetect/Makefile.inc @@ -1,3 +1,4 @@ -arch_drivers += ,i2c -drivers += ,lm75 -loop ?= 1 +ifdef app + override loop = 1 + override arch_drivers += ,i2c +endif diff --git a/src/app/ledblink/Kconfig b/src/app/ledblink/Kconfig new file mode 100644 index 0000000..0075bf8 --- /dev/null +++ b/src/app/ledblink/Kconfig @@ -0,0 +1,2 @@ +prompt "LED Blink" +depends on loop && !wakeup diff --git a/src/app/ledblink/Makefile.inc b/src/app/ledblink/Makefile.inc index 2cb8a42..ec71d40 100644 --- a/src/app/ledblink/Makefile.inc +++ b/src/app/ledblink/Makefile.inc @@ -1 +1,3 @@ -loop ?= 1 +ifdef app + override loop = 1 +endif diff --git a/src/app/loratest/Makefile.inc b/src/app/loratest/Makefile.inc index 2cb8a42..ec71d40 100644 --- a/src/app/loratest/Makefile.inc +++ b/src/app/loratest/Makefile.inc @@ -1 +1,3 @@ -loop ?= 1 +ifdef app + override loop = 1 +endif diff --git a/src/app/luxlog/Kconfig b/src/app/luxlog/Kconfig new file mode 100644 index 0000000..6e1c6e6 --- /dev/null +++ b/src/app/luxlog/Kconfig @@ -0,0 +1,2 @@ +prompt "Ambient Brightness Logger" +depends on driver_max44009 diff --git a/src/app/luxlog/Makefile.inc b/src/app/luxlog/Makefile.inc index bcee1d0..a0cbcd8 100644 --- a/src/app/luxlog/Makefile.inc +++ b/src/app/luxlog/Makefile.inc @@ -1,3 +1,5 @@ -arch_drivers += ,i2c -drivers += ,max44009 -loop ?= 1 +ifdef app + override loop = 1 + override arch_drivers += ,i2c + override drivers += ,max44009 +endif diff --git a/src/app/mpu9250_motionlog/Kconfig b/src/app/mpu9250_motionlog/Kconfig new file mode 100644 index 0000000..27d605f --- /dev/null +++ b/src/app/mpu9250_motionlog/Kconfig @@ -0,0 +1,2 @@ +prompt "Motion Logger" +depends on driver_mpu9250 diff --git a/src/app/mpu9250_motionlog/Makefile.inc b/src/app/mpu9250_motionlog/Makefile.inc index 5da92be..ed959ca 100644 --- a/src/app/mpu9250_motionlog/Makefile.inc +++ b/src/app/mpu9250_motionlog/Makefile.inc @@ -1,2 +1,4 @@ -arch_drivers += ,i2c -override drivers += ,mpu9250 +ifdef app + override arch_drivers += ,i2c + override drivers += ,mpu9250 +endif diff --git a/src/app/nrf24l01test/Makefile.inc b/src/app/nrf24l01test/Makefile.inc index 6713ddb..f84bcbd 100644 --- a/src/app/nrf24l01test/Makefile.inc +++ b/src/app/nrf24l01test/Makefile.inc @@ -1,6 +1,8 @@ -override drivers += ,nrf24l01 -timer_s ?= 1 -loop ?= 1 +ifdef app + override loop = 1 + override timer_s = 1 + override drivers += ,nrf24l01 +endif ifeq (${tx}, 1) COMMON_FLAGS += -DNRF24L01TEST_TX diff --git a/src/app/sharp96test/Kconfig b/src/app/sharp96test/Kconfig new file mode 100644 index 0000000..30b9ac3 --- /dev/null +++ b/src/app/sharp96test/Kconfig @@ -0,0 +1,2 @@ +prompt "Sharp96 Test" +depends on driver_sharp96 diff --git a/src/app/sharp96test/Makefile.inc b/src/app/sharp96test/Makefile.inc index 4dbcaca..37bb857 100644 --- a/src/app/sharp96test/Makefile.inc +++ b/src/app/sharp96test/Makefile.inc @@ -1 +1,5 @@ -driver_sharp96 ?= 1 +ifdef app + override loop = 1 + override arch_drivers += spi_b + override drivers += sharp96 +endif diff --git a/src/app/shell/Kconfig b/src/app/shell/Kconfig new file mode 100644 index 0000000..a4626d6 --- /dev/null +++ b/src/app/shell/Kconfig @@ -0,0 +1,2 @@ +prompt "Shell / UART Echo" +depends on meta_driver_stdin && wakeup diff --git a/src/app/shell/Makefile.inc b/src/app/shell/Makefile.inc index 66d80ec..3d73351 100644 --- a/src/app/shell/Makefile.inc +++ b/src/app/shell/Makefile.inc @@ -1,2 +1,5 @@ -arch_drivers += ,stdin -wakeup ?= 1 +ifdef app + override loop = 0 + override wakeup = 1 + override arch_drivers += ,stdin +endif diff --git a/src/app/shell/main.cc b/src/app/shell/main.cc index 33896e4..0a7d4ca 100644 --- a/src/app/shell/main.cc +++ b/src/app/shell/main.cc @@ -2,7 +2,6 @@ #include "driver/gpio.h" #include "driver/stdout.h" #include "driver/stdin.h" -#include "driver/uptime.h" /* void check_command(unsigned char argc, char** argv) diff --git a/src/app/sysinfo/Makefile.inc b/src/app/sysinfo/Makefile.inc index 4cc2151..ec71d40 100644 --- a/src/app/sysinfo/Makefile.inc +++ b/src/app/sysinfo/Makefile.inc @@ -1 +1,3 @@ -loop = 1 +ifdef app + override loop = 1 +endif diff --git a/src/app/timertest/Makefile.inc b/src/app/timertest/Makefile.inc index 9d375f1..9754020 100644 --- a/src/app/timertest/Makefile.inc +++ b/src/app/timertest/Makefile.inc @@ -1,3 +1,5 @@ -loop ?= 1 -timer_s ?= 1 -arch_drivers += ,timer +ifdef app + override loop = 1 + override timer_s = 1 + override arch_drivers += ,timer +endif diff --git a/src/app/transactiontest/Makefile.inc b/src/app/transactiontest/Makefile.inc index 63d2323..25d4378 100644 --- a/src/app/transactiontest/Makefile.inc +++ b/src/app/transactiontest/Makefile.inc @@ -1,7 +1,6 @@ -timer_cycles ?= 1 -timer_s ?= 1 -loop ?= 1 +ifdef app + override loop = 1 + override timer_s = 1 +endif -driver_sharp96 ?= 1 - -ASM_TARGETS += src/app/transactiontest/util.S
\ No newline at end of file +ASM_TARGETS += src/app/transactiontest/util.S diff --git a/src/app/waittest/Makefile.inc b/src/app/waittest/Makefile.inc index 9d375f1..9754020 100644 --- a/src/app/waittest/Makefile.inc +++ b/src/app/waittest/Makefile.inc @@ -1,3 +1,5 @@ -loop ?= 1 -timer_s ?= 1 -arch_drivers += ,timer +ifdef app + override loop = 1 + override timer_s = 1 + override arch_drivers += ,timer +endif diff --git a/src/app/wetterstation/Kconfig b/src/app/wetterstation/Kconfig new file mode 100644 index 0000000..691784c --- /dev/null +++ b/src/app/wetterstation/Kconfig @@ -0,0 +1,2 @@ +prompt "Wetterstation" +depends on meta_driver_adc && (arch_arduino_nano || arch_arduino_nano_168) diff --git a/src/app/wetterstation/Makefile.inc b/src/app/wetterstation/Makefile.inc index 2cb8a42..ec71d40 100644 --- a/src/app/wetterstation/Makefile.inc +++ b/src/app/wetterstation/Makefile.inc @@ -1 +1,3 @@ -loop ?= 1 +ifdef app + override loop = 1 +endif diff --git a/src/app/ws2812b_dmap/Makefile.inc b/src/app/ws2812b_dmap/Makefile.inc index ce0a386..a515d32 100644 --- a/src/app/ws2812b_dmap/Makefile.inc +++ b/src/app/ws2812b_dmap/Makefile.inc @@ -1,2 +1,4 @@ -loop ?= 1 -arch_drivers += ,stdin,neopixel +ifdef app + override loop = 1 + override arch_drivers += ,stdin,neopixel +endif diff --git a/src/app/ws2812b_uart/Kconfig b/src/app/ws2812b_uart/Kconfig new file mode 100644 index 0000000..7566e4c --- /dev/null +++ b/src/app/ws2812b_uart/Kconfig @@ -0,0 +1,2 @@ +prompt "UART to WS2812b" +depends on (arch_arduino_nano || arch_arduino_nano_168) && meta_driver_neopixel diff --git a/src/app/ws2812b_uart/Makefile.inc b/src/app/ws2812b_uart/Makefile.inc index ce0a386..a515d32 100644 --- a/src/app/ws2812b_uart/Makefile.inc +++ b/src/app/ws2812b_uart/Makefile.inc @@ -1,2 +1,4 @@ -loop ?= 1 -arch_drivers += ,stdin,neopixel +ifdef app + override loop = 1 + override arch_drivers += ,stdin,neopixel +endif diff --git a/src/arch/arduino-nano-168/Kconfig b/src/arch/arduino-nano-168/Kconfig new file mode 100644 index 0000000..0d8b25c --- /dev/null +++ b/src/arch/arduino-nano-168/Kconfig @@ -0,0 +1,37 @@ +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 index 844fc1d..21ccf2f 100644 --- a/src/arch/arduino-nano-168/Makefile.inc +++ b/src/arch/arduino-nano-168/Makefile.inc @@ -27,38 +27,78 @@ ifeq (${aspectc}, 1) CXX = ag++ -r build/repo.acp -v 0 --c_compiler avr-g++ -p . --Xcompiler endif -CXX_TARGETS += src/arch/arduino-nano/arch.cc -CXX_TARGETS += src/arch/arduino-nano/driver/gpio.cc -CXX_TARGETS += src/arch/arduino-nano/driver/stdout.cc -CXX_TARGETS += src/arch/arduino-nano/driver/uptime.cc +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}), ) - CXX_TARGETS += src/arch/arduino-nano/driver/i2c.cc + CONFIG_arch_arduino_nano_168_driver_i2c = y endif ifneq ($(findstring adc,${arch_drivers}), ) - CXX_TARGETS += src/arch/arduino-nano/driver/adc.cc + CONFIG_arch_arduino_nano_168_driver_adc = y endif ifneq ($(findstring spi,${arch_drivers}), ) - CXX_TARGETS += src/arch/arduino-nano/driver/spi.cc + CONFIG_arch_arduino_nano_168_driver_spi = y endif ifneq ($(findstring stdin,${arch_drivers}), ) - CXX_TARGETS += src/arch/arduino-nano/driver/stdin.cc + CONFIG_arch_arduino_nano_168_driver_stdin = y endif ifneq ($(findstring timer,${arch_drivers}), ) - CXX_TARGETS += src/arch/arduino-nano/driver/timer.cc + CONFIG_arch_arduino_nano_168_driver_timer = y endif ifneq ($(findstring counter,${arch_drivers}), ) - CXX_TARGETS += src/arch/arduino-nano/driver/counter.cc + CONFIG_arch_arduino_nano_168_driver_counter = y endif ifneq ($(findstring neopixel,${arch_drivers}), ) - CXX_TARGETS += src/arch/arduino-nano/driver/neopixel.cc + 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) diff --git a/src/arch/arduino-nano-168/prompt b/src/arch/arduino-nano-168/prompt new file mode 100644 index 0000000..88c9b61 --- /dev/null +++ b/src/arch/arduino-nano-168/prompt @@ -0,0 +1 @@ +Arduino Nano (Mega168) diff --git a/src/arch/arduino-nano/Kconfig b/src/arch/arduino-nano/Kconfig new file mode 100644 index 0000000..7054d44 --- /dev/null +++ b/src/arch/arduino-nano/Kconfig @@ -0,0 +1,37 @@ +config arch_arduino_nano_driver_adc +bool "ADC (Analog-Digital-Converter)" +select meta_driver_adc + +config arch_arduino_nano_driver_i2c +bool "I2C" +select meta_driver_i2c + +config arch_arduino_nano_driver_neopixel +bool "WS2812b (NeoPixel)" +select meta_driver_neopixel + +config arch_arduino_nano_driver_spi +bool "SPI" +select meta_driver_spi + +config arch_arduino_nano_driver_stdin +bool "UART Input" +select meta_driver_stdin + +config arch_arduino_nano_driver_timer +bool "Timer with Interrupts" +select meta_driver_timer + +choice arch_arduino_nano_timer1 +bool "Timer 1" +optional + +config arch_arduino_nano_driver_uptime +bool "Uptime Counter" +select meta_driver_uptime + +config arch_arduino_nano_driver_counter +bool "Cycle Counter" +select meta_driver_counter + +endchoice diff --git a/src/arch/arduino-nano/Makefile.inc b/src/arch/arduino-nano/Makefile.inc index 5445bc1..a3412fb 100644 --- a/src/arch/arduino-nano/Makefile.inc +++ b/src/arch/arduino-nano/Makefile.inc @@ -30,37 +30,77 @@ endif CXX_TARGETS += src/arch/arduino-nano/arch.cc CXX_TARGETS += src/arch/arduino-nano/driver/gpio.cc CXX_TARGETS += src/arch/arduino-nano/driver/stdout.cc -CXX_TARGETS += src/arch/arduino-nano/driver/uptime.cc + +# Command-line driver selection ifneq ($(findstring softi2c,${drivers}), ) else ifneq ($(findstring i2c,${arch_drivers}), ) - CXX_TARGETS += src/arch/arduino-nano/driver/i2c.cc + CONFIG_arch_arduino_nano_driver_i2c = y endif ifneq ($(findstring adc,${arch_drivers}), ) - CXX_TARGETS += src/arch/arduino-nano/driver/adc.cc + CONFIG_arch_arduino_nano_driver_adc = y endif ifneq ($(findstring spi,${arch_drivers}), ) - CXX_TARGETS += src/arch/arduino-nano/driver/spi.cc + CONFIG_arch_arduino_nano_driver_spi = y endif ifneq ($(findstring stdin,${arch_drivers}), ) - CXX_TARGETS += src/arch/arduino-nano/driver/stdin.cc + CONFIG_arch_arduino_nano_driver_stdin = y endif ifneq ($(findstring timer,${arch_drivers}), ) - CXX_TARGETS += src/arch/arduino-nano/driver/timer.cc + CONFIG_arch_arduino_nano_driver_timer = y endif ifneq ($(findstring counter,${arch_drivers}), ) - CXX_TARGETS += src/arch/arduino-nano/driver/counter.cc + CONFIG_arch_arduino_nano_driver_counter = y endif ifneq ($(findstring neopixel,${arch_drivers}), ) + CONFIG_arch_arduino_nano_driver_neopixel = y +endif + +ifeq (${timer_s}, 1) + CONFIG_arch_arduino_nano_driver_uptime = y +endif + +# Kconfig driver selection + +ifdef CONFIG_arch_arduino_nano_driver_i2c + CXX_TARGETS += src/arch/arduino-nano/driver/i2c.cc +endif + +ifdef CONFIG_arch_arduino_nano_driver_adc + CXX_TARGETS += src/arch/arduino-nano/driver/adc.cc +endif + +ifdef CONFIG_arch_arduino_nano_driver_spi + CXX_TARGETS += src/arch/arduino-nano/driver/spi.cc +endif + +ifdef CONFIG_arch_arduino_nano_driver_stdin + CXX_TARGETS += src/arch/arduino-nano/driver/stdin.cc +endif + +ifdef CONFIG_arch_arduino_nano_driver_timer + CXX_TARGETS += src/arch/arduino-nano/driver/timer.cc +endif + +ifdef CONFIG_arch_arduino_nano_driver_counter + CXX_TARGETS += src/arch/arduino-nano/driver/counter.cc +endif + +ifdef CONFIG_arch_arduino_nano_driver_neopixel CXX_TARGETS += src/arch/arduino-nano/driver/neopixel.cc endif +ifdef CONFIG_arch_arduino_nano_driver_uptime + COMMON_FLAGS += -DTIMER_S + CXX_TARGETS += src/arch/arduino-nano/driver/uptime.cc +endif + ifeq (${cpu_freq}, 16000000) uart_baud = 57600 else ifeq (${cpu_freq}, 8000000) diff --git a/src/arch/arduino-nano/arch.cc b/src/arch/arduino-nano/arch.cc index 1023927..48b50f8 100644 --- a/src/arch/arduino-nano/arch.cc +++ b/src/arch/arduino-nano/arch.cc @@ -38,11 +38,6 @@ void Arch::setup(void) #error Unsupported F_CPU #endif -#ifdef TIMER_CYCLES - TCCR0A = 0; - TCCR0B = _BV(CS00); -#endif - #if defined(WITH_LOOP) || defined(TIMER_S) TCCR1A = 0; TCCR1B = _BV(WGM12) | _BV(CS12) | _BV(CS10); // /1024 diff --git a/src/arch/arduino-nano/prompt b/src/arch/arduino-nano/prompt new file mode 100644 index 0000000..1994e4c --- /dev/null +++ b/src/arch/arduino-nano/prompt @@ -0,0 +1 @@ +Arduino Nano (Mega328) diff --git a/src/arch/blinkenrocket/Kconfig b/src/arch/blinkenrocket/Kconfig new file mode 100644 index 0000000..5b9a830 --- /dev/null +++ b/src/arch/blinkenrocket/Kconfig @@ -0,0 +1,10 @@ +config arch_blinkenrocket_driver_i2c +bool "I2C" +select meta_driver_i2c + +config arch_blinkenrocket_driver_uptime +bool "Uptime Counter" +select meta_driver_uptime + +config arch_blinkenrocket_kout_nop +bool "Disable UART emulation for stdout" diff --git a/src/arch/blinkenrocket/Makefile.inc b/src/arch/blinkenrocket/Makefile.inc index ea4e183..ba66152 100644 --- a/src/arch/blinkenrocket/Makefile.inc +++ b/src/arch/blinkenrocket/Makefile.inc @@ -22,13 +22,32 @@ endif CXX_TARGETS += src/arch/blinkenrocket/arch.cc CXX_TARGETS += src/arch/blinkenrocket/driver/gpio.cc CXX_TARGETS += src/arch/blinkenrocket/driver/stdout.cc -CXX_TARGETS += src/arch/blinkenrocket/driver/uptime.cc ifneq ($(findstring softi2c,${drivers}), ) else ifneq ($(findstring i2c,${arch_drivers}), ) + CONFIG_arch_blinkenrocket_driver_i2c = y +endif + +ifeq (${timer_s}, 1) + CONFIG_arch_blinkenrocket_driver_uptime = y +endif + +ifdef CONFIG_arch_blinkenrocket_driver_i2c CXX_TARGETS += src/arch/blinkenrocket/driver/i2c.cc endif +ifdef CONFIG_arch_blinkenrocket_driver_uptime + COMMON_FLAGS += -DTIMER_S + CXX_TARGETS += src/arch/blinkenrocket/driver/uptime.cc +endif + +ifeq (${kout_nop}, 1) + COMMON_FLAGS += -DKOUT_NOP +endif +ifdef CONFIG_arch_blinkenrocket_kout_nop + COMMON_FLAGS += -DKOUT_NOP +endif + OBJECTS = ${CXX_TARGETS:.cc=.o} ${C_TARGETS:.c=.o} .cc.o: diff --git a/src/arch/blinkenrocket/arch.cc b/src/arch/blinkenrocket/arch.cc index 1261515..d49bfda 100644 --- a/src/arch/blinkenrocket/arch.cc +++ b/src/arch/blinkenrocket/arch.cc @@ -5,10 +5,6 @@ void Arch::setup(void) { -#ifdef TIMER_CYCLES - TCCR0A = _BV(CS00); -#endif - #if defined(WITH_LOOP) || defined(TIMER_S) TCCR1A = 0; TCCR1B = _BV(WGM12) | _BV(CS12) | _BV(CS10); // /1024 diff --git a/src/arch/blinkenrocket/prompt b/src/arch/blinkenrocket/prompt new file mode 100644 index 0000000..9972aaa --- /dev/null +++ b/src/arch/blinkenrocket/prompt @@ -0,0 +1 @@ +Blinkenrocket diff --git a/src/arch/esp8266/Kconfig b/src/arch/esp8266/Kconfig new file mode 100644 index 0000000..5542dd5 --- /dev/null +++ b/src/arch/esp8266/Kconfig @@ -0,0 +1,11 @@ +config arch_esp8266_driver_counter +bool "Cycle Counter" +select meta_driver_counter + +config arch_esp8266_driver_stdin +bool "UART Input" +select meta_driver_stdin + +config arch_esp8266_driver_uptime +bool "Uptime Counter" +select meta_driver_uptime diff --git a/src/arch/esp8266/Makefile.inc b/src/arch/esp8266/Makefile.inc index c1bb621..44a3cd7 100644 --- a/src/arch/esp8266/Makefile.inc +++ b/src/arch/esp8266/Makefile.inc @@ -22,7 +22,7 @@ CXXFLAGS = -std=c++11 -fno-rtti -fno-threadsafe-statics LDFLAGS += -nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static CXX_TARGETS += src/arch/esp8266/arch.cc src/arch/esp8266/driver/gpio.cc -CXX_TARGETS += src/arch/esp8266/driver/stdout.cc src/arch/esp8266/driver/uptime.cc +CXX_TARGETS += src/arch/esp8266/driver/stdout.cc OBJECTS = ${CXX_TARGETS:.cc=.o} ${C_TARGETS:.c=.o} @@ -30,14 +30,35 @@ ifeq (${esp8266_led2}, 1) COMMON_FLAGS += -DLED_ON_GPIO16 endif +# Commandline + +ifneq ($(findstring counter,${arch_drivers}), ) + CONFIG_arch_esp8266_driver_counter = y +endif + ifneq ($(findstring stdin,${arch_drivers}), ) - CXX_TARGETS += src/arch/esp8266/driver/stdin.cc + CONFIG_arch_esp8266_driver_stdin = y endif -ifneq ($(findstring counter,${arch_drivers}), ) +ifeq (${timer_s}, 1) + CONFIG_arch_esp8266_driver_uptime = y +endif + +# Kconfig + +ifdef CONFIG_arch_esp8266_driver_counter CXX_TARGETS += src/arch/esp8266/driver/counter.cc endif +ifdef CONFIG_arch_esp8266_driver_stdin + CXX_TARGETS += src/arch/esp8266/driver/stdin.cc +endif + +ifdef CONFIG_arch_esp8266_driver_uptime + COMMON_FLAGS += -DTIMER_S + CXX_TARGETS += src/arch/esp8266/driver/uptime.cc +endif + .cc.o: ${QUIET}${CXX} ${INCLUDES} ${COMMON_FLAGS} ${CXXFLAGS} -c -o $@ ${@:.o=.cc} ${QUIET}${OBJCOPY} --rename-section .text=.irom0.text --rename-section .literal=.irom0.literal $@ diff --git a/src/arch/esp8266/prompt b/src/arch/esp8266/prompt new file mode 100644 index 0000000..3428bc3 --- /dev/null +++ b/src/arch/esp8266/prompt @@ -0,0 +1 @@ +ESP8266 diff --git a/src/arch/msp430fr5969lp/Kconfig b/src/arch/msp430fr5969lp/Kconfig new file mode 100644 index 0000000..015d78d --- /dev/null +++ b/src/arch/msp430fr5969lp/Kconfig @@ -0,0 +1,31 @@ +config arch_msp430fr5969lp_driver_adc +bool "ADC (Analog-Digital-Converter)" +select meta_driver_adc + +config arch_msp430fr5969lp_driver_counter +bool "Cycle Counter" +select meta_driver_counter + +config arch_msp430fr5969lp_driver_i2c +bool "I2C on eUSCI_B0" +select meta_driver_i2c + +config arch_msp430fr5969lp_driver_spi_a1 +bool "SPI on eUSCI_A1" +select meta_driver_spi + +config arch_msp430fr5969lp_driver_spi_b +bool "SPI on eUSCI_B0" +select meta_driver_spi + +config arch_msp430fr5969lp_driver_stdin +bool "UART Input" +select meta_driver_stdin + +config arch_msp430fr5969lp_driver_timer +bool "Timer with Interrupts" +select meta_driver_timer + +config arch_msp430fr5969lp_driver_uptime +bool "Uptime Counter" +select meta_driver_uptime diff --git a/src/arch/msp430fr5969lp/Makefile.inc b/src/arch/msp430fr5969lp/Makefile.inc index 2c1e64c..8a48859 100644 --- a/src/arch/msp430fr5969lp/Makefile.inc +++ b/src/arch/msp430fr5969lp/Makefile.inc @@ -25,45 +25,86 @@ SIZE = /opt/msp430/ti/msp430-gcc-full-linux-5.1.2.0/bin/msp430-elf-size ARCH_SHORTNAME = msp430 CXX_TARGETS += src/arch/msp430fr5969lp/arch.cc +CXX_TARGETS += src/arch/msp430fr5969lp/driver/gpio.cc +CXX_TARGETS += src/arch/msp430fr5969lp/driver/stdout.cc ifeq (${aspectc}, 1) CXX = ag++ -r build/repo.acp -v 0 --c_compiler /opt/msp430/ti/msp430-gcc-full-linux-5.1.2.0/bin/msp430-elf-g++ -p . --Xcompiler endif +# Command-line + ifneq ($(findstring adc,${arch_drivers}), ) - CXX_TARGETS += src/arch/msp430fr5969lp/driver/adc.cc + CONFIG_arch_msp430fr5969lp_driver_adc = y endif -CXX_TARGETS += src/arch/msp430fr5969lp/driver/gpio.cc -CXX_TARGETS += src/arch/msp430fr5969lp/driver/stdout.cc -CXX_TARGETS += src/arch/msp430fr5969lp/driver/uptime.cc - ifneq ($(findstring stdin,${arch_drivers}), ) - CXX_TARGETS += src/arch/msp430fr5969lp/driver/stdin.cc + CONFIG_arch_msp430fr5969lp_driver_stdin = y endif ifneq ($(findstring softi2c,${drivers}), ) else ifneq ($(findstring i2c,${arch_drivers}), ) + CONFIG_arch_msp430fr5969lp_driver_i2c = y +endif + +ifneq ($(findstring spi_a1,${arch_drivers}), ) + CONFIG_arch_msp430fr5969lp_driver_spi_a1 = y +endif + +ifneq ($(findstring spi_b,${arch_drivers}), ) + CONFIG_arch_msp430fr5969lp_driver_spi_b = y +endif + +ifneq ($(findstring timer,${arch_drivers}), ) + CONFIG_arch_msp430fr5969lp_driver_timer = y +endif + +ifneq ($(findstring counter,${arch_drivers}), ) + CONFIG_arch_msp430fr5969lp_driver_counter = y +endif + +ifeq (${timer_s}, 1) + CONFIG_arch_msp430fr5969lp_driver_uptime = y +endif + +# Kconfig + +ifdef CONFIG_arch_msp430fr5969lp_driver_adc + CXX_TARGETS += src/arch/msp430fr5969lp/driver/adc.cc +endif + +ifdef CONFIG_arch_msp430fr5969lp_driver_stdin + CXX_TARGETS += src/arch/msp430fr5969lp/driver/stdin.cc +endif + +ifdef CONFIG_arch_msp430fr5969lp_driver_i2c CXX_TARGETS += src/arch/msp430fr5969lp/driver/i2c.cc COMMON_FLAGS += -DDRIVER_I2C endif -ifneq ($(findstring spi_a1,${arch_drivers}), ) +ifdef CONFIG_arch_msp430fr5969lp_driver_spi_a1 CXX_TARGETS += src/arch/msp430fr5969lp/driver/spi_a1.cc endif -ifneq ($(findstring spi_b,${arch_drivers}), ) +ifdef CONFIG_arch_msp430fr5969lp_driver_spi_b CXX_TARGETS += src/arch/msp430fr5969lp/driver/spi_b.cc endif -ifneq ($(findstring timer,${arch_drivers}), ) +ifdef CONFIG_arch_msp430fr5969lp_driver_timer CXX_TARGETS += src/arch/msp430fr5969lp/driver/timer.cc endif -ifneq ($(findstring counter,${arch_drivers}), ) +ifdef CONFIG_arch_msp430fr5969lp_driver_counter CXX_TARGETS += src/arch/msp430fr5969lp/driver/counter.cc endif +ifdef CONFIG_arch_msp430fr5969lp_driver_uptime + COMMON_FLAGS += -DTIMER_S + CXX_TARGETS += src/arch/msp430fr5969lp/driver/uptime.cc +endif + + + ifneq (${cpu_freq}, ) COMMON_FLAGS += -DF_CPU=${cpu_freq}UL else diff --git a/src/arch/msp430fr5969lp/arch.cc b/src/arch/msp430fr5969lp/arch.cc index fb7d167..5385d16 100644 --- a/src/arch/msp430fr5969lp/arch.cc +++ b/src/arch/msp430fr5969lp/arch.cc @@ -89,12 +89,6 @@ void Arch::setup(void) TA1CCR0 = 4096; TA1CTL |= TACLR | TAIE; #endif - -#ifdef TIMER_CYCLES - TA2CTL = TASSEL__SMCLK | ID__1 | MC__CONTINUOUS; - TA2EX0 = 0; - TA2CTL |= TACLR; -#endif } #ifdef WITH_WAKEUP diff --git a/src/arch/msp430fr5969lp/driver/counter.cc b/src/arch/msp430fr5969lp/driver/counter.cc index 7a5aca2..741b543 100644 --- a/src/arch/msp430fr5969lp/driver/counter.cc +++ b/src/arch/msp430fr5969lp/driver/counter.cc @@ -2,10 +2,6 @@ #include "driver/counter.h" #include "driver/gpio.h" -#if defined(TIMER_CYCLES) -#warn "timer_cycles and counter are mutually exclusive. Expect odd behaviour." -#endif - Counter counter; #ifndef __acweaving diff --git a/src/arch/msp430fr5969lp/prompt b/src/arch/msp430fr5969lp/prompt new file mode 100644 index 0000000..a8f2b86 --- /dev/null +++ b/src/arch/msp430fr5969lp/prompt @@ -0,0 +1 @@ +MSP430FR5969 Launchpad diff --git a/src/arch/msp430fr5994lp-256k/Kconfig b/src/arch/msp430fr5994lp-256k/Kconfig new file mode 100644 index 0000000..750ed76 --- /dev/null +++ b/src/arch/msp430fr5994lp-256k/Kconfig @@ -0,0 +1,31 @@ +config arch_msp430fr5994lp_256k_driver_adc +bool "ADC (Analog-Digital-Converter)" +select meta_driver_adc + +config arch_msp430fr5994lp_256k_driver_counter +bool "Cycle Counter" +select meta_driver_counter + +config arch_msp430fr5994lp_256k_driver_i2c +bool "I2C on eUSCI_B1" +select meta_driver_i2c + +config arch_msp430fr5994lp_256k_driver_spi_a1 +bool "SPI on eUSCI_A1" +select meta_driver_spi + +config arch_msp430fr5994lp_256k_driver_spi_b +bool "SPI on eUSCI_B1" +select meta_driver_spi + +config arch_msp430fr5994lp_256k_driver_stdin +bool "UART Input" +select meta_driver_stdin + +config arch_msp430fr5994lp_256k_driver_timer +bool "Timer with Interrupts" +select meta_driver_timer + +config arch_msp430fr5994lp_256k_driver_uptime +bool "Uptime Counter" +select meta_driver_uptime diff --git a/src/arch/msp430fr5994lp-256k/prompt b/src/arch/msp430fr5994lp-256k/prompt new file mode 100644 index 0000000..78b169e --- /dev/null +++ b/src/arch/msp430fr5994lp-256k/prompt @@ -0,0 +1 @@ +MSP430FR5994 Launchpad (Large Memory Model) diff --git a/src/arch/msp430fr5994lp/Kconfig b/src/arch/msp430fr5994lp/Kconfig new file mode 100644 index 0000000..8831867 --- /dev/null +++ b/src/arch/msp430fr5994lp/Kconfig @@ -0,0 +1,31 @@ +config arch_msp430fr5994lp_driver_adc +bool "ADC (Analog-Digital-Converter)" +select meta_driver_adc + +config arch_msp430fr5994lp_driver_counter +bool "Cycle Counter" +select meta_driver_counter + +config arch_msp430fr5994lp_driver_i2c +bool "I2C on eUSCI_B1" +select meta_driver_i2c + +config arch_msp430fr5994lp_driver_spi_a1 +bool "SPI on eUSCI_A1" +select meta_driver_spi + +config arch_msp430fr5994lp_driver_spi_b +bool "SPI on eUSCI_B1" +select meta_driver_spi + +config arch_msp430fr5994lp_driver_stdin +bool "UART Input" +select meta_driver_stdin + +config arch_msp430fr5994lp_driver_timer +bool "Timer with Interrupts" +select meta_driver_timer + +config arch_msp430fr5994lp_driver_uptime +bool "Uptime Counter" +select meta_driver_uptime diff --git a/src/arch/msp430fr5994lp/Makefile.inc b/src/arch/msp430fr5994lp/Makefile.inc index e9d666f..0d2df46 100644 --- a/src/arch/msp430fr5994lp/Makefile.inc +++ b/src/arch/msp430fr5994lp/Makefile.inc @@ -29,6 +29,8 @@ SIZE = /opt/msp430/ti/msp430-gcc-full-linux-5.1.2.0/bin/msp430-elf-size ARCH_SHORTNAME = msp430 CXX_TARGETS += src/arch/msp430fr5994lp/arch.cc +CXX_TARGETS += src/arch/msp430fr5994lp/driver/gpio.cc +CXX_TARGETS += src/arch/msp430fr5994lp/driver/stdout.cc ifeq (${aspectc}, 1) ifeq (${msp430_large}, ) @@ -38,40 +40,78 @@ ifeq (${aspectc}, 1) endif endif +# Command-line + ifneq ($(findstring adc,${arch_drivers}), ) - CXX_TARGETS += src/arch/msp430fr5994lp/driver/adc.cc + CONFIG_arch_msp430fr5994lp_driver_adc = y endif -CXX_TARGETS += src/arch/msp430fr5994lp/driver/gpio.cc -CXX_TARGETS += src/arch/msp430fr5994lp/driver/stdout.cc -CXX_TARGETS += src/arch/msp430fr5994lp/driver/uptime.cc - ifneq ($(findstring stdin,${arch_drivers}), ) - CXX_TARGETS += src/arch/msp430fr5994lp/driver/stdin.cc + CONFIG_arch_msp430fr5994lp_driver_stdin = y endif ifneq ($(findstring softi2c,${drivers}), ) else ifneq ($(findstring i2c,${arch_drivers}), ) + CONFIG_arch_msp430fr5994lp_driver_i2c = y +endif + +ifneq ($(findstring spi_a1,${arch_drivers}), ) + CONFIG_arch_msp430fr5994lp_driver_spi_a1 = y +endif + +ifneq ($(findstring spi_b,${arch_drivers}), ) + CONFIG_arch_msp430fr5994lp_driver_spi_b = y +endif + +ifneq ($(findstring timer,${arch_drivers}), ) + CONFIG_arch_msp430fr5994lp_driver_timer = y +endif + +ifneq ($(findstring counter,${arch_drivers}), ) + CONFIG_arch_msp430fr5994lp_driver_counter = y +endif + +ifeq (${timer_s}, 1) + CONFIG_arch_msp430fr5994lp_driver_uptime = y +endif + +# Kconfig + +ifdef CONFIG_arch_msp430fr5994lp_driver_adc + CXX_TARGETS += src/arch/msp430fr5994lp/driver/adc.cc +endif + +ifdef CONFIG_arch_msp430fr5994lp_driver_stdin + CXX_TARGETS += src/arch/msp430fr5994lp/driver/stdin.cc +endif + +ifdef CONFIG_arch_msp430fr5994lp_driver_i2c CXX_TARGETS += src/arch/msp430fr5994lp/driver/i2c.cc COMMON_FLAGS += -DDRIVER_I2C endif -ifneq ($(findstring spi_a1,${arch_drivers}), ) +ifdef CONFIG_arch_msp430fr5994lp_driver_spi_a1 CXX_TARGETS += src/arch/msp430fr5994lp/driver/spi_a1.cc endif -ifneq ($(findstring spi_b,${arch_drivers}), ) +ifdef CONFIG_arch_msp430fr5994lp_driver_spi_b CXX_TARGETS += src/arch/msp430fr5994lp/driver/spi_b.cc endif -ifneq ($(findstring timer,${arch_drivers}), ) +ifdef CONFIG_arch_msp430fr5994lp_driver_timer CXX_TARGETS += src/arch/msp430fr5994lp/driver/timer.cc endif -ifneq ($(findstring counter,${arch_drivers}), ) +ifdef CONFIG_arch_msp430fr5994lp_driver_counter CXX_TARGETS += src/arch/msp430fr5994lp/driver/counter.cc endif +ifdef CONFIG_arch_msp430fr5994lp_driver_uptime + COMMON_FLAGS += -DTIMER_S + CXX_TARGETS += src/arch/msp430fr5994lp/driver/uptime.cc +endif + + ifneq ($(findstring timed_resistive_load,${arch_drivers}), ) CXX_TARGETS += src/arch/msp430fr5994lp/driver/timed_resistive_load.cc resistor1_pin ?= p3_0 diff --git a/src/arch/msp430fr5994lp/arch.cc b/src/arch/msp430fr5994lp/arch.cc index de75fbb..e7d5ff5 100644 --- a/src/arch/msp430fr5994lp/arch.cc +++ b/src/arch/msp430fr5994lp/arch.cc @@ -89,12 +89,6 @@ void Arch::setup(void) TA1CCR0 = 4096; TA1CTL |= TACLR | TAIE; #endif - -#ifdef TIMER_CYCLES - TA2CTL = TASSEL__SMCLK | ID__1 | MC__CONTINUOUS; - TA2EX0 = 0; - TA2CTL |= TACLR; -#endif } #ifdef WITH_WAKEUP diff --git a/src/arch/msp430fr5994lp/driver/counter.cc b/src/arch/msp430fr5994lp/driver/counter.cc index 98a2c4f..daa7a2d 100644 --- a/src/arch/msp430fr5994lp/driver/counter.cc +++ b/src/arch/msp430fr5994lp/driver/counter.cc @@ -1,9 +1,5 @@ #include "driver/counter.h" -#if defined(TIMER_CYCLES) -#warn "timer_cycles and counter are mutually exclusive. Expect odd behaviour." -#endif - Counter counter; #ifndef __acweaving diff --git a/src/arch/msp430fr5994lp/prompt b/src/arch/msp430fr5994lp/prompt new file mode 100644 index 0000000..60b2621 --- /dev/null +++ b/src/arch/msp430fr5994lp/prompt @@ -0,0 +1 @@ +MSP430FR5994 Launchpad diff --git a/src/arch/posix/Kconfig b/src/arch/posix/Kconfig new file mode 100644 index 0000000..d88cbfc --- /dev/null +++ b/src/arch/posix/Kconfig @@ -0,0 +1,10 @@ +config gpio_trace +bool "Trace GPIO changes on stdout" + +config arch_posix_driver_counter +bool "Cycle counter" +select meta_driver_counter + +config arch_posix_driver_uptime +bool "Uptime counter" +select meta_driver_uptime diff --git a/src/arch/posix/Makefile.inc b/src/arch/posix/Makefile.inc index 7bf4ba0..22ddba9 100644 --- a/src/arch/posix/Makefile.inc +++ b/src/arch/posix/Makefile.inc @@ -13,17 +13,33 @@ ifeq (${aspectc}, 1) endif CXX_TARGETS += src/arch/posix/arch.cc src/arch/posix/driver/gpio.cc -CXX_TARGETS += src/arch/posix/driver/stdout.cc src/arch/posix/driver/uptime.cc +CXX_TARGETS += src/arch/posix/driver/stdout.cc ifneq ($(findstring counter,${arch_drivers}), ) + CONFIG_arch_posix_driver_counter = y +endif + +ifeq (${timer_s}, 1) + CONFIG_arch_arduino_nano_driver_uptime = y +endif + +ifdef CONFIG_arch_posix_driver_counter CXX_TARGETS += src/arch/posix/driver/counter.cc endif +ifdef CONFIG_arch_arduino_nano_driver_uptime + COMMON_FLAGS += -DTIMER_S + CXX_TARGETS += src/arch/arduino-nano/driver/uptime.cc +endif + OBJECTS = ${CXX_TARGETS:.cc=.o} ${C_TARGETS:.c=.o} ifneq (${gpio_trace}, ) COMMON_FLAGS += -DGPIO_TRACE endif +ifdef CONFIG_gpio_trace + COMMON_FLAGS += -DGPIO_TRACE +endif .cc.o: ${QUIET}${CXX} ${INCLUDES} ${COMMON_FLAGS} ${CXXFLAGS} -c -o $@ ${@:.o=.cc} diff --git a/src/arch/posix/prompt b/src/arch/posix/prompt new file mode 100644 index 0000000..9615075 --- /dev/null +++ b/src/arch/posix/prompt @@ -0,0 +1 @@ +POSIX diff --git a/src/arch/stm32f446re-nucleo/Kconfig b/src/arch/stm32f446re-nucleo/Kconfig new file mode 100644 index 0000000..df64674 --- /dev/null +++ b/src/arch/stm32f446re-nucleo/Kconfig @@ -0,0 +1,11 @@ +config arch_stm32f446re_nucleo_driver_counter +bool "Cycle Counter" +select meta_driver_counter + +config arch_stm32f446re_nucleo_driver_timer +bool "Timer with Interrupts" +select meta_driver_timer + +config arch_stm32f446re_nucleo_driver_uptime +bool "Uptime Counter" +select meta_driver_uptime diff --git a/src/arch/stm32f446re-nucleo/Makefile.inc b/src/arch/stm32f446re-nucleo/Makefile.inc index 22115f7..554c7a8 100644 --- a/src/arch/stm32f446re-nucleo/Makefile.inc +++ b/src/arch/stm32f446re-nucleo/Makefile.inc @@ -27,34 +27,37 @@ endif CXX_TARGETS += src/arch/stm32f446re-nucleo/driver/gpio.cc CXX_TARGETS += src/arch/stm32f446re-nucleo/driver/stdout.cc -CXX_TARGETS += src/arch/stm32f446re-nucleo/driver/uptime.cc -ifneq ($(findstring stdin,${arch_drivers}), ) - CXX_TARGETS += src/arch/stm32f446re-nucleo/driver/stdin.cc +# Commandline + +ifneq ($(findstring counter,${arch_drivers}), ) + CONFIG_arch_stm32f446re_nucleo_driver_counter = y endif -ifneq ($(findstring softi2c,${drivers}), ) -else ifneq ($(findstring i2c,${arch_drivers}), ) - CXX_TARGETS += src/arch/stm32f446re-nucleo/driver/i2c.cc - COMMON_FLAGS += -DDRIVER_I2C +ifneq ($(findstring timer,${arch_drivers}), ) + CONFIG_arch_stm32f446re_nucleo_driver_timer = y endif -ifneq ($(findstring spi_a1,${arch_drivers}), ) - CXX_TARGETS += src/arch/stm32f446re-nucleo/driver/spi_a1.cc +ifeq (${timer_s}, 1) + CONFIG_arch_stm32f446re_nucleo_driver_uptime = y endif -ifneq ($(findstring spi_b,${arch_drivers}), ) - CXX_TARGETS += src/arch/stm32f446re-nucleo/driver/spi_b.cc +# Kconfig + +ifdef CONFIG_arch_stm32f446re_nucleo_driver_counter + CXX_TARGETS += src/arch/stm32f446re-nucleo/driver/counter.cc endif -ifneq ($(findstring timer,${arch_drivers}), ) +ifdef CONFIG_arch_stm32f446re_nucleo_driver_timer CXX_TARGETS += src/arch/stm32f446re-nucleo/driver/timer.cc endif -ifneq ($(findstring counter,${arch_drivers}), ) - CXX_TARGETS += src/arch/stm32f446re-nucleo/driver/counter.cc +ifdef CONFIG_arch_stm32f446re_nucleo_driver_uptime + COMMON_FLAGS += -DTIMER_S + CXX_TARGETS += src/arch/stm32f446re-nucleo/driver/uptime.cc endif + ifneq (${cpu_freq}, ) COMMON_FLAGS += -DF_CPU=${cpu_freq}UL else diff --git a/src/arch/stm32f446re-nucleo/prompt b/src/arch/stm32f446re-nucleo/prompt new file mode 100644 index 0000000..e81bb4b --- /dev/null +++ b/src/arch/stm32f446re-nucleo/prompt @@ -0,0 +1 @@ +STM32F446RE Nucleo diff --git a/src/driver/Kconfig b/src/driver/Kconfig new file mode 100644 index 0000000..49bfbdd --- /dev/null +++ b/src/driver/Kconfig @@ -0,0 +1,88 @@ +config meta_driver_adc +bool +config meta_driver_counter +bool +config meta_driver_i2c +bool +config meta_driver_neopixel +bool +config meta_driver_spi +bool +config meta_driver_stdin +bool +config meta_driver_timer +bool + +menu "Drivers" + +config driver_am2320 +bool "AM2320 TH Sensor" +depends on meta_driver_i2c + +config driver_bme280 +bool "BME280 TPH Sensor" +depends on meta_driver_i2c + +config driver_bme680 +bool "BME680 TPH+IAQ Sensor" +depends on meta_driver_i2c + +config driver_ccs811 +bool "CCS811 VOC Sensor" +depends on meta_driver_i2c + +config driver_dummy +bool "Dummy driver" + +config driver_eepom24lc64 +bool "24LC64 EEPROM" + +config driver_hcd1080 +bool "HDC1080 TH Sensor with Heated Plate" +depends on meta_driver_i2c + +config driver_lm75 +bool "LM75 Temperature Sensor" +depends on meta_driver_i2c +# depends on I2C + +config driver_max44006 +bool "MAX44006 RGB Sensor" +depends on meta_driver_i2c + +config driver_max44009 +bool "MAX44009 Ambient Light Sensor" +depends on meta_driver_i2c + +config driver_mmsimple +bool "MicroMoody simple" +depends on meta_driver_i2c + +config driver_mmsubstate +bool "MicroMoody with Sub-States" +depends on meta_driver_i2c + +config driver_mpu9250 +bool "MPU9250 Accelerometer/Gyroscope/Magnetometer" +depends on meta_driver_i2c + +config driver_nrf24l01 +bool "nRF24L01+ 2.4GHz Radio" +depends on meta_driver_spi + +config driver_resistive_load +bool "Resistive Load for Energy Model Generation Evaluation" + +config driver_s5851a +bool "S5851A LoRaWAN Radio" + +config driver_sharp96 +bool "sharp LS013B4DN 96x96px Transflective LC Display" +depends on meta_driver_spi + +config driver_soft_i2c +bool "Software I2C" +#depends on !driver_i2c +select meta_driver_i2c + +endmenu diff --git a/src/driver/soft_i2c.cc b/src/driver/soft_i2c.cc index 285caef..b03b9e1 100644 --- a/src/driver/soft_i2c.cc +++ b/src/driver/soft_i2c.cc @@ -7,9 +7,6 @@ #endif #ifdef SOFTI2C_TIMER -#ifdef TIMER_CYCLES -#error "SOFTI2C_TIMER and TIMER_CYCLES are mutually exclusive" -#endif #include "driver/timer.h" volatile unsigned char timer_done = 0; #endif |