Skip to content

Sysbuild Kconfig compliance + misc fromtree #2507

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

Closed
wants to merge 2,504 commits into from

Conversation

57300
Copy link
Contributor

@57300 57300 commented Feb 17, 2025

manifest-pr-skip

krish2718 and others added 30 commits February 12, 2025 11:30
Zephyr introduced postive feature flags to make advanced features
conditional but the upstream has followed a negative feature flag
for advanced features, and during upmerge these two weren't reconciled.

Fix the build in case advanced features are disabled.

Signed-off-by: Chaitanya Tata <[email protected]>
(cherry picked from commit d909634)
…ed features

This feature is handy to free up some memory, so, make sure it always
builds.

Signed-off-by: Chaitanya Tata <[email protected]>
(cherry picked from commit 7532e73)
Default is always disabled.

Signed-off-by: Chaitanya Tata <[email protected]>
(cherry picked from commit 819acf1)
Fixes build issue when WMM AC feature is disabled.

Signed-off-by: Chaitanya Tata <[email protected]>
(cherry picked from commit 2350b6b)
Remove the HCI command & event emulation layer for ECDH commands and
events. This means that we always do the necessary operations in the host.
The existing BT_ECC Kconfig option stays, but now gets automatically
enabled when necessary (e.g. based on the BT_SMP option), which is why this
commit removes so many explicit assignments in prj.conf files.

Signed-off-by: Johan Hedberg <[email protected]>
(cherry picked from commit 09e86f3)
This option only exposes internal APIs, so there should be no need to allow
applications to set an explicit value. Instead, users of the API should
select it through Kconfig.

Signed-off-by: Johan Hedberg <[email protected]>
(cherry picked from commit d3c8cb4)
Mention the removed prompt for BT_ECC in the migration guide, and also add
a note about the removed HCI emulation layer to the release notes.

Signed-off-by: Johan Hedberg <[email protected]>
(cherry picked from commit b3c6151)
…got deprecated

This is a follow-up to commit 8cfad44.

Replace the deprecated BT_LE_ADV_CONN macro with BT_LE_ADV_CONN_FAST_2.

Signed-off-by: Andrzej Głąbek <[email protected]>
(cherry picked from commit f930739)
-liblc3 added a library-internal path to zephyr_interface containing
 a file that collides with common.h required e.g. by Mbed TLS
 This commit fixes build-issues by making this include-folder
 PRIVATE to the named library liblc3

Signed-off-by: Frank Audun Kvamtrø <[email protected]>
(cherry picked from commit 2ca64a3)
-Mbed TLS requires common.h to build. The sample provides common.h
 in sample folder level but included the path to zephyr_interface.
 This commit changes the include to be sample-specific

Signed-off-by: Frank Audun Kvamtrø <[email protected]>
(cherry picked from commit 627d2f9)
…rm_zeroize

-Adding explicit include for mbedtls/platform_util.h to get acces
 to mbedtls_platform_zeroize in ITS. Somehow not visibile in Zephyr but
 it caused build issues in nRF Connect SDK.

Signed-off-by: Frank Audun Kvamtrø <[email protected]>
(cherry picked from commit 202c2c4)
…he boards

Bring the change that was already in place for the qemu_cortex_m3 board
to all the other ones, since also nrf52840 had a similar problem
(see issue #82812).

Signed-off-by: Valerio Setti <[email protected]>
(cherry picked from commit 9d0b124)
The BT Host module also uses import/export PSA functions alongside the
generate one, so these PSA_WANT should be added as well.

Previously it happened to work only because Mbed TLS is enabling
IMPORT/EXPORT internally whenever GENERATE/DERIVE is set. However the
same might not be true for all PSA Crypto providers.

Signed-off-by: Valerio Setti <[email protected]>
(cherry picked from commit 222f8d8)
There's no point building the sample for platforms that do not support
networking, hence add netif dependency to reduce the CI execution
scope.

Signed-off-by: Robert Lubos <[email protected]>
(cherry picked from commit 3df9b5f)
Refactors the code to avoid 'unused variable' warning
that is problematic for some builds.

Signed-off-by: Piotr Koziar <[email protected]>
(cherry picked from commit 8f83ffc)
This is a follow-up to commit 12eee61.

Explicitly enable "PSA_WANT_ALG_ECB_NO_PADDING" to select the AES ECB
mode that it is used in CMAC operation.

This is done because CMAC uses AES-ECB, so both AES and ECB must
be explicitly enabled. Previously it worked because Mbed TLS is
not currently performing any check internally on this and it's
just enabling ECB automatically.

Signed-off-by: Andrzej Głąbek <[email protected]>
(cherry picked from commit dff78b4)
Define HSFLL120 clock.

Signed-off-by: Gerard Marull-Paretas <[email protected]>
(cherry picked from commit 332a335)
Due to a copy-paste error, it duplicated `ttgo_lora32/esp32/procpu`.
Also, remove the `lora` tag, as it seems to be omitted from devicetree.

Signed-off-by: Grzegorz Swiderski <[email protected]>
(cherry picked from commit c074661)
test_k_workqueue_stop uses an uninitialized variable, causing
sporadic test failures.

Signed-off-by: Robin Kastberg <[email protected]>
(cherry picked from commit 75daa43)
nRF boards have a ROM crunch esp. with combined with Matter/networking
features, as the advanced features are not essential for typical Wi-Fi
operation, disable them by default. Individual samples can choose to
enable it.

Signed-off-by: Chaitanya Tata <[email protected]>
(cherry picked from commit e161ad6)
…rver

The unicast server does not need GATT caching and it was likely
incorrectly added earlier as a dependency.

Upstream PR #: 84232

Signed-off-by: Emil Gydesen <[email protected]>
… updates

-Update hostap to PR nrfconnect#76 which adds support for
 CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG instead of relying on legacy
 Mbed TLS ctr_drbg and entropy APIs. This change is in line with
 PSA crypto entropy changes in Zephyr happening with TinyCrypt
 deprecation and advancement of PSA crypto mechanisms
-Remove defconfigs for currently sets the Kconfigs:
 -CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG
 -CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG_ALLOW_NON_CSPRNG

Upstream PR #: 84517

Signed-off-by: Frank Audun Kvamtrø <[email protected]>
…endencies

-PSA_WANT_ALG_CMAC must be set for PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128
 to be valid. This commit fixes this mismatch for hostap

Upstream PR #: 84517

Signed-off-by: Frank Audun Kvamtrø <[email protected]>
…nfigurations

-Mbed TLS has come up with its own naming-convention with regards
 to certain Mbed TLS configurations for TLS/DTLS and X.509. This
 commit fixes a couple of them by depending on MBEDTLS_BUILTIN
 which is set when Kconfig.tls-generic is used
 1. Make MBEDTLS_PEM_CERTIFICATE_FORMAT depend on MBEDTLS_BUILTIN
    The proper name for this functionaity is MBEDTL_PEM_PARSE_C and
    MBEDTLS_PEM_WRITE_C
 2. Make MBEDTLS_SERVER_NAME_INDICATION depend on MBEDTLS_BUILTIN
    The proper name for this is MBEDTLS_SSL_SERVER_NAME_INDICATION

Upstream PR #: 84517

Signed-off-by: Frank Audun Kvamtrø <[email protected]>
Problem
-------

Board & SoC extensions are used to define out-of-tree board variants or
SoC qualifiers. When a board is extended, it has multiple directories
associated with it (each with its own `board.yml`), where twister should
be able to find additional platform files to support these qualifiers.
Currently, this doesn't work, because twister only traverses the primary
BOARD_DIR and ignores the rest.

The fix would've been trivial in the case of "legacy" platform files,
i.e. those of the form `<normalized_board_target>.yaml`, but it's less
straightforward for the newly introduced `twister.yaml` format.

A `twister.yaml` file contains platform configuration that can be shared
by multiple board targets and tweaked for specific targets by using the
top-level `variants` key. Normally, there is at most one `twister.yaml`
per board, but the file isn't necessarily unique to one board. Instead,
it's unique to one directory, which may define multiple boards (as is
the case with e.g. `boards/qemu/x86/`).

With extensions in the picture, the goal is to initialize platforms when
given multiple `twister.yaml` per board. The OOT files are expected to
only provide information about OOT board targets, without being able to
override in-tree targets (same principle as in the Zephyr build system).

Solution
--------

Scanning for `twister.yaml` is broken up into multiple passes - first
loading all the files, then splitting the `variants` keys apart from the
shared configuration, before constructing the Platform instances.

The purpose of the split is to treat the variant information as global,
instead of making unnecessary or faulty assumptions about locality.
Remember that the build system can derive board target names not only
from `board.yml`, but from `soc.yml` too. Considering that any board may
end up using an OOT-extended SoC (and hence multiple `soc.yml` files),
not every board target can be said to belong to some board dir.

Unlike the variant data, the remaining top-level config is still rooted
to the primary BOARD_DIR and inherited by the extension dirs from there.
This is quite intuitive in most imagined cases, but there is a caveat:
if a `twister.yaml` resides in an extension dir, then it is allowed to
have a top-level config of its own, but it will be silently ignored.
This is to support corner cases where, much like how a single board dir
can define multiple boards, a single board dir can also extend multiple
boards, or even do both. In those cases, the primary BOARD_DIR rule
should make it unambiguous which config belongs to which board, even if
it may seem counter-intuitive at first.

Upstream PR #: 84975

Signed-off-by: Grzegorz Swiderski <[email protected]>
This reverts commit 70419bd.

This is because there are issues around slow IPC thoughput
with icbmsg, which is causing issues with BLE when lots of
data is required to be exchanged, e.g. with ISO.

Also there is an assert icmsg.c#L190 which occurs when
initializing bluetooth and IPC in certain circumstances.

Upstream PR #: 85621

Signed-off-by: Sean Madigan <[email protected]>
Non-secure variants for nRF7002 DK were removed from upstream
in commit 10d4973. Revert these
changes downstream, so that the NS variants are still available.

Signed-off-by: Andrzej Głąbek <[email protected]>
…en built-in in PSA"

This reverts commit ac6d834.

Temporarily revert an upstream change that leads to a Kconfig dependency
loop with MBEDTLS_CIPHER_AES_ENABLED. This is supposed to be replaced
with a better fix later.

Signed-off-by: Andrzej Głąbek <[email protected]>
This test cannot be executed with the SDFW Service Framework client
started, so disable its initialization.

Signed-off-by: Andrzej Głąbek <[email protected]>
The BT_DRIVERS symbol default value 'y' used to depend on !BT_CTLR
but now it is always on when BT is set. For BT_RPC the BT_DRIVERS
symbol must not be enabled on the client side as no driver is used.

The temporary solution is to set BT_DRIVERS to 'y' by default only when
BT_HCI stack selection is enabled. It will be 'n' when BT_RPC_STACK
is enabled. The fix should be fine as NCS uses either HCI or RPC stack.

Signed-off-by: Michał Grochala <[email protected]>
Fast PWM120 prevents GPIO from driving pin with low/high
state when PWM duty is 0% or 100%. In such case, regular
PWM signal generation needs to be used.

Signed-off-by: Michał Stasiak <[email protected]>
(cherry picked from commit a71f042)
@57300 57300 force-pushed the kconfig-compliance branch from 1925d39 to e882a12 Compare February 25, 2025 10:54
e-rk and others added 8 commits February 25, 2025 11:09
Added the node representing the POWER peripheral on the nRF54L20.

Upstream PR #: 85883

Signed-off-by: Rafał Kuźnia <[email protected]>
To ensure that the accesses to the radio peripheral are done with
predictable timings, the constant latency must be enabled.
The constant latency mode is enabled alongside the HFXO.

Upstream PR #: 85883

Signed-off-by: Rafał Kuźnia <[email protected]>
Fixes report targets where tfm_* and bl2_* targets wrongly
generates a footprint file by having a common target which
consists of RAM and ROM report targets

Upstream PR #: 86067

Signed-off-by: Jamie McCrae <[email protected]>
Fixes the prefix for these files to not have _report in them

Upstream PR #: 86067

Signed-off-by: Jamie McCrae <[email protected]>
nrf-squash! [nrf noup] tests: drivers: mspi: api: Add nRF54L15 overlay file

Fix device frequency for nRF54L15. SDP MSPI allows only a predefined
set of device frequencies.

Signed-off-by: Magdalena Pastula <[email protected]>
…t log twice

Macro was missing a break when single argument with non 32 bit
word argument was detect. Because of that, there were two
logging messages created for a single log entry.

Signed-off-by: Krzysztof Chruściński <[email protected]>
(cherry picked from commit 9b2532a)
…or real targets."

This reverts commit 107f9f0.

Signed-off-by: Aleksandr Khromykh <[email protected]>
…targets.

Mesh currently works with trusted storage on real targets. Until secure
storage is supported by default disable it.

Signed-off-by: Aleksandr Khromykh <[email protected]>
@57300 57300 force-pushed the kconfig-compliance branch from e882a12 to 25e79a9 Compare February 26, 2025 07:24
Thalley and others added 16 commits February 26, 2025 09:05
…es support

Both the TMAP kconfig file and public header file defined
which roles were supported.

The Kconfig file options were recently added and were more
up to date (and correct), and allows for other Kconfig files
to use these values, thus allowing for more flexibility when
implementing applications.

Signed-off-by: Emil Gydesen <[email protected]>
(cherry picked from commit 48ac31c)
Extend nrf saadc device driver with pm device runtime support.

To preserve previous behavior:

* if pm device is disabled, saadc is resumed on sampling start
  and suspended when sampling done.
* if pm device is enabled only, saadc does nothing on
  sampling start/stop. its resumed on init.
* if pm device runtime is enabled, saadc is got on
  sampling start, and put on sampling stop.

Signed-off-by: Bjarki Arge Andreasen <[email protected]>
(cherry picked from commit 96c3cd6)
Set pm device runtime runtime auto flag to ensure saadc instances
are initialized correctly if pm device runtime is used.

Signed-off-by: Bjarki Arge Andreasen <[email protected]>
(cherry picked from commit d01c93c)
…peration_t`

In `db_hash_setup()` the state object for MAC operations was initialized
using `psa_mac_operation_init()`. This function was not always optimized
or inlined.

A way to reduce stack usage is to use `memset()` and set the object to
0. This is one of the option documented to initialize
`psa_mac_operation_t` object.

Upstream PR #: 86094

Signed-off-by: Théo Battrel <[email protected]>
… is coop

The main thread, if configured with coop priority (don't do that :D)
breaks gpd since it has a non yielding while loop (also don't do that)

Add an explicit yield() to allow other threads to run if main or other
threads use gpd with coop prio.

Signed-off-by: Bjarki Arge Andreasen <[email protected]>
(cherry picked from commit 7e0e583)
…round

Pend until requested event is set before clearing it. Without that
check event could be cleared too early and APP core is not waken up.

Upstream PR #: 86249

Signed-off-by: Krzysztof Chruściński <[email protected]>
This reverts commit b2af352.

To be replaced with a new version.

Signed-off-by: Grzegorz Swiderski <[email protected]>
This reverts commit 6692263.

Signed-off-by: Grzegorz Swiderski <[email protected]>
Add missing quotes around string values, so that they won't be
interpreted as undefined symbol names.

Signed-off-by: Grzegorz Swiderski <[email protected]>
(cherry picked from commit 17ba479)
…classing

So far, the behavior of different Kconfig checks has been parametrized
using the `run()` method, and every new check has introduced with it a
new argument to that method.

It's possible to replace each `run()` argument by way of overriding
different class methods and making better use of inheritance:

    free=False          Stub check_no_undef_outside_kconfig()
    no_modules=True     Stub get_modules()
    filename            Introduce class member FILENAME
    hwm                 (unused)

This should establish a more scalable and straightforward pattern for
adding future Kconfig checks. It also favors composability, which will
come in handy when implementing checks for sysbuild Kconfig.

Additionally, avoid duplicating `doc` and `path_hint` in every subclass.

Signed-off-by: Grzegorz Swiderski <[email protected]>
(cherry picked from commit 50d9ed5)
HWMv1-specific Kconfig checks were meant to be removed before HWMv2 was
merged into `main` (see `collab-hwm` history), but some traces remained.
Do another round of cleanup.

Signed-off-by: Grzegorz Swiderski <[email protected]>
(cherry picked from commit c0d5e85)
…2 temp dirs

The KCONFIG_BINARY_DIR/{boards,soc,arch}/ directories are only relevant
for `KconfigCheck.get_v2_model()`, so generate them within this method.

Signed-off-by: Grzegorz Swiderski <[email protected]>
(cherry picked from commit 37bce60)
…ecks

Introduce sysbuild-specific variants of existing Kconfig checks:

  * SysbuildKconfig
  * SysbuildKconfigBasic
  * SysbuildKconfigBasicNoModules

This involves a few additions to the base `KconfigCheck` class:

  * Supporting a variable symbol prefix, to handle `SB_CONFIG_`.
  * Generating extra files, including `Kconfig.sysbuild.modules`.
    Although these are never sourced outside of sysbuild Kconfig,
    they're still generated for every regular Zephyr build, so it's
    natural to let all Kconfig checks follow this behavior.

Signed-off-by: Grzegorz Swiderski <[email protected]>
(cherry picked from commit 7ce6ac2)
Necessary changes for NCS CI.

- Add a Jenkinsfile
- Add a commit-tags workflow: This enables sauce tag checking in sdk-zephyr
- compliance.yml: Disable check for merge commits, since we have upmerges
downstream. Also, since in the code we refer to Kconfig symbols that are defined
in the sdk-nrf repository, most Kconfig checks will not pass so exclude them.
Also, disable any maintainers-related checks
- scripts/gitlint: Extend the max commit line lengths for Gitlint to account
for sauce tags
- Adapt to the changes in:
nrfconnect/action-commit-tags#4

Signed-off-by: Carles Cufi <[email protected]>
Signed-off-by: Dominik Ermel <[email protected]>
Signed-off-by: Martí Bolívar <[email protected]>
Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Signed-off-by: Krishna T <[email protected]>
Signed-off-by: Dominik Ermel <[email protected]>
Signed-off-by: Grzegorz Swiderski <[email protected]>
(cherry picked from commit ef75b3e)
(cherry picked from commit 6692263)
The motivation for this patch was to improve the script's performance,
but some stylistic changes and cleanups are included as well.

The main optimization concerns the use of PyYAML, as it offers multiple
functions for interpreting YAML. The commonly used `load`/`safe_load`
converts a YAML stream to a dictionary. There are also `scan`, `parse`,
and `compose`, which return intermediate representations, the last one
being a graph. [1]

Since `gen_driver_kconfig_dts` scans DT bindings for compatible strings,
it only needs to look through top level keys in YAML. The intermediate
PyYAML graph is sufficient for this, and using it reduces the script's
execution time by about 30%, without making the code too complicated.

[1] - https://pyyaml.org/wiki/PyYAMLDocumentation

Signed-off-by: Grzegorz Swiderski <[email protected]>
(cherry picked from commit 15488be)
Problem
-------

Board & SoC extensions are used to define out-of-tree board variants or
SoC qualifiers. When a board is extended, it has multiple directories
associated with it (each with its own `board.yml`), where twister should
be able to find additional platform files to support these qualifiers.
Currently, this doesn't work, because twister only traverses the primary
BOARD_DIR and ignores the rest.

The fix would've been trivial in the case of "legacy" platform files,
i.e. those of the form `<normalized_board_target>.yaml`, but it's less
straightforward for the newly introduced `twister.yaml` format.

A `twister.yaml` file contains platform configuration that can be shared
by multiple board targets and tweaked for specific targets by using the
top-level `variants` key. Normally, there is at most one `twister.yaml`
per board, but the file isn't necessarily unique to one board. Instead,
it's unique to one directory, which may define multiple boards (as is
the case with e.g. `boards/qemu/x86/`).

With extensions in the picture, the goal is to initialize platforms when
given multiple `twister.yaml` per board. The OOT files are expected to
only provide information about OOT board targets, without being able to
override in-tree targets (same principle as in the Zephyr build system).

Solution
--------

The `twister.yaml` handling is broken up into multiple passes - first
loading all the files, then splitting the `variants` keys apart from the
shared configuration, before constructing the Platform instances.

The purpose of the split is to treat the variant information as global,
instead of making unnecessary or faulty assumptions about locality.
Remember that the build system can derive board target names not only
from `board.yml`, but from `soc.yml` too. Considering that any board may
end up using an OOT-extended SoC (and hence multiple `soc.yml` files),
not every board target can be said to belong to some board dir.

Unlike the variant data, the remaining top-level config is still rooted
to the primary BOARD_DIR and inherited by the extension dirs from there.
This is quite intuitive in most imagined cases, but there is a caveat:
if a `twister.yaml` resides in an extension dir, then it is allowed to
have a top-level config of its own, but it will be silently ignored.
This is to support corner cases where, much like how a single board dir
can define multiple boards, a single board dir can also extend multiple
boards, or even do both. In those cases, the primary BOARD_DIR rule
should make it unambiguous which config belongs to which board, even if
it may seem counter-intuitive at first.

For concrete examples of what this means, please see the newly added
platform unit tests.

As part of these functional changes, a good chunk of logic is moved out
of `TestPlan.add_configurations()` into a new function in `platform.py`.
This is because recombining the top-level and variant configs requires
direct manipulation of the loaded YAML contents, which would be improper
to do outside of the module responsible for encapsulating this data.

Signed-off-by: Grzegorz Swiderski <[email protected]>
(cherry picked from commit bb8b059)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.