Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kconfig: add support for warnings when using experimental features #33566

Merged
merged 4 commits into from
Oct 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Kconfig.zephyr
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,20 @@ config MAKEFILE_EXPORTS
third party Makefile-based build systems.

endmenu

config EXPERIMENTAL
bool
help
Symbol that must be selected by a feature if it is considered to be
at an experimental implementation stage.

config WARN_EXPERIMENTAL
bool
prompt "Warn on experimental usage"
help
Print a warning when the Kconfig tree is parsed if any experimental
features are enabled.

endmenu


Expand Down
22 changes: 22 additions & 0 deletions doc/application/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,28 @@ The other pages in the :ref:`Kconfig section of the manual <kconfig>` are also
worth going through, especially if you planning to add new configuration
options.

Experimental features
*********************

Zephyr is a project under constant development and thus there are features that
are still in early stages of their development cycle. Such features will be
marked ``[EXPERIMENTAL]`` in their Kconfig title.

The :kconfig:`CONFIG_WARN_EXPERIMENTAL` setting can be used to enable warnings
at CMake configure time if any experimental feature is enabled.

.. code-block:: none

CONFIG_WARN_EXPERIMENTAL=y

For example, enabling experimental warnings and building a sample which enables
:kconfig:`CONFIG_BT_EXT_ADV` will print the following warning at CMake
configure time.

.. code-block:: shell

warning: Experimental symbol BT_EXT_ADV is enabled.

Devicetree Overlays
===================

Expand Down
1 change: 1 addition & 0 deletions drivers/bluetooth/hci/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ config BT_H5
bool "H:5 UART [EXPERIMENTAL]"
select UART_INTERRUPT_DRIVEN
select BT_UART
select EXPERIMENTAL
depends on SERIAL
help
Bluetooth three-wire (H:5) UART driver. Implementation of HCI
Expand Down
1 change: 1 addition & 0 deletions drivers/can/Kconfig.net
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

config CAN_NET
bool "Enable 6loCAN network interface [EXPERIMENTAL]"
select EXPERIMENTAL
help
Enable IPv6 Networking over can (6loCAN)

Expand Down
16 changes: 15 additions & 1 deletion scripts/kconfig/kconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Zephyr doesn't use tristate symbols. They're supported here just to make the
# script a bit more generic.
from kconfiglib import Kconfig, split_expr, expr_value, expr_str, BOOL, \
TRISTATE, TRI_TO_STR, AND
TRISTATE, TRI_TO_STR, AND, OR


def main():
Expand Down Expand Up @@ -62,6 +62,9 @@ def main():
check_assigned_sym_values(kconf)
check_assigned_choice_values(kconf)

if kconf.syms['WARN_EXPERIMENTAL'].tri_value == 2:
check_experimental(kconf)

# Hack: Force all symbols to be evaluated, to catch warnings generated
# during evaluation. Wait till the end to write the actual output files, so
# that we don't generate any output if there are warnings-turned-errors.
Expand Down Expand Up @@ -202,6 +205,17 @@ def check_assigned_choice_values(kconf):
"""


def check_experimental(kconf):
experimental = kconf.syms['EXPERIMENTAL']
dep_expr = experimental.rev_dep

if dep_expr is not kconf.n:
selectors = [s for s in split_expr(dep_expr, OR) if expr_value(s) == 2]
for selector in selectors:
selector_name = split_expr(selector, AND)[0].name
warn(f'Experimental symbol {selector_name} is enabled.')


def promptless(sym):
# Returns True if 'sym' has no prompt. Since the symbol might be defined in
# multiple locations, we need to check all locations.
Expand Down
3 changes: 3 additions & 0 deletions subsys/bluetooth/Kconfig.adv
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ config BT_LIM_ADV_TIMEOUT

config BT_EXT_ADV
bool "Extended Advertising and Scanning support [EXPERIMENTAL]"
select EXPERIMENTAL
help
Select this to enable Extended Advertising API support.
This enables support for advertising with multiple advertising sets,
Expand Down Expand Up @@ -45,6 +46,7 @@ config BT_EXT_ADV_MAX_ADV_SET

config BT_PER_ADV
bool "Periodic Advertising and Scanning support [EXPERIMENTAL]"
select EXPERIMENTAL
help
Select this to enable Periodic Advertising API support. This allows
the device to send advertising data periodically at deterministic
Expand All @@ -54,6 +56,7 @@ config BT_PER_ADV
config BT_PER_ADV_SYNC
bool "Periodic advertising sync support [EXPERIMENTAL]"
depends on BT_OBSERVER
select EXPERIMENTAL
help
Select this to enable Periodic Advertising Sync API support.
Syncing with a periodic advertiser allows the device to periodically
Expand Down
2 changes: 2 additions & 0 deletions subsys/bluetooth/Kconfig.iso
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ config BT_ISO_UNICAST
bool "Bluetooth Isochronous Channel Unicast Support [EXPERIMENTAL]"
depends on BT_CONN
select BT_ISO
select EXPERIMENTAL
help
This option enables support for Bluetooth Broadcast
Isochronous channels.
Expand All @@ -34,6 +35,7 @@ config BT_ISO_SYNC_RECEIVER
select BT_ISO_BROADCAST
select BT_OBSERVER
select BT_PER_ADV_SYNC
select EXPERIMENTAL
help
This option enables support for the Bluetooth Isochronous
Synchronized Receiver.
Expand Down
3 changes: 2 additions & 1 deletion subsys/bluetooth/audio/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
#

menuconfig BT_AUDIO
bool "Bluetooth Audio support [Experimental]"
bool "Bluetooth Audio support [EXPERIMENTAL]"
select EXPERIMENTAL
help
This option enables Bluetooth Audio support. The specific
features that are available may depend on other features
Expand Down
8 changes: 8 additions & 0 deletions subsys/bluetooth/controller/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ config BT_CTLR_ADV_EXT

config BT_CTLR_ADV_EXT
prompt "LE Advertising Extensions [EXPERIMENTAL]" if BT_LL_SW_SPLIT
select EXPERIMENTAL if BT_LL_SW_SPLIT

if BT_CTLR_ADV_EXT

Expand Down Expand Up @@ -490,6 +491,7 @@ config BT_CTLR_ADV_PERIODIC

config BT_CTLR_ADV_PERIODIC
bool "LE Periodic Advertising in Advertising State [EXPERIMENTAL]" if BT_LL_SW_SPLIT
select EXPERIMENTAL if BT_LL_SW_SPLIT

config BT_CTLR_SYNC_PERIODIC
bool "LE Periodic Advertising in Synchronization State" if !BT_LL_SW_SPLIT
Expand All @@ -502,6 +504,7 @@ config BT_CTLR_SYNC_PERIODIC

config BT_CTLR_SYNC_PERIODIC
bool "LE Periodic Advertising in Synchronization State [EXPERIMENTAL]" if BT_LL_SW_SPLIT
select EXPERIMENTAL if BT_LL_SW_SPLIT

config BT_CTLR_SYNC_PERIODIC_ADV_LIST
bool "LE Periodic Advertiser List support"
Expand Down Expand Up @@ -538,6 +541,7 @@ config BT_CTLR_ADV_ISO

config BT_CTLR_ADV_ISO
bool "LE Broadcast Isochronous Channel advertising [EXPERIMENTAL]" if BT_LL_SW_SPLIT
select EXPERIMENTAL if BT_LL_SW_SPLIT

config BT_CTLR_SYNC_ISO
bool "LE Broadcast Isochronous Channel advertising sync" if !BT_LL_SW_SPLIT
Expand All @@ -550,6 +554,7 @@ config BT_CTLR_SYNC_ISO

config BT_CTLR_SYNC_ISO
bool "LE Broadcast Isochronous Channel advertising sync [EXPERIMENTAL]" if BT_LL_SW_SPLIT
select EXPERIMENTAL if BT_LL_SW_SPLIT

config BT_CTLR_BROADCAST_ISO
bool
Expand Down Expand Up @@ -584,6 +589,7 @@ endif # BT_CTLR_ADV_EXT

config BT_CTLR_SET_HOST_FEATURE
bool "LE Set Host Feature Command [EXPERIMENTAL]"
select EXPERIMENTAL
help
Enables optional LE Set Host Feature Command

Expand All @@ -597,6 +603,7 @@ config BT_CTLR_CENTRAL_ISO
config BT_CTLR_CENTRAL_ISO
bool "LE Connected Isochronous Stream Central [EXPERIMENTAL]" if BT_LL_SW_SPLIT
select BT_CTLR_SET_HOST_FEATURE
select EXPERIMENTAL if BT_LL_SW_SPLIT

config BT_CTLR_PERIPHERAL_ISO
bool "LE Connected Isochronous Stream Peripheral" if !BT_LL_SW_SPLIT
Expand All @@ -608,6 +615,7 @@ config BT_CTLR_PERIPHERAL_ISO
config BT_CTLR_PERIPHERAL_ISO
bool "LE Connected Isochronous Stream Peripheral [EXPERIMENTAL]" if BT_LL_SW_SPLIT
select BT_CTLR_SET_HOST_FEATURE
select EXPERIMENTAL if BT_LL_SW_SPLIT

config BT_CTLR_CONN_ISO
bool
Expand Down
3 changes: 2 additions & 1 deletion subsys/bluetooth/controller/Kconfig.df
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ config BT_CTLR_CTEINLINE_SUPPORT
bool

menuconfig BT_CTLR_DF
bool "LE Direction Finding [Experimental]"
bool "LE Direction Finding [EXPERIMENTAL]"
depends on BT_CTLR_DF_SUPPORT
select EXPERIMENTAL
help
Enable support for Bluetooth 5.1 Direction Finding

Expand Down
6 changes: 6 additions & 0 deletions subsys/bluetooth/host/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ config BT_ID_MAX

config BT_DF
bool "Enable Direction Finding support [EXPERIMENTAL]"
select EXPERIMENTAL
help
Enable support for Bluetooth 5.1 Direction Finding.
It will allow to: get information about antennae, configure
Expand Down Expand Up @@ -752,6 +753,7 @@ config BT_BREDR
select BT_CENTRAL
select BT_SMP
select BT_L2CAP_DYNAMIC_CHANNEL
select EXPERIMENTAL
help
This option enables Bluetooth BR/EDR support

Expand All @@ -766,6 +768,7 @@ config BT_MAX_SCO_CONN

config BT_RFCOMM
bool "Bluetooth RFCOMM protocol support [EXPERIMENTAL]"
select EXPERIMENTAL
help
This option enables Bluetooth RFCOMM support

Expand All @@ -782,17 +785,20 @@ config BT_HFP_HF
bool "Bluetooth Handsfree profile HF Role support [EXPERIMENTAL]"
depends on PRINTK
select BT_RFCOMM
select EXPERIMENTAL
help
This option enables Bluetooth HF support

config BT_AVDTP
bool "Bluetooth AVDTP protocol support [EXPERIMENTAL]"
select EXPERIMENTAL
help
This option enables Bluetooth AVDTP support

config BT_A2DP
bool "Bluetooth A2DP Profile [EXPERIMENTAL]"
select BT_AVDTP
select EXPERIMENTAL
help
This option enables the A2DP profile

Expand Down
1 change: 1 addition & 0 deletions subsys/bluetooth/host/Kconfig.gatt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ config BT_ATT_PREPARE_COUNT
config BT_EATT
bool "Enhanced ATT Bearers support [EXPERIMENTAL]"
depends on BT_L2CAP_ECRED
select EXPERIMENTAL
help
This option enables support for Enhanced ATT bearers support. When
enabled additional L2CAP channels can be connected as bearers enabling
Expand Down
1 change: 1 addition & 0 deletions subsys/bluetooth/mesh/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ config BT_MESH_PROVISIONER
config BT_MESH_CDB
bool "Mesh Configuration Database [EXPERIMENTAL]"
default y if BT_MESH_PROVISIONER
select EXPERIMENTAL

if BT_MESH_CDB

Expand Down
1 change: 1 addition & 0 deletions subsys/bluetooth/services/ots/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ config BT_OTS
select BT_L2CAP_DYNAMIC_CHANNEL
select BT_GATT_DYNAMIC_DB
select BT_SMP
select EXPERIMENTAL
help
Enable Object Transfer Service.

Expand Down
1 change: 1 addition & 0 deletions subsys/canbus/isotp/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ menuconfig ISOTP
bool "ISO-TP Transport [EXPERIMENTAL]"
select NET_BUF
select POLL
select EXPERIMENTAL
help
Enable ISO TP support for CAN

Expand Down
1 change: 1 addition & 0 deletions subsys/net/l2/canbus/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ config NET_L2_CANBUS
bool "Enable CANBUS L2 layer [EXPERIMENTAL]"
depends on CAN_NET
select NET_6LO
select EXPERIMENTAL
help
Add a CANBUS L2 layer driver. This is the layer for IPv6 over CAN
(6loCAN). It uses IPHC to compress the IP header and ISO-TP for
Expand Down