diff --git a/.murdock b/.murdock index 14923a59ba..83c3673d5e 100755 --- a/.murdock +++ b/.murdock @@ -10,6 +10,7 @@ : ${TEST_KCONFIG_BOARDS_AVAILABLE:=" native samr21-xpro +nucleo-f103rb "} : ${TEST_KCONFIG_ENFORCE_APP_GROUPS:=" diff --git a/Makefile.base b/Makefile.base index 88cb367043..58124cc1e5 100644 --- a/Makefile.base +++ b/Makefile.base @@ -67,9 +67,14 @@ ifeq ($(strip $(ASSMSRC))$(NO_AUTO_SRC),) ASSMSRC := $(wildcard *.S) endif + ifneq (,$(SRCXX)) - ifeq (,$(filter cpp,$(FEATURES_USED))) - $(error Found C++ source, but feature "cpp" is not used. Add "FEATURES_REQUIRED += cpp") + ifeq (,$(filter cpp,$(USEMODULE))) + ifneq (1,$(TEST_KCONFIG)) + $(error Found C++ source, but feature "cpp" is not used. Add "FEATURES_REQUIRED += cpp") + else + $(error Found C++ source, but "cpp" module is not used. Enable the MODULE_CPP in Kconfig) + endif endif endif diff --git a/Makefile.dep b/Makefile.dep index 4c57278ff1..8a8adb2116 100644 --- a/Makefile.dep +++ b/Makefile.dep @@ -104,7 +104,13 @@ FEATURES_OPTIONAL += no_idle_thread ifneq (,$(filter libstdcpp,$(FEATURES_USED))) # Also use C++ if libstdc++ is used - FEATURES_REQUIRED += cpp + USEMODULE += cpp + USEMODULE += libstdcpp +endif + +ifneq (,$(filter cpp,$(FEATURES_USED))) + # Also use C++ if libstdc++ is used + USEMODULE += cpp endif ifneq (,$(filter test_utils_interactive_sync,$(USEMODULE))) diff --git a/Makefile.include b/Makefile.include index fe01d56056..365a3a32df 100644 --- a/Makefile.include +++ b/Makefile.include @@ -623,7 +623,7 @@ else endif # variables used to compile and link c++ -ifneq (,$(filter cpp,$(FEATURES_USED))) +ifneq (,$(filter cpp,$(USEMODULE))) CPPMIX ?= 1 endif diff --git a/boards/common/nucleo/Kconfig b/boards/common/nucleo/Kconfig new file mode 100644 index 0000000000..62dc8f8f61 --- /dev/null +++ b/boards/common/nucleo/Kconfig @@ -0,0 +1,17 @@ +# Copyright (c) 2021 HAW Hamburg +# +# This file is subject to the terms and conditions of the GNU Lesser +# General Public License v2.1. See the file LICENSE in the top level +# directory for more details. +# + +if TEST_KCONFIG + +config MODULE_BOARDS_COMMON_NUCLEO + bool + default y + select MODULE_SAUL_GPIO if MODULE_SAUL_DEFAULT && HAS_PERIPH_GPIO + help + stm32 common nucleo code. + +endif # TEST_KCONFIG diff --git a/boards/common/nucleo144/Kconfig b/boards/common/nucleo144/Kconfig index b6ef23e689..ead4e3fe18 100644 --- a/boards/common/nucleo144/Kconfig +++ b/boards/common/nucleo144/Kconfig @@ -13,4 +13,5 @@ config BOARD_COMMON_NUCLEO144 select BOARD_HAS_HSE if !CPU_FAM_L4 && !CPU_FAM_L5 select BOARD_HAS_LSE +source "$(RIOTBOARD)/common/nucleo/Kconfig" source "$(RIOTBOARD)/common/stm32/Kconfig" diff --git a/boards/common/nucleo32/Kconfig b/boards/common/nucleo32/Kconfig index 0d05550a33..bebcefa25e 100644 --- a/boards/common/nucleo32/Kconfig +++ b/boards/common/nucleo32/Kconfig @@ -12,4 +12,5 @@ config BOARD_COMMON_NUCLEO32 # Clock configuration select BOARD_HAS_LSE if (CPU_FAM_L0 || CPU_FAM_L4) && !BOARD_NUCLEO_L011K4 +source "$(RIOTBOARD)/common/nucleo/Kconfig" source "$(RIOTBOARD)/common/stm32/Kconfig" diff --git a/boards/common/nucleo64/Kconfig b/boards/common/nucleo64/Kconfig index 705fd28cd1..a718be7db0 100644 --- a/boards/common/nucleo64/Kconfig +++ b/boards/common/nucleo64/Kconfig @@ -13,4 +13,5 @@ config BOARD_COMMON_NUCLEO64 select BOARD_HAS_HSE if !CPU_FAM_G0 && !CPU_FAM_L0 && !CPU_FAM_L1 && !CPU_FAM_L4 select BOARD_HAS_LSE if !BOARD_NUCLE0_L152RE +source "$(RIOTBOARD)/common/nucleo/Kconfig" source "$(RIOTBOARD)/common/stm32/Kconfig" diff --git a/cpu/stm32/Kconfig b/cpu/stm32/Kconfig index 16572c18dc..8ab8c6e5f1 100644 --- a/cpu/stm32/Kconfig +++ b/cpu/stm32/Kconfig @@ -36,4 +36,12 @@ orsource "kconfigs/*/Kconfig" orsource "kconfigs/*/Kconfig.lines" orsource "kconfigs/*/Kconfig.models" +if TEST_KCONFIG + +rsource "periph/Kconfig" +rsource "stmclk/Kconfig" +rsource "vectors/Kconfig" + +endif # TEST_KCONFIG + source "$(RIOTCPU)/cortexm_common/Kconfig" diff --git a/cpu/stm32/Makefile.features b/cpu/stm32/Makefile.features index bcb562bec4..030649304f 100644 --- a/cpu/stm32/Makefile.features +++ b/cpu/stm32/Makefile.features @@ -51,4 +51,11 @@ ifneq (,$(filter $(CPU_MODEL),$(STM32_WITH_MPU))) FEATURES_PROVIDED += cortexm_mpu endif +# Add stm32 configs after including cortexm_common so stm32 takes precendence +# This configuration enables modules that are only available when using Kconfig +# module modelling +ifeq (1, $(TEST_KCONFIG)) + KCONFIG_ADD_CONFIG += $(RIOTCPU)/stm32/stm32.config +endif + include $(RIOTCPU)/cortexm_common/Makefile.features diff --git a/cpu/stm32/periph/Kconfig b/cpu/stm32/periph/Kconfig new file mode 100644 index 0000000000..24c613286f --- /dev/null +++ b/cpu/stm32/periph/Kconfig @@ -0,0 +1,28 @@ +# Copyright (c) 2021 HAW Hamburg +# +# This file is subject to the terms and conditions of the GNU Lesser +# General Public License v2.1. See the file LICENSE in the top level +# directory for more details. +# + +config MODULE_PERIPH + bool + default y + select MODULE_XTIMER if MODULE_PERIPH_USBDEV + help + stm32 common peripheral code. + +config MODULE_PERIPH_UART_NONBLOCKING + depends on HAS_PERIPH_UART_NONBLOCKING + depends on MODULE_PERIPH_UART + select MODULE_TSRB + +config MODULE_PERIPH_CAN + bool + depends on HAS_PERIPH_CAN + depends on HAS_PERIPH_GPIO + depends on HAS_PERIPH_GPIO_IRQ + select MODULE_PERIPH_GPIO_IRQ + select MODULE_PERIPH_I2C + help + STM32 CAN peripheral controller. diff --git a/cpu/stm32/stm32.config b/cpu/stm32/stm32.config new file mode 100644 index 0000000000..811b1f3712 --- /dev/null +++ b/cpu/stm32/stm32.config @@ -0,0 +1 @@ +CONFIG_MODULE_PM_LAYERED=y diff --git a/cpu/stm32/stmclk/Kconfig b/cpu/stm32/stmclk/Kconfig new file mode 100644 index 0000000000..846db93c84 --- /dev/null +++ b/cpu/stm32/stmclk/Kconfig @@ -0,0 +1,10 @@ +# Copyright (c) 2021 HAW Hamburg +# +# This file is subject to the terms and conditions of the GNU Lesser +# General Public License v2.1. See the file LICENSE in the top level +# directory for more details. +# + +config MODULE_STM32_CLK + bool + default y diff --git a/cpu/stm32/vectors/Kconfig b/cpu/stm32/vectors/Kconfig new file mode 100644 index 0000000000..93c7ab1081 --- /dev/null +++ b/cpu/stm32/vectors/Kconfig @@ -0,0 +1,10 @@ +# Copyright (c) 2021 HAW Hamburg +# +# This file is subject to the terms and conditions of the GNU Lesser +# General Public License v2.1. See the file LICENSE in the top level +# directory for more details. +# + +config MODULE_STM32_VECTORS + bool + default y diff --git a/makefiles/pseudomodules.inc.mk b/makefiles/pseudomodules.inc.mk index 05c8fe7ee7..7340f2b864 100644 --- a/makefiles/pseudomodules.inc.mk +++ b/makefiles/pseudomodules.inc.mk @@ -20,6 +20,7 @@ PSEUDOMODULES += cord_ep_standalone PSEUDOMODULES += core_% PSEUDOMODULES += cortexm_fpu PSEUDOMODULES += cortexm_svc +PSEUDOMODULES += cpp PSEUDOMODULES += cpu_check_address PSEUDOMODULES += dbgpin PSEUDOMODULES += devfs_% @@ -75,6 +76,7 @@ PSEUDOMODULES += ieee802154_submac PSEUDOMODULES += ina3221_alerts PSEUDOMODULES += l2filter_blacklist PSEUDOMODULES += l2filter_whitelist +PSEUDOMODULES += libstdcpp PSEUDOMODULES += lis2dh12_i2c PSEUDOMODULES += lis2dh12_int PSEUDOMODULES += lis2dh12_spi diff --git a/sys/Kconfig b/sys/Kconfig index 3c768062d6..94626af3b9 100644 --- a/sys/Kconfig +++ b/sys/Kconfig @@ -58,6 +58,18 @@ rsource "usb/Kconfig" rsource "xtimer/Kconfig" rsource "ztimer/Kconfig" +config MODULE_CPP + bool "Use CPP compiler" + depends on TEST_KCONFIG + depends on HAS_CPP + +config MODULE_LIBSTDCPP + bool "Use the CPP standard library" + depends on TEST_KCONFIG + depends on HAS_LIBSTDCPP + depends on HAS_CPP + select MODULE_CPP + config MODULE_SYS bool default y diff --git a/sys/Makefile.dep b/sys/Makefile.dep index d953708583..a3e96ab080 100644 --- a/sys/Makefile.dep +++ b/sys/Makefile.dep @@ -6,8 +6,7 @@ ifneq (,$(filter arduino,$(USEMODULE))) FEATURES_REQUIRED += cpp FEATURES_REQUIRED += periph_gpio FEATURES_REQUIRED += periph_uart - SKETCH_MODULE ?= arduino_sketches - USEMODULE += $(SKETCH_MODULE) + USEMODULE += arduino_sketches USEMODULE += fmt USEMODULE += ztimer_usec USEMODULE += ztimer_msec diff --git a/sys/arduino/Kconfig b/sys/arduino/Kconfig index e14b23759b..876b852313 100644 --- a/sys/arduino/Kconfig +++ b/sys/arduino/Kconfig @@ -5,14 +5,26 @@ # directory for more details. # +config MODULE_ARDUINO_SKETCHES + bool + menuconfig MODULE_ARDUINO bool "Arduino support" imply MODULE_ARDUINO_PWM imply MODULE_PERIPH_ADC + imply MODULE_PERIPH_I2C + imply MODULE_PERIPH_SPI depends on HAS_ARDUINO depends on HAS_PERIPH_GPIO + depends on HAS_CPP depends on TEST_KCONFIG select MODULE_PERIPH_GPIO + select MODULE_CPP + select MODULE_ARDUINO_SKETCHES + select MODULE_FMT + select MODULE_ZTIMER + select MODULE_ZTIMER_MSEC + select MODULE_ZTIMER_USEC config MODULE_ARDUINO_PWM bool "PWM support for Arduino" diff --git a/sys/arduino/Makefile.include b/sys/arduino/Makefile.include index 16e404ff14..fba73396d7 100644 --- a/sys/arduino/Makefile.include +++ b/sys/arduino/Makefile.include @@ -1,6 +1,7 @@ # Add Arduino sketches to the application as a module SKETCHES = $(wildcard $(APPDIR)/*.sketch) +SKETCH_MODULE = arduino_sketches ifneq (,$(SKETCHES)) # Define application sketches module, it will be generated into $(BINDIR) diff --git a/sys/ztimer/Kconfig b/sys/ztimer/Kconfig index e01bc61e5e..c6720f6b13 100644 --- a/sys/ztimer/Kconfig +++ b/sys/ztimer/Kconfig @@ -77,7 +77,7 @@ choice default ZTIMER_SEC_BACKEND_RTC if !BOARD_NATIVE && \ !CPU_COMMON_SAM0 && \ !CPU_COMMON_EFM32 && \ - !CPU_COMMON_STM32F1 + !CPU_FAM_F1 default ZTIMER_SEC_BACKEND_RTT config ZTIMER_SEC_BACKEND_TIMER diff --git a/tests/periph_gpio_arduino/app.config.test b/tests/periph_gpio_arduino/app.config.test index 8aa13b683f..7b56244a34 100644 --- a/tests/periph_gpio_arduino/app.config.test +++ b/tests/periph_gpio_arduino/app.config.test @@ -3,4 +3,3 @@ CONFIG_MODULE_PERIPH_GPIO=y CONFIG_MODULE_SHELL=y CONFIG_MODULE_ARDUINO=y -CONFIG_MODULE_XTIMER=y