mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #13404 from leandrolanzieri/pr/boards/samr21-xpro/features_kconfig
boards/samr21-xpro: Model features in Kconfig
This commit is contained in:
commit
972d9441ce
23
boards/samr21-xpro/Kconfig
Normal file
23
boards/samr21-xpro/Kconfig
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# 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.
|
||||||
|
|
||||||
|
config BOARD
|
||||||
|
default "samr21-xpro" if BOARD_SAMR21_XPRO
|
||||||
|
|
||||||
|
config BOARD_SAMR21_XPRO
|
||||||
|
bool
|
||||||
|
default y
|
||||||
|
select CPU_MODEL_SAMR21G18A
|
||||||
|
select HAS_PERIPH_ADC
|
||||||
|
select HAS_PERIPH_I2C
|
||||||
|
select HAS_PERIPH_PWM
|
||||||
|
select HAS_PERIPH_RTC
|
||||||
|
select HAS_PERIPH_RTT
|
||||||
|
select HAS_PERIPH_SPI
|
||||||
|
select HAS_PERIPH_TIMER
|
||||||
|
select HAS_PERIPH_UART
|
||||||
|
select HAS_PERIPH_USBDEV
|
||||||
|
select HAS_RIOTBOOT
|
@ -5,9 +5,26 @@
|
|||||||
# directory for more details.
|
# directory for more details.
|
||||||
#
|
#
|
||||||
|
|
||||||
config CPU_FAMILY_SAM0
|
config CPU_COMMON_SAM0
|
||||||
bool
|
bool
|
||||||
default y
|
select HAS_PERIPH_CPUID
|
||||||
select HAS_WDT_WARNING_PERIOD
|
select HAS_PERIPH_FLASHPAGE
|
||||||
|
select HAS_PERIPH_FLASHPAGE_RAW
|
||||||
|
select HAS_PERIPH_FLASHPAGE_RWEE
|
||||||
|
select HAS_PERIPH_GPIO
|
||||||
|
select HAS_PERIPH_GPIO_IRQ
|
||||||
|
select HAS_PERIPH_I2C_RECONFIGURE
|
||||||
|
select HAS_PERIPH_TIMER_PERIODIC
|
||||||
|
select HAS_PERIPH_UART_MODECFG
|
||||||
|
select HAS_PERIPH_UART_NONBLOCKING
|
||||||
|
select HAS_PERIPH_WDT
|
||||||
|
select HAS_PERIPH_WDT_CB
|
||||||
|
select HAS_PERIPH_WDT_WARNING_PERIOD
|
||||||
|
|
||||||
|
if CPU_COMMON_SAM0
|
||||||
|
|
||||||
rsource "periph/Kconfig"
|
rsource "periph/Kconfig"
|
||||||
|
|
||||||
|
endif # CPU_COMMON_SAM0
|
||||||
|
|
||||||
|
source "$(RIOTCPU)/cortexm_common/Kconfig"
|
||||||
|
@ -5,5 +5,5 @@
|
|||||||
# directory for more details.
|
# directory for more details.
|
||||||
|
|
||||||
config WDT_WARNING_PERIOD
|
config WDT_WARNING_PERIOD
|
||||||
depends on HAS_WDT_WARNING_PERIOD && KCONFIG_MODULE_PERIPH_WDT
|
depends on HAS_PERIPH_WDT_WARNING_PERIOD && KCONFIG_MODULE_PERIPH_WDT
|
||||||
default 1
|
default 1
|
||||||
|
@ -5,4 +5,56 @@
|
|||||||
# directory for more details.
|
# directory for more details.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
config CPU_FAMILY_SAMD2X
|
||||||
|
bool
|
||||||
|
select CPU_CORE_CORTEX_M0PLUS
|
||||||
|
select CPU_COMMON_SAM0
|
||||||
|
|
||||||
|
config CPU_SERIES_SAMD21
|
||||||
|
bool
|
||||||
|
select CPU_FAMILY_SAMD2X
|
||||||
|
select HAS_CPU_SAMD21
|
||||||
|
select HAS_PUF_SRAM
|
||||||
|
|
||||||
|
## CPU Models
|
||||||
|
config CPU_MODEL_SAMD21E18A
|
||||||
|
bool
|
||||||
|
select CPU_SERIES_SAMD21
|
||||||
|
|
||||||
|
config CPU_MODEL_SAMD21G18A
|
||||||
|
bool
|
||||||
|
select CPU_SERIES_SAMD21
|
||||||
|
|
||||||
|
config CPU_MODEL_SAMD21J18A
|
||||||
|
bool
|
||||||
|
select CPU_SERIES_SAMD21
|
||||||
|
|
||||||
|
config CPU_MODEL_SAMR21E18A
|
||||||
|
bool
|
||||||
|
select CPU_SERIES_SAMD21
|
||||||
|
|
||||||
|
config CPU_MODEL_SAMR21G18A
|
||||||
|
bool
|
||||||
|
select CPU_SERIES_SAMD21
|
||||||
|
|
||||||
|
## Definition of specific features
|
||||||
|
config HAS_CPU_SAMD21
|
||||||
|
bool
|
||||||
|
help
|
||||||
|
Indicates that a 'samd21' cpu is being used.
|
||||||
|
|
||||||
|
## Common CPU symbols
|
||||||
|
config CPU_FAMILY
|
||||||
|
default "samd2x" if CPU_FAMILY_SAMD2X
|
||||||
|
|
||||||
|
config CPU_SERIES
|
||||||
|
default "samd21" if CPU_SERIES_SAMD21
|
||||||
|
|
||||||
|
config CPU_MODEL
|
||||||
|
default "samd21e18a" if CPU_MODEL_SAMD21E18A
|
||||||
|
default "samd21g18a" if CPU_MODEL_SAMD21G18A
|
||||||
|
default "samd21j18a" if CPU_MODEL_SAMD21J18A
|
||||||
|
default "samr21e18a" if CPU_MODEL_SAMR21E18A
|
||||||
|
default "samr21g18a" if CPU_MODEL_SAMR21G18A
|
||||||
|
|
||||||
source "$(RIOTCPU)/sam0_common/Kconfig"
|
source "$(RIOTCPU)/sam0_common/Kconfig"
|
||||||
|
@ -14,13 +14,13 @@ if KCONFIG_MODULE_PERIPH_WDT
|
|||||||
|
|
||||||
config WDT_WARNING_PERIOD
|
config WDT_WARNING_PERIOD
|
||||||
int "Warning period (in ms)"
|
int "Warning period (in ms)"
|
||||||
depends on HAS_WDT_WARNING_PERIOD
|
depends on HAS_PERIPH_WDT_WARNING_PERIOD
|
||||||
help
|
help
|
||||||
Period in ms before reboot where wdt_cb() is executed.
|
Period in ms before reboot where wdt_cb() is executed.
|
||||||
|
|
||||||
endif # KCONFIG_MODULE_PERIPH_WDT
|
endif # KCONFIG_MODULE_PERIPH_WDT
|
||||||
|
|
||||||
config HAS_WDT_WARNING_PERIOD
|
config HAS_PERIPH_WDT_WARNING_PERIOD
|
||||||
bool
|
bool
|
||||||
help
|
help
|
||||||
Indicates that a CPU provides a warning period configuration option.
|
Indicates that a CPU provides a warning period configuration option.
|
||||||
|
@ -210,6 +210,12 @@ config HAS_PERIPH_TIMER
|
|||||||
help
|
help
|
||||||
Indicates that a Timer peripheral is present.
|
Indicates that a Timer peripheral is present.
|
||||||
|
|
||||||
|
config HAS_PERIPH_TIMER_PERIODIC
|
||||||
|
bool
|
||||||
|
help
|
||||||
|
Indicates that the Timer peripheral provides the periodic timeout
|
||||||
|
functionality.
|
||||||
|
|
||||||
config HAS_PERIPH_UART
|
config HAS_PERIPH_UART
|
||||||
bool
|
bool
|
||||||
help
|
help
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#
|
#
|
||||||
# And when comparing two revisions, include the revision in the file names
|
# And when comparing two revisions, include the revision in the file names
|
||||||
|
|
||||||
.PHONY: dependency-debug
|
.PHONY: dependency-debug dependency-debug-features-provided-kconfig
|
||||||
# Only generate the dependencies when the board is not disabled
|
# Only generate the dependencies when the board is not disabled
|
||||||
# This will allow comparing with the output of `info-boards-supported` more easily
|
# This will allow comparing with the output of `info-boards-supported` more easily
|
||||||
dependency-debug:
|
dependency-debug:
|
||||||
@ -35,6 +35,17 @@ else
|
|||||||
@echo Skipping $(BOARD) is not whitelisted or blacklisted
|
@echo Skipping $(BOARD) is not whitelisted or blacklisted
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Generate a list of features for an specific board from Kconfig symbols. Make
|
||||||
|
# sure that SHOULD_RUN_KCONFIG variable is set
|
||||||
|
dependency-debug-features-provided-kconfig: $(KCONFIG_OUT_CONFIG)
|
||||||
|
@for i in $(sort $(FEATURES_PROVIDED_KCONFIG)); do echo $$i; done
|
||||||
|
|
||||||
|
# Variable to debug modeled features in Kconfig files. As a convention features
|
||||||
|
# are represented by symbols with the `HAS_` prefix (so
|
||||||
|
# FEATURES_PROVIDED += periph_gpio would be HAS_PERIPH_GPIO). This filters
|
||||||
|
# all the generated symbols beginning with that prefix.
|
||||||
|
FEATURES_PROVIDED_KCONFIG = $(call lowercase,$(patsubst CONFIG_HAS_%,%,$(filter CONFIG_HAS_%, $(.VARIABLES))))
|
||||||
|
|
||||||
DEPENDENCY_DEBUG_OUTPUT_DIR ?= $(CURDIR)
|
DEPENDENCY_DEBUG_OUTPUT_DIR ?= $(CURDIR)
|
||||||
|
|
||||||
# Save variables that are used for parsing dependencies
|
# Save variables that are used for parsing dependencies
|
||||||
|
0
tests/kconfig_features/Kconfig
Normal file
0
tests/kconfig_features/Kconfig
Normal file
12
tests/kconfig_features/Makefile
Normal file
12
tests/kconfig_features/Makefile
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
include ../Makefile.tests_common
|
||||||
|
|
||||||
|
BOARD_WHITELIST += samr21-xpro
|
||||||
|
|
||||||
|
kconfig-features:
|
||||||
|
@bash -c 'diff <($(MAKE) info-features-provided) \
|
||||||
|
<($(MAKE) dependency-debug-features-provided-kconfig) || \
|
||||||
|
(echo "ERROR: Kconfig features mismatch" && exit 1)'
|
||||||
|
|
||||||
|
all: kconfig-features
|
||||||
|
|
||||||
|
include $(RIOTBASE)/Makefile.include
|
9
tests/kconfig_features/README.md
Normal file
9
tests/kconfig_features/README.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
## Kconfig features test
|
||||||
|
|
||||||
|
The objective of this test is to control the synchronization of features
|
||||||
|
provided by boards via `Makefile.features` and `Kconfig` files during the
|
||||||
|
migration process.
|
||||||
|
|
||||||
|
The test checks during compilation that both lists of features provided by
|
||||||
|
the board match. The `BOARD_WHITELIST` is used to test only the boards that have
|
||||||
|
their features modelled in Kconfig.
|
25
tests/kconfig_features/main.c
Normal file
25
tests/kconfig_features/main.c
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup tests
|
||||||
|
* @{
|
||||||
|
*
|
||||||
|
* @file
|
||||||
|
* @brief Test for Kconfig Features
|
||||||
|
*
|
||||||
|
* @author Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
|
||||||
|
* @author José I. Alamos <jose.alamos@haw-hamburg.de>
|
||||||
|
*
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user