From b534f26e177a74f8f927f167c574c6bb95f98f83 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 30 Sep 2021 13:35:44 +0200 Subject: [PATCH 01/26] cpu/avr8_common: model Kconfig --- cpu/avr8_common/Kconfig | 22 ++++++++++++++++++++++ cpu/avr8_common/avr_libc_extra/Kconfig | 14 ++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 cpu/avr8_common/avr_libc_extra/Kconfig diff --git a/cpu/avr8_common/Kconfig b/cpu/avr8_common/Kconfig index 1c5ab86dd7..c60d56fa36 100644 --- a/cpu/avr8_common/Kconfig +++ b/cpu/avr8_common/Kconfig @@ -11,6 +11,10 @@ config CPU_ARCH_AVR8 select HAS_ARCH_8BIT select HAS_ARCH_AVR8 + select MODULE_MALLOC_THREAD_SAFE if TEST_KCONFIG + # static C++ constructors need guards for thread safe initialization + select MODULE_CXX_CTOR_GUARDS if MODULE_CPP + ## Common CPU symbols config CPU_ARCH default "avr8" if CPU_ARCH_AVR8 @@ -23,3 +27,21 @@ config HAS_ARCH_AVR8 bool help Indicates that the current architecture is Atmel AVR8. + +if CPU_ARCH_AVR8 + +config MODULE_AVR8_COMMON + bool + depends on TEST_KCONFIG + default y + help + AVR-8 common code. + +# the atmel port uses stdio_uart by default +choice STDIO_IMPLEMENTATION + default MODULE_STDIO_UART +endchoice + +endif # CPU_ARCH_AVR8 + +rsource "avr_libc_extra/Kconfig" diff --git a/cpu/avr8_common/avr_libc_extra/Kconfig b/cpu/avr8_common/avr_libc_extra/Kconfig new file mode 100644 index 0000000000..33c7ebe05a --- /dev/null +++ b/cpu/avr8_common/avr_libc_extra/Kconfig @@ -0,0 +1,14 @@ +# 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_AVR_LIBC_EXTRA + bool + depends on TEST_KCONFIG + depends on CPU_ARCH_AVR8 + default y + help + AVR libc RIOT-specific support code. From b8e2e3ce66464c75c03a9d5f3a15a95bf97dc7d6 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 30 Sep 2021 13:36:20 +0200 Subject: [PATCH 02/26] cpu/atmega_common: model Kconfig --- cpu/atmega_common/Kconfig | 30 ++++---------- cpu/atmega_common/periph/Kconfig | 71 ++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 21 deletions(-) create mode 100644 cpu/atmega_common/periph/Kconfig diff --git a/cpu/atmega_common/Kconfig b/cpu/atmega_common/Kconfig index a35a7f3258..8986f03893 100644 --- a/cpu/atmega_common/Kconfig +++ b/cpu/atmega_common/Kconfig @@ -37,29 +37,17 @@ config CPU_FAM_ATMEGA128 config CPU_FAM default "atmega128" if CPU_FAM_ATMEGA128 -## Declaration of specific features -config HAS_ATMEGA_PCINT0 - bool - help - Indicates that the Pin Change Interrupt bank 0 is present. - -config HAS_ATMEGA_PCINT1 - bool - help - Indicates that the Pin Change Interrupt bank 1 is present. - -config HAS_ATMEGA_PCINT2 - bool - help - Indicates that the Pin Change Interrupt bank 2 is present. - -config HAS_ATMEGA_PCINT3 - bool - help - Indicates that the Pin Change Interrupt bank 3 is present. - config ERROR_MODULES_CONFLICT default "On ATmega, the RTC and RTT use to the same hardware timer." if MODULE_PERIPH_RTC && MODULE_PERIPH_RTT depends on CPU_COMMON_ATMEGA +config MODULE_ATMEGA_COMMON + bool + depends on CPU_COMMON_ATMEGA + depends on TEST_KCONFIG + default y + help + ATmega common code. + +rsource "periph/Kconfig" source "$(RIOTCPU)/avr8_common/Kconfig" diff --git a/cpu/atmega_common/periph/Kconfig b/cpu/atmega_common/periph/Kconfig new file mode 100644 index 0000000000..bc4a751f5c --- /dev/null +++ b/cpu/atmega_common/periph/Kconfig @@ -0,0 +1,71 @@ +# 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 && CPU_COMMON_ATMEGA + +config MODULE_ATMEGA_COMMON_PERIPH + bool + default y + help + Common ATmega peripheral drivers. + +config MODULE_ATMEGA_PCINT + bool + depends on HAS_ATMEGA_PCINT0 || HAS_ATMEGA_PCINT1 || HAS_ATMEGA_PCINT2 || HAS_ATMEGA_PCINT3 + help + Say y to enable all the present Pin Change Interrupt banks. + +config MODULE_ATMEGA_PCINT0 + bool + depends on HAS_ATMEGA_PCINT0 + default MODULE_ATMEGA_PCINT + help + Say y to enable PIC bank 0. + +config MODULE_ATMEGA_PCINT1 + bool + depends on HAS_ATMEGA_PCINT1 + default MODULE_ATMEGA_PCINT + help + Say y to enable PIC bank 1. + +config MODULE_ATMEGA_PCINT2 + bool + depends on HAS_ATMEGA_PCINT2 + default MODULE_ATMEGA_PCINT + help + Say y to enable PIC bank 2. + +config MODULE_ATMEGA_PCINT3 + bool + depends on HAS_ATMEGA_PCINT3 + default MODULE_ATMEGA_PCINT + help + Say y to enable PIC bank 3. + +endif # TEST_KCONFIG && CPU_COMMON_ATMEGA + +## Declaration of specific features +config HAS_ATMEGA_PCINT0 + bool + help + Indicates that the Pin Change Interrupt bank 0 is present. + +config HAS_ATMEGA_PCINT1 + bool + help + Indicates that the Pin Change Interrupt bank 1 is present. + +config HAS_ATMEGA_PCINT2 + bool + help + Indicates that the Pin Change Interrupt bank 2 is present. + +config HAS_ATMEGA_PCINT3 + bool + help + Indicates that the Pin Change Interrupt bank 3 is present. From a37f59b1091490d4cfa175624449bd210e263783 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 30 Sep 2021 13:36:51 +0200 Subject: [PATCH 03/26] cpu/atxmega: model Kconfig --- cpu/atxmega/Kconfig | 7 ++----- cpu/atxmega/Makefile.features | 6 ++++++ cpu/atxmega/atxmega.config | 2 ++ cpu/atxmega/ebi/Kconfig | 20 ++++++++++++++++++++ cpu/atxmega/periph/Kconfig | 22 ++++++++++++++++++++++ 5 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 cpu/atxmega/atxmega.config create mode 100644 cpu/atxmega/ebi/Kconfig create mode 100644 cpu/atxmega/periph/Kconfig diff --git a/cpu/atxmega/Kconfig b/cpu/atxmega/Kconfig index 2878c2d329..09d699cbe4 100644 --- a/cpu/atxmega/Kconfig +++ b/cpu/atxmega/Kconfig @@ -77,14 +77,11 @@ source "$(RIOTCPU)/atxmega/Kconfig.XMEGAE" config HAS_CPU_ATXMEGA bool -config HAS_ATXMEGA_EBI - bool - help - Indicates that the External Bus Interface is present. - config HAS_PERIPH_NVM bool help Indicates that the Non Volatile Memory controller is present. +rsource "ebi/Kconfig" +rsource "periph/Kconfig" source "$(RIOTCPU)/avr8_common/Kconfig" diff --git a/cpu/atxmega/Makefile.features b/cpu/atxmega/Makefile.features index 5543a6d28c..975be19ed6 100644 --- a/cpu/atxmega/Makefile.features +++ b/cpu/atxmega/Makefile.features @@ -13,3 +13,9 @@ FEATURES_PROVIDED += periph_gpio periph_gpio_irq FEATURES_PROVIDED += periph_nvm FEATURES_PROVIDED += periph_pm FEATURES_PROVIDED += periph_timer periph_timer_periodic + +# Add atxmega configurations. This configuration enables modules that are only available when +# using Kconfig module modelling +ifeq (1, $(TEST_KCONFIG)) + KCONFIG_ADD_CONFIG += $(RIOTCPU)/atxmega/atxmega.config +endif diff --git a/cpu/atxmega/atxmega.config b/cpu/atxmega/atxmega.config new file mode 100644 index 0000000000..3360051f8b --- /dev/null +++ b/cpu/atxmega/atxmega.config @@ -0,0 +1,2 @@ +# All ATxmega based CPUs provide PM +CONFIG_MODULE_PM_LAYERED=y diff --git a/cpu/atxmega/ebi/Kconfig b/cpu/atxmega/ebi/Kconfig new file mode 100644 index 0000000000..db39d06cda --- /dev/null +++ b/cpu/atxmega/ebi/Kconfig @@ -0,0 +1,20 @@ +# 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_ATXMEGA_EBI + bool + depends on TEST_KCONFIG + depends on CPU_COMMON_ATXMEGA + depends on HAS_ATXMEGA_EBI + default y if CPU_CORE_ATXMEGA_A1 + help + Low-level EBI (External BUS Interface) driver. + +config HAS_ATXMEGA_EBI + bool + help + Indicates that the External Bus Interface is present. diff --git a/cpu/atxmega/periph/Kconfig b/cpu/atxmega/periph/Kconfig new file mode 100644 index 0000000000..663d70970a --- /dev/null +++ b/cpu/atxmega/periph/Kconfig @@ -0,0 +1,22 @@ +# 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_ATXMEGA_PERIPH + bool + depends on TEST_KCONFIG + depends on CPU_COMMON_ATXMEGA + default y + help + Common ATXmega peripheral drivers. + +config MODULE_PERIPH_NVM + bool + depends on MODULE_ATXMEGA_PERIPH + depends on HAS_PERIPH_NVM + default y if MODULE_CPUID + help + Internal ATXmega Non Volatile Memory (NVM) driver. From 659d3f93de251530305d13d254b608622e494f56 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 30 Sep 2021 13:37:31 +0200 Subject: [PATCH 04/26] cpu: model atmega-based CPUs Kconfig From 45b6116c4c92a23644d9641ba73d22f574094620 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 30 Sep 2021 13:38:30 +0200 Subject: [PATCH 05/26] sys/cxx_ctor_guards: model Kconfig --- sys/Kconfig | 1 + sys/cxx_ctor_guards/Kconfig | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 sys/cxx_ctor_guards/Kconfig diff --git a/sys/Kconfig b/sys/Kconfig index b54a6c53b8..f6d5e3979c 100644 --- a/sys/Kconfig +++ b/sys/Kconfig @@ -19,6 +19,7 @@ rsource "checksum/Kconfig" rsource "color/Kconfig" rsource "crypto/Kconfig" rsource "congure/Kconfig" +rsource "cxx_ctor_guards/Kconfig" rsource "div/Kconfig" rsource "embunit/Kconfig" rsource "entropy_source/Kconfig" diff --git a/sys/cxx_ctor_guards/Kconfig b/sys/cxx_ctor_guards/Kconfig new file mode 100644 index 0000000000..99b359858b --- /dev/null +++ b/sys/cxx_ctor_guards/Kconfig @@ -0,0 +1,13 @@ +# 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_CXX_CTOR_GUARDS + bool "C++ constructor guards for static instances" + depends on TEST_KCONFIG + help + C++ constructor guards for thread-safe initialization of static instances. + Warning! this module is likely only compatible with g++. From 3854db364afaf8741a2e5de2863df2d5a05f563f Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 30 Sep 2021 13:39:03 +0200 Subject: [PATCH 06/26] sys/stdio/kconfig: associate symbol to implementation --- sys/Kconfig.stdio | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/Kconfig.stdio b/sys/Kconfig.stdio index bbfc31979c..db9577e413 100644 --- a/sys/Kconfig.stdio +++ b/sys/Kconfig.stdio @@ -8,7 +8,7 @@ menu "Standard Input/Output (STDIO)" depends on TEST_KCONFIG -choice +choice STDIO_IMPLEMENTATION bool "STDIO implementation" default MODULE_STDIO_NATIVE if CPU_ARCH_NATIVE default MODULE_STDIO_UART From 39ebbfd46056b7508d7e8d5d6f419e2236db25c4 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Wed, 3 Nov 2021 10:04:54 +0100 Subject: [PATCH 07/26] makefile.include: add RIOTKCONFIG --- Makefile.include | 1 + makefiles/vars.inc.mk | 1 + 2 files changed, 2 insertions(+) diff --git a/Makefile.include b/Makefile.include index 79b3e2b018..9d18b00fbb 100644 --- a/Makefile.include +++ b/Makefile.include @@ -47,6 +47,7 @@ RIOTCPU ?= $(RIOTBASE)/cpu RIOTBOARD ?= $(RIOTBASE)/boards EXTERNAL_BOARD_DIRS ?= RIOTMAKE ?= $(RIOTBASE)/makefiles +RIOTKCONFIG ?= $(RIOTBASE)/kconfigs RIOTPKG ?= $(RIOTBASE)/pkg RIOTTOOLS ?= $(RIOTBASE)/dist/tools RIOTPROJECT ?= $(shell git rev-parse --show-toplevel 2>/dev/null || pwd) diff --git a/makefiles/vars.inc.mk b/makefiles/vars.inc.mk index a77a351f53..f7808cae23 100644 --- a/makefiles/vars.inc.mk +++ b/makefiles/vars.inc.mk @@ -38,6 +38,7 @@ export RIOTPKG # For overriding RIOT's pkg directory export RIOTTOOLS # Location of host machine tools export RIOTPROJECT # Top level git root of the project being built, or PWD if not a git repository export RIOTMAKE # Location of all supplemental Makefiles (such as this file) +export RIOTKCONFIG # Location of all supplemental Kconfig files export BINDIRBASE # This is the folder where the application should be built in. For each BOARD a different subfolder is used. export BINDIR # This is the folder where the application should be built in. export BUILD_DIR # This is the base folder to store common build files and artifacts, e.g. test results. From 538327805b1a9041fb124b9900d85afcd20be179 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Tue, 2 Nov 2021 09:06:08 +0100 Subject: [PATCH 08/26] sys/{x,z}timer: add file to use ztimer when xtimer is present This introduces a Kconfig file for boards that cannot reach a timer frequency compatible with xtimer. For those boards, in the case xtimer is pulled, ztimer is used instead (as backend) with a compatibility module. --- kconfigs/Kconfig.ztimer_only | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 kconfigs/Kconfig.ztimer_only diff --git a/kconfigs/Kconfig.ztimer_only b/kconfigs/Kconfig.ztimer_only new file mode 100644 index 0000000000..757d7741b2 --- /dev/null +++ b/kconfigs/Kconfig.ztimer_only @@ -0,0 +1,14 @@ +# Include this for boards whose timer periph cannot generate a clock frequency +# suitable for xtimer with the available clock sources and dividers. +# This will use ztimer to perform the required frequency conversion. +# By default, xtimer is still used with ztimer as backed, unless +# ztimer_xtimer_compat is used. + +config HAVE_ZTIMER_ONLY + bool + default y + select MODULE_ZTIMER if MODULE_XTIMER + select MODULE_ZTIMER_USEC if MODULE_XTIMER + help + Indicates that the board cannot generate a clock frequency suitable for + xtimer and requires ztimer for conversion. ztimer is used as backend. From e5164ca9709ee85506e3bce4d561b03e7168e62f Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 30 Sep 2021 13:39:51 +0200 Subject: [PATCH 09/26] boards/common/{atmega,atxmega,arduino-atmega}: model Kconfig --- boards/common/arduino-atmega/Kconfig | 11 +++++++++++ boards/common/atmega/Kconfig | 12 ++++++++++++ boards/common/atxmega/Kconfig | 12 ++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 boards/common/atmega/Kconfig create mode 100644 boards/common/atxmega/Kconfig diff --git a/boards/common/arduino-atmega/Kconfig b/boards/common/arduino-atmega/Kconfig index f876356d04..35e643afb9 100644 --- a/boards/common/arduino-atmega/Kconfig +++ b/boards/common/arduino-atmega/Kconfig @@ -16,3 +16,14 @@ config BOARD_COMMON_ARDUINO_ATMEGA # Various other features (if any) select HAS_ARDUINO select HAS_ARDUINO_PWM + + select HAVE_SAUL_GPIO + +config MODULE_BOARDS_COMMON_ARDUINO-ATMEGA + bool + depends on TEST_KCONFIG + select MODULE_BOARDS_COMMON_ATMEGA + help + Common code of Arduino ATmega boards. + +source "$(RIOTBOARD)/common/atmega/Kconfig" diff --git a/boards/common/atmega/Kconfig b/boards/common/atmega/Kconfig new file mode 100644 index 0000000000..1a9be0bbfc --- /dev/null +++ b/boards/common/atmega/Kconfig @@ -0,0 +1,12 @@ +# 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_BOARDS_COMMON_ATMEGA + bool + depends on TEST_KCONFIG + help + Common code of ATmega boards. diff --git a/boards/common/atxmega/Kconfig b/boards/common/atxmega/Kconfig new file mode 100644 index 0000000000..1aed05da0d --- /dev/null +++ b/boards/common/atxmega/Kconfig @@ -0,0 +1,12 @@ +# 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_BOARDS_COMMON_ATXMEGA + bool + depends on TEST_KCONFIG + help + Common ATXmega boards code. From f684ecfd5cc5cac436788c6be24289d8d6ea1224 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 30 Sep 2021 13:40:48 +0200 Subject: [PATCH 10/26] boards: model avr-based boards Kconfig Modelled boards: arduino-duemilanove arduino-leonardo arduino-mega2560 arduino-nano arduino-uno atmega1284p atmega256rfr2-xpro atmega328p-xplained-mini atmega328p atxmega-a1-xplained atxmega-a1u-xpro atxmega-a3bu-xplained avr-rss2 derfmega128 derfmega256 mega-xplained microduino-corerf zigduino --- boards/arduino-duemilanove/Kconfig | 1 + boards/arduino-leonardo/Kconfig | 1 + boards/arduino-mega2560/Kconfig | 1 + boards/arduino-nano/Kconfig | 1 + boards/arduino-uno/Kconfig | 1 + boards/atmega1284p/Kconfig | 4 ++++ boards/atmega256rfr2-xpro/Kconfig | 6 ++++++ boards/atmega328p-xplained-mini/Kconfig | 3 +++ boards/atmega328p/Kconfig | 3 +++ boards/atxmega-a1-xplained/Kconfig | 3 +++ boards/atxmega-a1u-xpro/Kconfig | 3 +++ boards/atxmega-a3bu-xplained/Kconfig | 3 +++ boards/avr-rss2/Kconfig | 9 +++++++++ boards/derfmega128/Kconfig | 4 ++++ boards/derfmega256/Kconfig | 5 +++++ boards/mega-xplained/Kconfig | 6 ++++++ boards/microduino-corerf/Kconfig | 4 ++++ boards/waspmote-pro/Kconfig | 2 ++ boards/zigduino/Kconfig | 6 ++++++ 19 files changed, 66 insertions(+) diff --git a/boards/arduino-duemilanove/Kconfig b/boards/arduino-duemilanove/Kconfig index 34a36f7d59..f44d119798 100644 --- a/boards/arduino-duemilanove/Kconfig +++ b/boards/arduino-duemilanove/Kconfig @@ -9,6 +9,7 @@ config BOARD_ARDUINO_DUEMILANOVE default y select BOARD_COMMON_ARDUINO_ATMEGA select CPU_MODEL_ATMEGA328P + select MODULE_BOARDS_COMMON_ARDUINO-ATMEGA if TEST_KCONFIG config BOARD default "arduino-duemilanove" if BOARD_ARDUINO_DUEMILANOVE diff --git a/boards/arduino-leonardo/Kconfig b/boards/arduino-leonardo/Kconfig index d97ff4d24b..abaedbbfab 100644 --- a/boards/arduino-leonardo/Kconfig +++ b/boards/arduino-leonardo/Kconfig @@ -12,5 +12,6 @@ config BOARD_ARDUINO_LEONARDO default y select BOARD_COMMON_ARDUINO_ATMEGA select CPU_MODEL_ATMEGA32U4 + select MODULE_BOARDS_COMMON_ARDUINO-ATMEGA if TEST_KCONFIG source "$(RIOTBOARD)/common/arduino-atmega/Kconfig" diff --git a/boards/arduino-mega2560/Kconfig b/boards/arduino-mega2560/Kconfig index a89be64ae1..aeac7061b6 100644 --- a/boards/arduino-mega2560/Kconfig +++ b/boards/arduino-mega2560/Kconfig @@ -12,5 +12,6 @@ config BOARD_ARDUINO_MEGA2560 default y select CPU_MODEL_ATMEGA2560 select BOARD_COMMON_ARDUINO_ATMEGA + select MODULE_BOARDS_COMMON_ARDUINO-ATMEGA if TEST_KCONFIG source "$(RIOTBOARD)/common/arduino-atmega/Kconfig" diff --git a/boards/arduino-nano/Kconfig b/boards/arduino-nano/Kconfig index 2375c2413e..d0831843dd 100644 --- a/boards/arduino-nano/Kconfig +++ b/boards/arduino-nano/Kconfig @@ -9,6 +9,7 @@ config BOARD_ARDUINO_NANO default y select BOARD_COMMON_ARDUINO_ATMEGA select CPU_MODEL_ATMEGA328P + select MODULE_BOARDS_COMMON_ARDUINO-ATMEGA if TEST_KCONFIG config BOARD default "arduino-nano" if BOARD_ARDUINO_NANO diff --git a/boards/arduino-uno/Kconfig b/boards/arduino-uno/Kconfig index acd5da8af9..addd49117b 100644 --- a/boards/arduino-uno/Kconfig +++ b/boards/arduino-uno/Kconfig @@ -9,6 +9,7 @@ config BOARD_ARDUINO_UNO default y select CPU_MODEL_ATMEGA328P select BOARD_COMMON_ARDUINO_ATMEGA + select MODULE_BOARDS_COMMON_ARDUINO-ATMEGA if TEST_KCONFIG config BOARD default "arduino-uno" if BOARD_ARDUINO_UNO diff --git a/boards/atmega1284p/Kconfig b/boards/atmega1284p/Kconfig index 3362613523..dfdf1f3175 100644 --- a/boards/atmega1284p/Kconfig +++ b/boards/atmega1284p/Kconfig @@ -19,3 +19,7 @@ config BOARD_ATMEGA1284P select HAS_PERIPH_SPI select HAS_PERIPH_TIMER select HAS_PERIPH_UART + + select MODULE_BOARDS_COMMON_ATMEGA if TEST_KCONFIG + +source "$(RIOTBOARD)/common/atmega/Kconfig" diff --git a/boards/atmega256rfr2-xpro/Kconfig b/boards/atmega256rfr2-xpro/Kconfig index 1ce778b61c..92bf8b3dae 100644 --- a/boards/atmega256rfr2-xpro/Kconfig +++ b/boards/atmega256rfr2-xpro/Kconfig @@ -18,3 +18,9 @@ config BOARD_ATMEGA256RFR2_XPRO select HAS_PERIPH_SPI select HAS_PERIPH_TIMER select HAS_PERIPH_UART + + select HAVE_SAUL_GPIO + select HAVE_AT30TSE75X + select MODULE_BOARDS_COMMON_ATMEGA if TEST_KCONFIG + +source "$(RIOTBOARD)/common/atmega/Kconfig" diff --git a/boards/atmega328p-xplained-mini/Kconfig b/boards/atmega328p-xplained-mini/Kconfig index d4ec024260..ca8ba2ab14 100644 --- a/boards/atmega328p-xplained-mini/Kconfig +++ b/boards/atmega328p-xplained-mini/Kconfig @@ -22,3 +22,6 @@ config BOARD_ATMEGA328P_XPLAINED_MINI select HAS_PERIPH_TIMER select HAS_PERIPH_UART # Various other features (if any) + select MODULE_BOARDS_COMMON_ATMEGA if TEST_KCONFIG + +source "$(RIOTBOARD)/common/atmega/Kconfig" diff --git a/boards/atmega328p/Kconfig b/boards/atmega328p/Kconfig index 8206fe7376..472aa537f3 100644 --- a/boards/atmega328p/Kconfig +++ b/boards/atmega328p/Kconfig @@ -21,3 +21,6 @@ config BOARD_ATMEGA328P select HAS_PERIPH_TIMER select HAS_PERIPH_UART # Various other features (if any) + select MODULE_BOARDS_COMMON_ATMEGA if TEST_KCONFIG + +source "$(RIOTBOARD)/common/atmega/Kconfig" diff --git a/boards/atxmega-a1-xplained/Kconfig b/boards/atxmega-a1-xplained/Kconfig index c85397f60d..483f642bef 100644 --- a/boards/atxmega-a1-xplained/Kconfig +++ b/boards/atxmega-a1-xplained/Kconfig @@ -18,3 +18,6 @@ config BOARD_ATXMEGA_A1_XPLAINED select HAS_PERIPH_UART select HAVE_SAUL_GPIO + select MODULE_BOARDS_COMMON_ATXMEGA if TEST_KCONFIG + +source "$(RIOTBOARD)/common/atxmega/Kconfig" diff --git a/boards/atxmega-a1u-xpro/Kconfig b/boards/atxmega-a1u-xpro/Kconfig index 6f1cb1ff0e..291709e2a0 100644 --- a/boards/atxmega-a1u-xpro/Kconfig +++ b/boards/atxmega-a1u-xpro/Kconfig @@ -18,3 +18,6 @@ config BOARD_ATXMEGA_A1U_XPRO select HAS_PERIPH_UART select HAVE_SAUL_GPIO + select MODULE_BOARDS_COMMON_ATXMEGA if TEST_KCONFIG + +source "$(RIOTBOARD)/common/atxmega/Kconfig" diff --git a/boards/atxmega-a3bu-xplained/Kconfig b/boards/atxmega-a3bu-xplained/Kconfig index 18217f40b4..db4a45a581 100644 --- a/boards/atxmega-a3bu-xplained/Kconfig +++ b/boards/atxmega-a3bu-xplained/Kconfig @@ -18,3 +18,6 @@ config BOARD_ATXMEGA_A3BU_XPLAINED select HAS_PERIPH_UART select HAVE_SAUL_GPIO + select MODULE_BOARDS_COMMON_ATXMEGA if TEST_KCONFIG + +source "$(RIOTBOARD)/common/atxmega/Kconfig" diff --git a/boards/avr-rss2/Kconfig b/boards/avr-rss2/Kconfig index babf55b13b..2923288f2d 100644 --- a/boards/avr-rss2/Kconfig +++ b/boards/avr-rss2/Kconfig @@ -18,3 +18,12 @@ config BOARD_AVR_RSS2 select HAS_PERIPH_SPI select HAS_PERIPH_TIMER select HAS_PERIPH_UART + + select MODULE_BOARDS_COMMON_ATMEGA if TEST_KCONFIG + select MODULE_ATMEGA_PCINT0 if TEST_KCONFIG + select HAVE_SAUL_GPIO + select HAVE_BME280_I2C + select HAVE_AT24MAC + + +source "$(RIOTBOARD)/common/atmega/Kconfig" diff --git a/boards/derfmega128/Kconfig b/boards/derfmega128/Kconfig index 13002c3f8d..cd32deb878 100644 --- a/boards/derfmega128/Kconfig +++ b/boards/derfmega128/Kconfig @@ -18,3 +18,7 @@ config BOARD_DERFMEGA128 select HAS_PERIPH_SPI select HAS_PERIPH_TIMER select HAS_PERIPH_UART + + select MODULE_BOARDS_COMMON_ATMEGA if TEST_KCONFIG + +source "$(RIOTBOARD)/common/atmega/Kconfig" diff --git a/boards/derfmega256/Kconfig b/boards/derfmega256/Kconfig index fe2a9d0732..8108ec45a4 100644 --- a/boards/derfmega256/Kconfig +++ b/boards/derfmega256/Kconfig @@ -18,3 +18,8 @@ config BOARD_DERFMEGA256 select HAS_PERIPH_SPI select HAS_PERIPH_TIMER select HAS_PERIPH_UART + + select MODULE_BOARDS_COMMON_ATMEGA if TEST_KCONFIG + select MODULE_PERIPH_EEPROM if MODULE_EUI_PROVIDER && HAS_PERIPH_EEPROM + +source "$(RIOTBOARD)/common/atmega/Kconfig" diff --git a/boards/mega-xplained/Kconfig b/boards/mega-xplained/Kconfig index 1bde78c24f..99724c1e4c 100644 --- a/boards/mega-xplained/Kconfig +++ b/boards/mega-xplained/Kconfig @@ -18,3 +18,9 @@ config BOARD_MEGA_XPLAINED select HAS_PERIPH_SPI select HAS_PERIPH_TIMER select HAS_PERIPH_UART + + select MODULE_BOARDS_COMMON_ATMEGA if TEST_KCONFIG + select HAVE_SAUL_ADC + select HAVE_SAUL_GPIO + +source "$(RIOTBOARD)/common/atmega/Kconfig" diff --git a/boards/microduino-corerf/Kconfig b/boards/microduino-corerf/Kconfig index e6e0b59c12..9d880d1aad 100644 --- a/boards/microduino-corerf/Kconfig +++ b/boards/microduino-corerf/Kconfig @@ -19,3 +19,7 @@ config BOARD_MICRODUINO_CORERF select HAS_PERIPH_SPI select HAS_PERIPH_TIMER select HAS_PERIPH_UART + + select MODULE_BOARDS_COMMON_ATMEGA if TEST_KCONFIG + +source "$(RIOTBOARD)/common/atmega/Kconfig" diff --git a/boards/waspmote-pro/Kconfig b/boards/waspmote-pro/Kconfig index 81e78b3a62..81a704be9f 100644 --- a/boards/waspmote-pro/Kconfig +++ b/boards/waspmote-pro/Kconfig @@ -17,3 +17,5 @@ config BOARD_WASPMOTE_PRO select HAS_PERIPH_TIMER select HAS_PERIPH_UART select HAS_ARDUINO + +source "$(RIOTKCONFIG)/Kconfig.ztimer_only" diff --git a/boards/zigduino/Kconfig b/boards/zigduino/Kconfig index b85a28aedd..3b4cae7986 100644 --- a/boards/zigduino/Kconfig +++ b/boards/zigduino/Kconfig @@ -19,3 +19,9 @@ config BOARD_ZIGDUINO select HAS_PERIPH_SPI select HAS_PERIPH_TIMER select HAS_PERIPH_UART + + select MODULE_BOARDS_COMMON_ATMEGA if TEST_KCONFIG + select HAVE_SAUL_ADC + select HAVE_SAUL_GPIO + +source "$(RIOTBOARD)/common/atmega/Kconfig" From 347fb256d574854a9083a2a36e49a44d9f241c9c Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 30 Sep 2021 13:41:31 +0200 Subject: [PATCH 11/26] drivers/at24mac: add Kconfig feature --- drivers/at24mac/Kconfig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/at24mac/Kconfig b/drivers/at24mac/Kconfig index 79c5467c99..2c2791cb28 100644 --- a/drivers/at24mac/Kconfig +++ b/drivers/at24mac/Kconfig @@ -8,4 +8,11 @@ config MODULE_AT24MAC bool "AT24MAC unique ID chip" select MODULE_AT24CXXX + depends on HAS_PERIPH_I2C depends on TEST_KCONFIG + +config HAVE_AT24MAC + bool + select MODULE_AT24MAC if EUI_PROVIDER && HAS_PERIPH_I2C + help + Indicates that an AT24MAC unique ID chip is present. From 7c5630032f3410f522e015fb2561b49a0e92f66e Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 30 Sep 2021 13:41:51 +0200 Subject: [PATCH 12/26] drivers/bmx280: refactor Kconfig model --- drivers/bmx280/Kconfig | 45 ++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/drivers/bmx280/Kconfig b/drivers/bmx280/Kconfig index 8aaa770554..1b45c8d2e0 100644 --- a/drivers/bmx280/Kconfig +++ b/drivers/bmx280/Kconfig @@ -5,20 +5,24 @@ # directory for more details. # -menuconfig MODULE_BMX280 - bool "BMx280 Temperature, pressure and humidity sensors" - depends on TEST_KCONFIG - help - The driver supports both BME280 and BMP280 connected either via SPI or - I2C bus. Select one combination. -choice - bool "Sensor variant" - depends on MODULE_BMX280 +menuconfig MODULE_BMX280 + bool + prompt "BMx280 Temperature, pressure and humidity sensors" if !(MODULE_SAUL_DEFAULT && HAVE_BMX280) + default (MODULE_SAUL_DEFAULT && HAVE_BMX280) + depends on TEST_KCONFIG + +if MODULE_BMX280 + +choice BMX280_VARIANT + bool "Model" default MODULE_BME280_I2C if HAVE_BME280_I2C default MODULE_BME280_SPI if HAVE_BME280_SPI default MODULE_BMP280_I2C if HAVE_BMP280_I2C default MODULE_BMP280_SPI if HAVE_BMP280_SPI + help + The driver supports both BME280 and BMP280 connected either via SPI or + I2C bus. Select one combination. config MODULE_BME280_I2C bool "BME280 on I2C" @@ -46,26 +50,33 @@ config MODULE_BMP280_SPI endchoice +endif # MODULE_BMX280 + config HAVE_BME280_I2C bool - select MODULE_BMX280 if MODULE_SAUL_DEFAULT + select HAVE_BMX280 help - Indicates that a bme280 is present on the I2C bus. + Indicates that a bme280 sensor on the I2C bus is present. config HAVE_BME280_SPI bool - select MODULE_BMX280 if MODULE_SAUL_DEFAULT + select HAVE_BMX280 help - Indicates that a bme280 is present on the SPI bus. + Indicates that a bme280 sensor on the SPI bus is present. config HAVE_BMP280_I2C bool - select MODULE_BMX280 if MODULE_SAUL_DEFAULT + select HAVE_BMX280 help - Indicates that a bmp280 is present on the I2C bus. + Indicates that a bmp280 sensor on the I2C bus is present. config HAVE_BMP280_SPI bool - select MODULE_BMX280 if MODULE_SAUL_DEFAULT + select HAVE_BMX280 help - Indicates that a bmp280 is present on the SPI bus. + Indicates that a bmp280 sensor on the SPI bus is present. + +config HAVE_BMX280 + bool + help + Indicates that a bmx280 sensor is present. From e6789198f872f702f78ab96608961c3df28c90a1 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Fri, 1 Oct 2021 11:54:21 +0200 Subject: [PATCH 13/26] drivers/at24mac/Kconfig: enable as EUI provider when present --- drivers/at24mac/Kconfig | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/at24mac/Kconfig b/drivers/at24mac/Kconfig index 2c2791cb28..9883d8ecd4 100644 --- a/drivers/at24mac/Kconfig +++ b/drivers/at24mac/Kconfig @@ -5,14 +5,18 @@ # directory for more details. # +comment "AT24MAC unique ID chip enabled as default EUI-48/64 provider" + depends on MODULE_EUI_PROVIDER && HAVE_AT24MAC && MODULE_AT24MAC + config MODULE_AT24MAC - bool "AT24MAC unique ID chip" + bool + prompt "AT24MAC unique ID chip" if !(MODULE_EUI_PROVIDER && HAVE_AT24MAC) + default (MODULE_EUI_PROVIDER && HAVE_AT24MAC) select MODULE_AT24CXXX depends on HAS_PERIPH_I2C depends on TEST_KCONFIG config HAVE_AT24MAC bool - select MODULE_AT24MAC if EUI_PROVIDER && HAS_PERIPH_I2C help Indicates that an AT24MAC unique ID chip is present. From 0a19e58fcbac50d7d9114c8fc3eded1a2cda2f15 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Fri, 1 Oct 2021 11:55:01 +0200 Subject: [PATCH 14/26] driver/at30tse75x/Kconfig: enable as default sensor when present --- drivers/at30tse75x/Kconfig | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/at30tse75x/Kconfig b/drivers/at30tse75x/Kconfig index f0def369f1..a028c4a208 100644 --- a/drivers/at30tse75x/Kconfig +++ b/drivers/at30tse75x/Kconfig @@ -5,8 +5,13 @@ # directory for more details. # +comment "AT30TSE75X temperature sensor select by default for the current platform" + depends on MODULE_AT30TSE75X && MODULE_SAUL_DEFAULT && HAVE_AT30TSE75X + config MODULE_AT30TSE75X - bool "AT30TSE75X temperature sensor" + bool + prompt "AT30TSE75X temperature sensor" if !(MODULE_SAUL_DEFAULT && HAVE_AT30TSE75X) + default (MODULE_SAUL_DEFAULT && HAVE_AT30TSE75X) depends on HAS_PERIPH_I2C depends on TEST_KCONFIG select MODULE_PERIPH_I2C @@ -14,3 +19,8 @@ config MODULE_AT30TSE75X select MODULE_ZTIMER_USEC help AT30TSE75x temperature sensor with serial EEPROM. + +config HAVE_AT30TSE75X + bool + help + Indicates that a AT30TSE75x sensor is present on the board. From 3fc6d4247d442a46779c62f5dda9ac97e7882cb9 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Fri, 1 Oct 2021 13:20:16 +0200 Subject: [PATCH 15/26] .murdock: add subset of avr-boards for Kconfig test --- .murdock | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.murdock b/.murdock index 0336fb0b11..6e3e1d606e 100755 --- a/.murdock +++ b/.murdock @@ -8,11 +8,19 @@ : ${TEST_BOARDS_LLVM_COMPILE:=""} : ${TEST_KCONFIG_BOARDS_AVAILABLE:=" +arduino-leonardo +arduino-mega2560 +arduino-nano +atxmega-a1-xplained +atxmega-a3bu-xplained +avr-rss2 cc1352-launchpad cc2650-launchpad +derfmega128 dwm1001 hifive1 mbed_lpc1768 +mega-xplained native nrf52840dk nucleo-f072rb @@ -34,6 +42,7 @@ seeedstudio-gd32 slstk3400a sltb001a slwstk6220a +waspmote-pro "} : ${TEST_KCONFIG_ENFORCE_APP_GROUPS:=" From 845681448d72ec1a9f64c0fb66002ab3711a6382 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Mon, 4 Oct 2021 10:26:33 +0200 Subject: [PATCH 16/26] cpu/atmega_common: move PCINT documentation from boards --- boards/common/atmega/doc.txt | 20 ++++---------------- cpu/atmega_common/doc.txt | 12 ++++++++++++ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/boards/common/atmega/doc.txt b/boards/common/atmega/doc.txt index 516698ecbb..1b6cda3c61 100644 --- a/boards/common/atmega/doc.txt +++ b/boards/common/atmega/doc.txt @@ -1,17 +1,5 @@ /** -@defgroup boards_common_atmega ATmega common -@ingroup boards -@brief Shared files and configuration for ATmega-based boards - -### Pin Change Interrupts - -Pin Change Interrupts (PCINTs) can be enabled using pseudo modules. To provide -a low-memory overhead implementation, the PCINTs are grouped into **banks**. -Each banks corresponds to one PCINT on the ATmega (PCINT0, ..., PCINT3). - -To enable only a specific bank, simply add `USEMODULE += atmega_pcintN` to your -Makefile. To enable all interrupts you can use `USEMODULE += atmega_pcint`. - -In case you want to add a new CPU, simply provide an `atmega_pcint.h` with your -CPU and adapt your Makefile.dep and Makefile.features files. - */ \ No newline at end of file + * @defgroup boards_common_atmega ATmega common + * @ingroup boards + * @brief Shared files and configuration for ATmega-based boards + */ diff --git a/cpu/atmega_common/doc.txt b/cpu/atmega_common/doc.txt index 09d8fb9613..f2ad0d90b9 100644 --- a/cpu/atmega_common/doc.txt +++ b/cpu/atmega_common/doc.txt @@ -2,4 +2,16 @@ * @defgroup cpu_atmega_common Atmel ATmega CPU: common files * @brief AVR Atmega specific code * @ingroup cpu + * + * ### Pin Change Interrupts + * + * Pin Change Interrupts (PCINTs) can be enabled using pseudo modules. To provide + * a low-memory overhead implementation, the PCINTs are grouped into **banks**. + * Each banks corresponds to one PCINT on the ATmega (PCINT0, ..., PCINT3). + * + * To enable only a specific bank, simply add `USEMODULE += atmega_pcintN` to your + * Makefile. To enable all interrupts you can use `USEMODULE += atmega_pcint`. + * + * In case you want to add a new CPU, simply provide an `atmega_pcint.h` with your + * CPU and adapt your Makefile.dep and Makefile.features files. */ From 92b7e5ea53f1c0fd733893bfe5710c4d3f0b3219 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Mon, 1 Nov 2021 11:44:17 +0100 Subject: [PATCH 17/26] cpu/atxmega: fix dependency --- cpu/atxmega/Makefile.dep | 2 +- cpu/atxmega/periph/Kconfig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cpu/atxmega/Makefile.dep b/cpu/atxmega/Makefile.dep index b9244839c9..43da1e7f66 100644 --- a/cpu/atxmega/Makefile.dep +++ b/cpu/atxmega/Makefile.dep @@ -4,7 +4,7 @@ USEMODULE += atxmega_periph # All ATxmega based CPUs provide PM USEMODULE += pm_layered -ifeq (,$(filter cpuid,$(USEMODULE))) +ifneq (,$(filter periph_cpuid,$(USEMODULE))) USEMODULE += periph_nvm endif diff --git a/cpu/atxmega/periph/Kconfig b/cpu/atxmega/periph/Kconfig index 663d70970a..8b6a188e2d 100644 --- a/cpu/atxmega/periph/Kconfig +++ b/cpu/atxmega/periph/Kconfig @@ -17,6 +17,6 @@ config MODULE_PERIPH_NVM bool depends on MODULE_ATXMEGA_PERIPH depends on HAS_PERIPH_NVM - default y if MODULE_CPUID + default y if MODULE_PERIPH_CPUID help Internal ATXmega Non Volatile Memory (NVM) driver. From e525e231435a4ef4bef5e23e16b54205f4778711 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 11 Nov 2021 14:13:55 +0100 Subject: [PATCH 18/26] drivers/dfplayer: add no_strerror option to Kconfig --- drivers/dfplayer/Kconfig | 13 ++++++++++++- drivers/dfplayer/Makefile.include | 2 +- sys/shell/commands/sc_dfplayer.c | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/dfplayer/Kconfig b/drivers/dfplayer/Kconfig index 1e72cdcce4..a59d6342d4 100644 --- a/drivers/dfplayer/Kconfig +++ b/drivers/dfplayer/Kconfig @@ -5,7 +5,7 @@ # directory for more details. # -config MODULE_DFPLAYER +menuconfig MODULE_DFPLAYER bool "DFPlayer Mini MP3 Player" depends on HAS_PERIPH_UART depends on HAS_PERIPH_GPIO @@ -16,3 +16,14 @@ config MODULE_DFPLAYER select HAVE_MULTIMEDIA_DEVICE # Perhaps this could be moved to its own symbol to enable the dfplayer commands select MODULE_FMT if MODULE_SHELL_COMMANDS + +config DFPLAYER_NO_STRERROR + bool + prompt "Avoid using strerror in shell command" if !(HAS_ARCH_AVR8 || HAS_ARCH_MSP430) + depends on MODULE_DFPLAYER + depends on MODULE_SHELL_COMMANDS + # no strerror() on AVR and MSP430 + default y if (HAS_ARCH_AVR8 || HAS_ARCH_MSP430) + help + Say y to print error codes as numbers when using the shell, instead of the corresponding + standard error string. diff --git a/drivers/dfplayer/Makefile.include b/drivers/dfplayer/Makefile.include index 375b43386a..a5fb5c0bda 100644 --- a/drivers/dfplayer/Makefile.include +++ b/drivers/dfplayer/Makefile.include @@ -3,5 +3,5 @@ USEMODULE_INCLUDES += $(USEMODULE_INCLUDES_dfplayer) ifneq (,$(filter arch_avr8 arch_msp430,$(FEATURES_USED))) # no strerror() on AVR and MSP430 - CFLAGS += -DDFPLAYER_NO_STRERROR + CFLAGS += -DCONFIG_DFPLAYER_NO_STRERROR endif diff --git a/sys/shell/commands/sc_dfplayer.c b/sys/shell/commands/sc_dfplayer.c index 8c5a54040b..45fdc69d5d 100644 --- a/sys/shell/commands/sc_dfplayer.c +++ b/sys/shell/commands/sc_dfplayer.c @@ -56,7 +56,7 @@ static const char *_states[] = { static void _print_error(int retval) { print_str("Error: "); -#ifdef DFPLAYER_NO_STRERROR +#ifdef CONFIG_DFPLAYER_NO_STRERROR print_s32_dec(retval); #else print_str(strerror(-retval)); From 3bdbd67b70fc01aab1caeacc7ced19c781d4c1c4 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 11 Nov 2021 15:19:31 +0100 Subject: [PATCH 19/26] tests/driver_ili9341: add NO_RIOT_IMAGE option to Kconfig --- tests/driver_ili9341/Kconfig | 15 +++++++++++++++ tests/driver_ili9341/Makefile | 16 ++++++++++------ tests/driver_ili9341/main.c | 2 +- 3 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 tests/driver_ili9341/Kconfig diff --git a/tests/driver_ili9341/Kconfig b/tests/driver_ili9341/Kconfig new file mode 100644 index 0000000000..16c54fe995 --- /dev/null +++ b/tests/driver_ili9341/Kconfig @@ -0,0 +1,15 @@ +# 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 NO_RIOT_IMAGE + bool + prompt "Avoid showing the RIOT logo on the test" if !HAS_ARCH_AVR8 + # the logo does not usually fit in AVR8 + default y if HAS_ARCH_AVR8 + help + Say y to avoid loading the RIOT logo on the test application. Useful for architectures + storing it in a limited RAM. diff --git a/tests/driver_ili9341/Makefile b/tests/driver_ili9341/Makefile index 47d5327a66..aa686e9ba7 100644 --- a/tests/driver_ili9341/Makefile +++ b/tests/driver_ili9341/Makefile @@ -5,15 +5,19 @@ USEMODULE += ili9341 USEMODULE += ztimer USEMODULE += ztimer_msec +# As there is an 'Kconfig' we want to explicitly disable Kconfig by setting +# the variable to empty +SHOULD_RUN_KCONFIG ?= + include $(RIOTBASE)/Makefile.include # Check if being configured via Kconfig ifndef CONFIG_KCONFIG_USEMODULE_ILI9341 -CFLAGS += -DCONFIG_ILI9341_LE_MODE -endif + CFLAGS += -DCONFIG_ILI9341_LE_MODE -# The AVR architecture stores the image in the RAM, this usually doesn't fit. -# This flag excludes the image from the test -ifneq (,$(filter arch_avr8,$(FEATURES_USED))) - CFLAGS += -DNO_RIOT_IMAGE + # The AVR architecture stores the image in the RAM, this usually doesn't fit. + # This flag excludes the image from the test + ifneq (,$(filter arch_avr8,$(FEATURES_USED))) + CFLAGS += -DCONFIG_NO_RIOT_IMAGE + endif endif diff --git a/tests/driver_ili9341/main.c b/tests/driver_ili9341/main.c index b817a062eb..9e0d6a17c6 100644 --- a/tests/driver_ili9341/main.c +++ b/tests/driver_ili9341/main.c @@ -75,7 +75,7 @@ int main(void) /* Make the same square black again */ ili9341_fill(&dev, 10, 59, 10, 109, 0x0000); -#ifndef NO_RIOT_IMAGE +#ifndef CONFIG_NO_RIOT_IMAGE /* Approximate middle of the display */ ili9341_pixmap(&dev, 95, 222, 85, 153, (const uint16_t *)picture); #endif From 70363887691d46bb44f9ff8ed47ce8293b63b6f8 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 11 Nov 2021 15:37:01 +0100 Subject: [PATCH 20/26] drivers/periph_common: add RTC ms module to Kconfig --- drivers/periph_common/Kconfig.rtc | 14 ++++++++++++-- makefiles/features_modules.inc.mk | 1 + tests/periph_rtc/Kconfig | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/periph_common/Kconfig.rtc b/drivers/periph_common/Kconfig.rtc index 080b4361d6..4999efebd6 100644 --- a/drivers/periph_common/Kconfig.rtc +++ b/drivers/periph_common/Kconfig.rtc @@ -5,15 +5,25 @@ # directory for more details. # -config MODULE_PERIPH_RTC +menuconfig MODULE_PERIPH_RTC bool "RTC peripheral driver" depends on HAS_PERIPH_RTC select MODULE_PERIPH_COMMON +if MODULE_PERIPH_RTC + config MODULE_PERIPH_INIT_RTC bool "Auto initialize RTC peripheral" default y if MODULE_PERIPH_INIT - depends on MODULE_PERIPH_RTC + +config MODULE_PERIPH_RTC_MS + bool "Support for time with sub-second component" + depends on HAS_PERIPH_RTC_MS + help + Provides an interface to access the RTC time with a sub-second + component. + +endif #MODULE_PERIPH_RTC config MODULE_PERIPH_RTC_MEM bool "Low-Power RTC Memory" diff --git a/makefiles/features_modules.inc.mk b/makefiles/features_modules.inc.mk index abde96c438..67de88cdec 100644 --- a/makefiles/features_modules.inc.mk +++ b/makefiles/features_modules.inc.mk @@ -14,6 +14,7 @@ ifneq (,$(filter periph_init, $(USEMODULE))) PERIPH_IGNORE_MODULES := \ periph_init% \ periph_common \ + periph_rtc_ms \ periph_rtc_rtt \ periph_clic \ periph_coretimer \ diff --git a/tests/periph_rtc/Kconfig b/tests/periph_rtc/Kconfig index 6384225e04..28f35f69f8 100644 --- a/tests/periph_rtc/Kconfig +++ b/tests/periph_rtc/Kconfig @@ -9,3 +9,4 @@ config APPLICATION bool default y imply MODULE_PERIPH_RTC_MEM + imply MODULE_PERIPH_RTC_MS From 584052ec6e524d1f9c37032b795b265c02fd172c Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Fri, 12 Nov 2021 11:29:50 +0100 Subject: [PATCH 21/26] pkg/libfixmath: add compile options to Kconfig The option list has been taken from https://code.google.com/archive/p/libfixmath/wikis/CompilationOptions.wiki. The defaults are the current ones. --- pkg/libfixmath/Kconfig | 60 +++++++++++++++++++++++++++++++++ pkg/libfixmath/Makefile.include | 4 +++ 2 files changed, 64 insertions(+) diff --git a/pkg/libfixmath/Kconfig b/pkg/libfixmath/Kconfig index 48eb8b0abe..1160387489 100644 --- a/pkg/libfixmath/Kconfig +++ b/pkg/libfixmath/Kconfig @@ -19,4 +19,64 @@ config MODULE_LIBFIXMATH_UNITTESTS depends on !HAS_ARCH_8BIT depends on !HAS_MSP430 +menu "Accuracy" + +config FIXMATH_NO_ROUNDING + bool "Disable rounding" + help + Say y to disable rounding. Results may round randomly up or down, i.e. + their accuracy is +-1. Runs slightly faster. + +config FIXMATH_NO_OVERFLOW + bool "Disable overflow detection" + help + Say y to disable overflow detection and saturating arithmetic support. + Overflowing computations will give garbage results. Runs slightly + faster. + +endmenu + +menu "Platform" + +config FIXMATH_NO_64BIT + bool "Disable use of uint64_t" + help + Say y to disable use of uint64_t in the code. Meant for compilers that + do not have 64-bit support. Runs the same speed or slightly slower. + +config FIXMATH_OPTIMIZE_8BIT + bool "Optimize for 8-bit architectures" + default y if HAS_ARCH_8BIT + help + Say y to use variants of the functions that are suitable for small 8- and + 16-bit processors. Much faster on those processors, much slower on 32-bit + processors. + +config FIXMATH_NO_CACHE + bool "Do not use cache" + default y + help + Say y to avoid using cache for exp etc. function results. Uses less RAM, + runs slightly slower. + +endmenu + +menu "Algorithms" + +config FIXMATH_SIN_LUT + bool "Use sin look-up table generated by fixsingen" + help + Say y to use a look-up table generated by the fixsingen tool from svn, + it is faster on some devices but the lookup table takes up ~200KiB + (205376 bytes) in memory and can be slower depending on usage. + +config FIXMATH_FAST_SIN + bool "Fast sin approximation" + help + Say y to enable a faster but less accurate approximation of the sin + function, for code where accuracy isn't as important such as games logic + or graphics rendering then this is often a worthwhile tradeoff. + +endmenu + endif # PACKAGE_LIBFIXMATH diff --git a/pkg/libfixmath/Makefile.include b/pkg/libfixmath/Makefile.include index 92e4cb6266..c85b62aef4 100644 --- a/pkg/libfixmath/Makefile.include +++ b/pkg/libfixmath/Makefile.include @@ -7,6 +7,10 @@ ifneq (,$(filter arch_8bit,$(FEATURES_USED))) CFLAGS += -DFIXMATH_OPTIMIZE_8BIT endif +# translate Kconfig options to CFLAGS for the package +libfixmath_options = $(filter CONFIG_FIXMATH_%,$(.VARIABLES)) +CFLAGS += $(libfixmath_options:CONFIG_FIXMATH_%=-DFIXMATH_%) + INCLUDES += -I$(PKG_SOURCE_DIR)/libfixmath ifneq (,$(filter libfixmath-unittests,$(USEMODULE))) From 6769101c342d9fea5a2fdd2534662b760bce531b Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Fri, 12 Nov 2021 11:54:22 +0100 Subject: [PATCH 22/26] sys/arduino: add pseudomodule for the arduino_pwm feature --- makefiles/features_modules.inc.mk | 3 +++ sys/arduino/Makefile.include | 2 ++ 2 files changed, 5 insertions(+) diff --git a/makefiles/features_modules.inc.mk b/makefiles/features_modules.inc.mk index 67de88cdec..b0e055b2b6 100644 --- a/makefiles/features_modules.inc.mk +++ b/makefiles/features_modules.inc.mk @@ -69,3 +69,6 @@ USEMODULE += $(filter efm32_coretemp, $(FEATURES_USED)) # if LC filter(s) is attached to the CPUs voltage regulator, use it USEMODULE += $(filter vdd_lc_filter_%,$(FEATURES_USED)) + +# select arduino_pwm pseudomodule if the corresponding feature is used +USEMODULE += $(filter arduino_pwm, $(FEATURES_USED)) diff --git a/sys/arduino/Makefile.include b/sys/arduino/Makefile.include index fba73396d7..c9a218d7db 100644 --- a/sys/arduino/Makefile.include +++ b/sys/arduino/Makefile.include @@ -24,3 +24,5 @@ INCLUDES += -I$(RIOTBASE)/sys/arduino/include # package, which is __horrible__ out of date. However, we cannot simply ignore # all Ubuntu users and instead simply manually enable C++11 support CXXEXFLAGS += -std=c++11 + +PSEUDOMODULES += arduino_pwm From 37b0e30a718eecbe123db254e09f09374f011671 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Fri, 12 Nov 2021 12:36:44 +0100 Subject: [PATCH 23/26] pkg/qdsa: use pseudomodules to select implementation --- pkg/qdsa/Kconfig | 20 ++++++++++++++++++-- pkg/qdsa/Makefile | 2 +- pkg/qdsa/Makefile.dep | 10 ++++++++++ pkg/qdsa/Makefile.include | 16 ++++------------ 4 files changed, 33 insertions(+), 15 deletions(-) diff --git a/pkg/qdsa/Kconfig b/pkg/qdsa/Kconfig index 2f4ad5864d..8b470f7ed8 100644 --- a/pkg/qdsa/Kconfig +++ b/pkg/qdsa/Kconfig @@ -9,12 +9,28 @@ config PACKAGE_QDSA bool "qDSA Digital Signatures package" depends on TEST_KCONFIG depends on !HAS_ARCH_16BIT - select MODULE_QDSA_ASM if HAS_ARCH_AVR8 || CPU_CORE_CORTEX_M23 - select MODULE_QDSA_ASM if CPU_CORE_CORTEX_M0 || CPU_CORE_CORTEX_M0PLUS help Small and Secure Digital Signatures with Curve-based Diffie-Hellman Key Pairs. +if PACKAGE_QDSA + config MODULE_QDSA_ASM bool + default y if HAS_ARCH_AVR8 || CPU_CORE_CORTEX_M23 + default y if CPU_CORE_CORTEX_M0 || CPU_CORE_CORTEX_M0PLUS depends on TEST_KCONFIG + +config MODULE_QDSA_IMPL_ARM + bool + default y if CPU_CORE_CORTEX_M23 || CPU_CORE_CORTEX_M0 || CPU_CORE_CORTEX_M0PLUS + +config MODULE_QDSA_IMPL_AVR + bool + default y if HAS_ARCH_AVR8 + +config MODULE_QDSA_IMPL_CREF + bool + default y if !MODULE_QDSA_IMPL_ARM && !MODULE_QDSA_IMPL_AVR + +endif # PACKAGE_QDSA diff --git a/pkg/qdsa/Makefile b/pkg/qdsa/Makefile index 6c4035c4ca..061abd8fce 100644 --- a/pkg/qdsa/Makefile +++ b/pkg/qdsa/Makefile @@ -6,4 +6,4 @@ PKG_LICENSE=PD include $(RIOTBASE)/pkg/pkg.mk all: - $(QQ)"$(MAKE)" -C $(PKG_SOURCE_DIR)/$(QDSA_IMPL) + $(QQ)"$(MAKE)" -C $(PKG_SOURCE_DIR)/$(patsubst qdsa_impl_%,%,$(filter qdsa_impl_%,$(USEMODULE))) diff --git a/pkg/qdsa/Makefile.dep b/pkg/qdsa/Makefile.dep index dbf3943b42..5590d615e3 100644 --- a/pkg/qdsa/Makefile.dep +++ b/pkg/qdsa/Makefile.dep @@ -6,5 +6,15 @@ ifneq (,$(filter arch_avr8,$(FEATURES_USED))) USEMODULE += qdsa_asm endif +ifeq (,$(filter qdsa_impl_%,$(USEMODULE))) + ifneq (,$(filter cortex-m23 cortex-m0%,$(CPU_CORE))) + USEMODULE += qdsa_impl_arm + else ifneq (,$(filter arch_avr8,$(FEATURES_USED))) + USEMODULE += qdsa_impl_avr + else + USEMODULE += qdsa_impl_cref + endif +endif + # qDsa is not 16 bit compatible FEATURES_BLACKLIST += arch_16bit diff --git a/pkg/qdsa/Makefile.include b/pkg/qdsa/Makefile.include index 245e84adc3..9a41247f74 100644 --- a/pkg/qdsa/Makefile.include +++ b/pkg/qdsa/Makefile.include @@ -1,16 +1,8 @@ -ifneq (,$(filter cortex-m23 cortex-m0%,$(CPU_CORE))) - QDSA_IMPL ?= arm -else - ifneq (,$(filter arch_avr8,$(FEATURES_USED))) - QDSA_IMPL ?= avr - else - QDSA_IMPL ?= cref - endif -endif +PSEUDOMODULES += qdsa_impl_arm +PSEUDOMODULES += qdsa_impl_avr +PSEUDOMODULES += qdsa_impl_cref -export QDSA_IMPL - -INCLUDES += -I$(PKGDIRBASE)/qdsa/$(QDSA_IMPL) +INCLUDES += -I$(PKGDIRBASE)/qdsa/$(patsubst qdsa_impl_%,%,$(filter qdsa_impl_%,$(USEMODULE))) ifeq (cortex-m0plus,$(CPU_CORE)) # There are problems with the LLVM assembler and the Cortex-M0+ instruction From 27a62efb63ae0c602c91c83e7b65df81bce531ed Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Fri, 12 Nov 2021 18:21:55 +0100 Subject: [PATCH 24/26] sys/arduino/kconfig: do not imply arduino_pwm --- sys/arduino/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/arduino/Kconfig b/sys/arduino/Kconfig index 6338e392d5..68ba7b80b7 100644 --- a/sys/arduino/Kconfig +++ b/sys/arduino/Kconfig @@ -10,7 +10,6 @@ config MODULE_ARDUINO_SKETCHES menuconfig MODULE_ARDUINO bool "Arduino support" - imply MODULE_ARDUINO_PWM imply MODULE_PERIPH_ADC imply MODULE_PERIPH_I2C imply MODULE_PERIPH_SPI From 5abe0032cc15da538fd39f83f67b06c0d67c1214 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 18 Nov 2021 15:35:15 +0100 Subject: [PATCH 25/26] pkg/nanocbor/kconfig: remove architecture dependency --- pkg/nanocbor/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/nanocbor/Kconfig b/pkg/nanocbor/Kconfig index 2c7d7aceb6..043785e9e7 100644 --- a/pkg/nanocbor/Kconfig +++ b/pkg/nanocbor/Kconfig @@ -8,4 +8,3 @@ config PACKAGE_NANOCBOR bool "NANOCBOR encoder and decoder library package" depends on TEST_KCONFIG - depends on HAS_ARCH_32BIT From 43c567ab530fb72e0b287960eb5008809969e14e Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Fri, 19 Nov 2021 12:14:02 +0100 Subject: [PATCH 26/26] sys/shell/commands/sc_dfplayer: make cppcheck happy --- sys/shell/commands/sc_dfplayer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/shell/commands/sc_dfplayer.c b/sys/shell/commands/sc_dfplayer.c index 45fdc69d5d..b41683fa11 100644 --- a/sys/shell/commands/sc_dfplayer.c +++ b/sys/shell/commands/sc_dfplayer.c @@ -377,7 +377,7 @@ int _sc_dfplayer(int argc, char **argv) } if (!strcmp("files", argv[pos])) { - if (++pos != argc) { + if ((pos + 1) != argc) { print_str("Error: Expected no parameter for argument \"files\"\n"); return 1; }