diff --git a/Kconfig b/Kconfig index a5ea17d0e3..75fb259853 100644 --- a/Kconfig +++ b/Kconfig @@ -12,6 +12,9 @@ rsource "kconfigs/Kconfig.consts" # Load feature declarations rsource "kconfigs/Kconfig.features" +# Load error symbols +rsource "kconfigs/Kconfig.errors" + # For now, get used modules as macros from this file (see kconfig.mk) osource "$(KCONFIG_GENERATED_DEPENDENCIES)" @@ -33,6 +36,9 @@ rsource "pkg/Kconfig" comment "RIOT is in a migration phase." comment "Some configuration options may not be here. Use CFLAGS instead." +comment "!! ERROR: There are conflicting modules active !!" + depends on ERROR_MODULES_CONFLICT != "" + config TEST_KCONFIG bool default y if '$(TEST_KCONFIG)' = '1' diff --git a/boards/stm32f4discovery/Kconfig b/boards/stm32f4discovery/Kconfig index c18869f17a..c5a92163c4 100644 --- a/boards/stm32f4discovery/Kconfig +++ b/boards/stm32f4discovery/Kconfig @@ -27,3 +27,7 @@ config BOARD_STM32F4DISCOVERY # Various other features (if any) select HAS_ARDUINO + +config ERROR_MODULES_CONFLICT + default "On stm32f4discovery boards there are the same pins for the DAC and/or SPI_0." if MODULE_PERIPH_SPI && MODULE_PERIPH_DAC + depends on BOARD_STM32F4DISCOVERY diff --git a/cpu/atmega_common/Kconfig b/cpu/atmega_common/Kconfig index 3748434b00..fca23e122b 100644 --- a/cpu/atmega_common/Kconfig +++ b/cpu/atmega_common/Kconfig @@ -68,3 +68,7 @@ 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 diff --git a/cpu/efm32/Kconfig b/cpu/efm32/Kconfig index 03f45d03ef..a14d8cccd3 100644 --- a/cpu/efm32/Kconfig +++ b/cpu/efm32/Kconfig @@ -37,5 +37,9 @@ config HAS_CPU_EFM32 config CPU default "efm32" if CPU_COMMON_EFM32 +config ERROR_MODULES_CONFLICT + default "On the EFM32, the RTC and RTT map to the same hardware peripheral." if MODULE_PERIPH_RTC && MODULE_PERIPH_RTT + depends on CPU_COMMON_EFM32 + orsource "families/*/Kconfig" source "$(RIOTCPU)/cortexm_common/Kconfig" diff --git a/cpu/sam0_common/Kconfig b/cpu/sam0_common/Kconfig index 9a525df6fc..333e15dc00 100644 --- a/cpu/sam0_common/Kconfig +++ b/cpu/sam0_common/Kconfig @@ -28,6 +28,9 @@ if CPU_COMMON_SAM0 rsource "periph/Kconfig" +config ERROR_MODULES_CONFLICT + default "On SAM0, the RTC and RTT map to the same hardware peripheral." if MODULE_PERIPH_RTC && MODULE_PERIPH_RTT + endif # CPU_COMMON_SAM0 source "$(RIOTCPU)/cortexm_common/Kconfig" diff --git a/cpu/stm32/Kconfig b/cpu/stm32/Kconfig index 324ad8de7a..8a96cde81d 100644 --- a/cpu/stm32/Kconfig +++ b/cpu/stm32/Kconfig @@ -32,7 +32,12 @@ config HAS_BOOTLOADER_STM32 help Indicates that the stm32 bootloader is being used. +config ERROR_MODULES_CONFLICT + default "On STM32, the RTC and RTT map to the same hardware peripheral." if MODULE_PERIPH_RTC && MODULE_PERIPH_RTT + depends on CPU_STM32 + orsource "kconfig/*/Kconfig" orsource "kconfig/*/Kconfig.lines" orsource "kconfig/*/Kconfig.models" + source "$(RIOTCPU)/cortexm_common/Kconfig" diff --git a/kconfigs/Kconfig.errors b/kconfigs/Kconfig.errors new file mode 100644 index 0000000000..46ef792405 --- /dev/null +++ b/kconfigs/Kconfig.errors @@ -0,0 +1,20 @@ +# Copyright (c) 2020 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. +# + +# Definition of common error symbols. To indicate an error set the default value +# to the correspondent symbol guarded with the error condition. e.g.: +# +# config ERROR_MODULES_CONFLICT +# default "On SAM0 platforms RTT and RTC cannot be set at the same time" +# depends on MODULE_PERIPH_RTC && MODULE_PERIPH_RTT && CPU_COMMON_SAM0 +# + +config ERROR_MODULES_CONFLICT + string + help + Used to indicate that conflicting modules (i.e. modules that can't be + active at the same time) are being used together.