1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #15421 from leandrolanzieri/pr/kconfig/native/hello_world

Kconfig: add modules to test on native
This commit is contained in:
Alexandre Abadie 2020-11-18 15:02:34 +01:00 committed by GitHub
commit e322bfbd47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 149 additions and 12 deletions

View File

@ -3,6 +3,7 @@
: ${TEST_BOARDS_AVAILABLE:="esp32-wroom-32 samr21-xpro"}
: ${TEST_BOARDS_LLVM_COMPILE:="iotlab-m3 native nrf52dk mulle nucleo-f401re samr21-xpro slstk3402a"}
: ${TEST_KCONFIG_samr21_xpro:="examples/hello-world tests/periph_*"}
: ${TEST_KCONFIG_native:="examples/hello-world tests/periph_*"}
export RIOT_CI_BUILD=1
export CC_NOCOLOR=1
@ -38,6 +39,9 @@ get_kconfig_test_apps() {
case "$1" in
"samr21-xpro") echo "${TEST_KCONFIG_samr21_xpro}" ;;
esac
case "$1" in
"native") echo "${TEST_KCONFIG_native}" ;;
esac
}
check_label() {

View File

@ -24,3 +24,5 @@ config BOARD_NATIVE
# Various other features (if any)
select HAS_ETHERNET
select HAS_MOTOR_DRIVER
rsource "drivers/Kconfig"

View File

@ -19,4 +19,4 @@ ifneq (,$(filter socket_zep,$(USEMODULE)))
USEMODULE += random
endif
USEMODULE += native-drivers
USEMODULE += native_drivers

View File

@ -0,0 +1,14 @@
# 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 MODULE_NATIVE_DRIVERS
bool
depends on BOARD_NATIVE
depends on TEST_KCONFIG
default y
help
Drivers for Native board.

View File

@ -1,3 +1,3 @@
MODULE = native-drivers
MODULE = native_drivers
include $(RIOTBASE)/Makefile.base

View File

@ -19,6 +19,9 @@ config CPU_ARCH_NATIVE
select HAS_PERIPH_PWM
select HAS_SSP
# needed modules
select MODULE_PERIPH if TEST_KCONFIG
config CPU_CORE_NATIVE
bool
select CPU_ARCH_NATIVE
@ -74,3 +77,12 @@ config CPU_MODEL
config CPU
default "native" if CPU_MODEL_NATIVE
menu "Native modules"
depends on CPU_ARCH_NATIVE
rsource "backtrace/Kconfig"
endmenu # Native modules
rsource "periph/Kconfig"

View File

@ -25,3 +25,9 @@ ifeq ($(OS),Linux)
# CAN is only supported on Linux through socketCAN
FEATURES_PROVIDED += periph_can
endif
# This configuration enables modules that are only available when using Kconfig
# module modelling
ifeq (1, $(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(RIOTCPU)/native/native.config
endif

View File

@ -0,0 +1,11 @@
# 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 MODULE_BACKTRACE
bool "Stack backtrace"
depends on CPU_ARCH_NATIVE
depends on TEST_KCONFIG

2
cpu/native/native.config Normal file
View File

@ -0,0 +1,2 @@
# UART is needed by startup.c
CONFIG_MODULE_PERIPH_UART=y

16
cpu/native/periph/Kconfig Normal file
View File

@ -0,0 +1,16 @@
# 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 MODULE_PERIPH_SPIDEV_LINUX
bool
default y if MODULE_PERIPH_SPI
depends on NATIVE_OS_LINUX
config MODULE_PERIPH_INIT_SPIDEV_LINUX
bool
default y
depends on MODULE_PERIPH_SPIDEV_LINUX

View File

@ -0,0 +1,36 @@
# 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.
#
choice NATIVE_GPIO_IMPLEMENTATION
bool "Native GPIO peripheral implementation"
depends on MODULE_PERIPH_GPIO
depends on CPU_ARCH_NATIVE
depends on TEST_KCONFIG
default MODULE_PERIPH_GPIO_LINUX if NATIVE_OS_LINUX
config MODULE_PERIPH_GPIO_LINUX
bool "Linux GPIO"
depends on NATIVE_OS_LINUX
config MODULE_PERIPH_GPIO_MOCK
bool "Mock"
endchoice
# TODO: these modules are actually just artifacts from the way periph_init_%
# modules are handled in Makefile. We need to define them to keep the list the
# same for now. We should be able to remove them later on.
config MODULE_PERIPH_INIT_GPIO_LINUX
bool
default y if MODULE_PERIPH_INIT
depends on MODULE_PERIPH_GPIO_LINUX
config MODULE_PERIPH_INIT_GPIO_MOCK
bool
default y if MODULE_PERIPH_INIT
depends on MODULE_PERIPH_GPIO_MOCK

View File

@ -0,0 +1,10 @@
# 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 MODULE_PERIPH_RTC
select MODULE_XTIMER if CPU_ARCH_NATIVE
depends on HAS_PERIPH_RTC

View File

@ -115,15 +115,7 @@ config MODULE_PERIPH_INIT_QDEC
default y if MODULE_PERIPH_INIT
depends on MODULE_PERIPH_QDEC
config MODULE_PERIPH_RTC
bool "RTC peripheral driver"
depends on HAS_PERIPH_RTC
select MODULE_PERIPH_COMMON
config MODULE_PERIPH_INIT_RTC
bool "Auto initialize RTC peripheral"
default y if MODULE_PERIPH_INIT
depends on MODULE_PERIPH_RTC
rsource "Kconfig.rtc"
config MODULE_PERIPH_RTT
bool "RTT peripheral driver"

View File

@ -44,3 +44,5 @@ config MODULE_PERIPH_INIT_GPIO_FAST_READ
depends on MODULE_PERIPH_GPIO_FAST_READ
endif # MODULE_PERIPH_GPIO
osource "$(RIOTCPU)/$(CPU)/periph/Kconfig.gpio"

View File

@ -0,0 +1,19 @@
# 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 MODULE_PERIPH_RTC
bool "RTC peripheral driver"
depends on HAS_PERIPH_RTC
select MODULE_PERIPH_COMMON
config MODULE_PERIPH_INIT_RTC
bool "Auto initialize RTC peripheral"
default y if MODULE_PERIPH_INIT
depends on MODULE_PERIPH_RTC
# Include CPU specific configurations
osource "$(RIOTCPU)/$(CPU)/periph/Kconfig.rtc"

View File

@ -10,10 +10,11 @@ menu "Standard Input/Output (STDIO)"
choice
bool "STDIO implementation"
default MODULE_STDIO_NATIVE if CPU_ARCH_NATIVE
default MODULE_STDIO_UART
# TODO: Add MODULE_STDIO_CDC_ACM, MODULE_STDIO_RTT, MODULE_SLIPDEV_STDIO,
# MODULE_STDIO_NATIVE and MODULE_STDIO_ETHOS
# and MODULE_STDIO_ETHOS
config MODULE_STDIO_NULL
bool "Null"
@ -25,6 +26,10 @@ config MODULE_STDIO_UART
depends on HAS_PERIPH_UART
select MODULE_PERIPH_UART
config MODULE_STDIO_NATIVE
bool "Native"
depends on CPU_ARCH_NATIVE
endchoice
config MODULE_STDIN

View File

@ -12,6 +12,10 @@ USEMODULE += benchmark
# disable native GPIOs for automatic test
ifeq (native,$(BOARD))
USEMODULE += periph_gpio_mock
# the same for Kconfig
ifeq (1,$(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(APPDIR)/app.config.test.native
endif
endif
BOARDS_BENCH_PORT_1 = \

View File

@ -0,0 +1,2 @@
# disable native GPIOs for automatic test
CONFIG_MODULE_PERIPH_GPIO_MOCK=y