Skip to content

Conversation

@olalonde
Copy link

No description provided.

pillo79 and others added 30 commits April 23, 2025 19:33
This introductory commit refactors the `yaml_set` function separating
the bodies of list operations into internal functions while preserving
their original behavior.

The conditions that cause the value to be interpreted as a list are also
verified only once, avoiding multiple checks.

Signed-off-by: Luca Burelli <[email protected]>
(cherry picked from commit cf5607f)
(cherry picked from commit 65aacb4)
This commit adds support for generator expressions in values and lists
to the yaml module.

Generator expressions can only be expanded by CMake after all
configuration code has been executed and the final values of the project
properties are defined. This means that contexts that contain generator
expressions are written twice:

 - immediately, during the 'yaml_save()' call, a comment with the raw
   unexpanded string is saved instead of the key that uses generator
   expressions in the YAML file;

 - after the configuration step, a custom command updates the YAML file
   contents with the fully expanded values.

This two-step process also allows to overcome the issue of lists that
are extracted from generator expressions, whose elements would be
expanded into a single string if written directly to the YAML file.
Instead, the lists are stored in their CMake string format with a
special marker, expanded by CMake into a temporary JSON file, and the
conversion to a proper list is performed during the build step.

If the saved YAML file for context <name> is needed by further build
steps in this project, the target '<name>_yaml_saved' must be added as a
dependency to ensure the final contents are ready.

Note that when generator expressions are used in the context, the GENEX
keyword must be provided to yaml_set(). This is necessary to avoid
storing the genexes as raw strings in the YAML.

Signed-off-by: Luca Burelli <[email protected]>
(cherry picked from commit cdc7f05)
(cherry picked from commit 1ee5fdf)
Use a more concise way to append to a list property, as suggested in a
previous PR review.

Signed-off-by: Luca Burelli <[email protected]>
(cherry picked from commit 8e66848)
(cherry picked from commit c6377b3)
The schema for build info already contained a `board:path` sequence tag
definition, but boards.cmake did not populate this in the generated
build_info.yml.

Fix this by correctly populating the `board:path` with list of board
directories.

Signed-off-by: Torsten Rasmussen <[email protected]>
(cherry picked from commit b78c269)
(cherry picked from commit 687c5cc)
This commit introduce support for maps in a yaml list.

The yaml_set() function has been extended with the following signature:
> yaml_set(NAME <name> KEY <key>...
>          [APPEND] LIST MAP <map1> MAP <map2> MAP ...
> )

where a `MAP <map>` has the form:
`MAP "<key1>: <value1>, <key2>: <value2>, ...`

Signed-off-by: Torsten Rasmussen <[email protected]>
(cherry picked from commit 0828d0b)
(cherry picked from commit 7b8c9a2)
Add 'images' as valid list in build info schema.
This allow sysbuild and regular Zephyr images to populate build_info.yml
with images included in the build.

Signed-off-by: Torsten Rasmussen <[email protected]>
(cherry picked from commit 4061311)
(cherry picked from commit 9a88142)
Populate the build_info.yml created by sysbuild CMake with list of
images and write the build info file afterwards.

This allows users and external tools to examine which images was
included in the build even if one or more of those images fails CMake
configure or generate stage.

Signed-off-by: Torsten Rasmussen <[email protected]>
(cherry picked from commit 642e948)
(cherry picked from commit 69a40de)
Escape the json input string given to `to_yaml()` function and the
content given to `yaml_set()` function.

This ensures that a string like `foo\bar` becomes `foo\\bar` during
internal CMake json processing and when written to the file it becomes
`foo\bar`.

Signed-off-by: Torsten Rasmussen <[email protected]>
(cherry picked from commit cdbe424)
(cherry picked from commit f3c0afb)
Do not escape single escaped quote '\"'.
A single escape quote in CMake indicates the use of literal '"'.
Escaping those results in '\\"' which is a literal '\' and a quote which
encapsulates a string.
This is a result we do not want.
Therefore, exempt the '\"' sequence from further escaping.

Signed-off-by: Torsten Rasmussen <[email protected]>
(cherry picked from commit 991396c)
(cherry picked from commit eab01fb)
Support for list of images in build info was added with commit
4061311 and is used by sysbuild.

Zephyr itself also uses CMake's External Project feature when including
TF-M or TF-A in a Zephyr build.

Populate build info with TF-M / TF-A information when said image is
included in the build.

Upstream PR #: 86881

Signed-off-by: Torsten Rasmussen <[email protected]>
(cherry picked from commit 3b583c2)
Added option to retry message send over ipc when for example
there is -ENOMEM error (shared memory buffer full).
Number of max retries and delay between them are Kconfigs.
Fixed nrfs error reporting when sending directly over
ipc service, status was not correct when negative value
was returned from ipc service send function.

Signed-off-by: Łukasz Stępnicki <[email protected]>
(cherry picked from commit e62ebd8)
(cherry picked from commit 1b05ede)
…build.

Calling `west build --build-opt="-v" --build-opt="-j=<n>"`
passes the build options to `cmake --build ... -- <build-opt>` which
again is passed to the native build tool, such as ninja or make.

However, when ExternalProjects are used in CMake, such as in TF-M or
sysbuild builds then those extra build options are only passed to the
first image build and not those build as external projects.

CMake supports environment variables for those flags, so translate
verbosity and number of jobs to those environment variables and thereby
support those flags for all images when specified by the user.

Signed-off-by: Torsten Rasmussen <[email protected]>
(cherry picked from commit 63cf79b)
(cherry picked from commit ba87527)
…nv variables

Sysbuild may include several images and when using ninja as build tools
then build options like `ninja -v` or `ninja -j <n>` is only consumed
by the top-level build folder, which is sysbuild itself.

CMake supports setting number of jobs or verbosity using environment
variables.

Document this feature in the Building with sysbuild section.

Signed-off-by: Torsten Rasmussen <[email protected]>
(cherry picked from commit e270fd4)
(cherry picked from commit c95fb4e)
USB stack does not check api->lock() and api->unlock() return value and
all UDC drivers block without timeout in its lock() and unlock() api
implementations. There is no realistic way to handle lock() and unlock()
errors without making USB device stack API unnecessarily complex.

Remove the return type from lock() and unlock() to make it clear that
the functions must not fail.

Signed-off-by: Tomasz Moń <[email protected]>
(cherry picked from commit 23232e6)
(cherry picked from commit 71f956c)
DWC2 thread must acquire UDC mutex before accessing shared resources
(peripheral registers and software data structures). Whenever software
enqueues a buffer, the caller first obtains mutex, adds the buffer to
the list, posts event to wake up DWC2 thread and releases mutex. If DWC2
thread has higher priority than the task currently holding a mutex,
there will be two completely unnecessary task switches: DWC2 will switch
in, try to obtain mutex, and then the control will be returned to the
mutex holder.

Avoid the unnecessary task switches by locking scheduler prior to
obtaining the mutex and unlocking scheduler after releasing the mutex.

Signed-off-by: Tomasz Moń <[email protected]>
(cherry picked from commit 962a53e)
(cherry picked from commit 3d114bd)
When the endpoint is disabled while the core is hibernated, there are
timeouts waiting for interrupts. It is not clear how the stack should
behave when class and/or application wants to disable the endpoint while
device is suspended. The problem was originally observed when the
endpoints were disabled as a result of usbd_disable() call.

Avoid the timeouts by modifying the backup values instead of the real
registers (which are not accessible when hibernated).

Split the 32-bit txf_set variable into two 16-bit variables (txf_set and
pending_tx_flush) because maximum number of TxFIFO instances is 16.
The txf_set variable is used as-is, while the pending_tx_flush is used
to keep track of TxFIFOs that have to be flushed on hibernation exit.

Signed-off-by: Tomasz Moń <[email protected]>
(cherry picked from commit 2be960a)
(cherry picked from commit 7383e86)
Wait for PHY clock before triggering START task to ensure overlapped
reset for PHY and DWC2 core.

Signed-off-by: Tomasz Moń <[email protected]>
(cherry picked from commit 437983e)
(cherry picked from commit a4741f2)
OUT endpoint 0 cannot be disabled and therefore the only way to forcibly
reclaim the buffer is to reset the core. The reset does not finish if
PHY clock is not running, but just triggering the reset seems to be
enough to be able to reclaim the buffer.

Signed-off-by: Tomasz Moń <[email protected]>
(cherry picked from commit 2395452)
(cherry picked from commit 1ebfcf3)
There is no point in calling k_event_test() to determine what events are
posted and then passing that value to k_event_clear(). Simply pass
UINT32_MAX to k_event_clear() and use the return value to slightly
reduce overhead.

Signed-off-by: Tomasz Moń <[email protected]>
(cherry picked from commit 2aa26ad)
(cherry picked from commit cdaa790)
… necessary

SETUP data is unconditionally ACKed by the controller. Other DATA
packets sent to OUT control endpoint 0 (i.e. OUT Data Stage packets
and OUT Status Stage packet) are ACKed by the device only if the
endpoint was enabled with CNAK bit set.

In Buffer DMA mode controller will lock up in following scenario:
  * OUT EP0 is not enabled, e.g. OUT Status Stage has finished
  * Host starts Control Write transfer, i.e. sends SETUP DATA0 and
    device ACKs (regardless if endpoint is enabled or not)
  * host sends OUT Data Stage (OUT DATA1)
      - software enables endpoint to be able to receive next SETUP data
	while host is transmitting the OUT token. If CNAK bit is set
        alongside the EPENA bit, the device will ACK the OUT Data Stage.
        If CNAK bit is not set, the device will NAK the OUT Data Stage.

When the lockup occurs, from host perspective the OUT Data Stage packet
was successfully transmitted. This can result in host starting IN Status
Stage if there was only one OUT Data Stage packet. This in turn results
in device never getting the DOEPTINT0 SetUp interrupt. Besides just not
getting the SetUp interrupt, any subsequent control transfer won't be
noticed by device at all.

The lockup was first observed while stress testing. The host was issuing
endless sequence of Control Write, Control Read, Control Write, Control
Read, ... commands. When the controller did lock up in Buffer DMA mode,
from host perspective the device was timing out all control transfers.

Avoid the Buffer DMA lockup by setting CNAK bit only when necessary.

Signed-off-by: Tomasz Moń <[email protected]>
(cherry picked from commit 6e3f8d4)
(cherry picked from commit 8277f97)
Fix "warning: 'cdc_acm_send_notification' defined but not used"
when Kconfig option UART_USE_RUNTIME_CONFIGURE is not used and
properly handle enqueue error.

Signed-off-by: Johann Fischer <[email protected]>
(cherry picked from commit 7b34456)
Signed-off-by: Tomasz Moń <[email protected]>
(cherry picked from commit 56cfdce)
… and enabled at boot

There are some boards and samples in the tree that use the CDC ACM UART
as the default serial backend, just like a real UART controller would.
The new device stack requires more detailed configuration than the old
one. In order to use the CDC ACM UART as the serial backend with the new
device stack in the same way as with the legacy stack, we need to
provide a solution to initialise and enable the CDC ACM UART at boot
time. We cannot use snippets as they do not support Kconfig files or
source code. Shields would be an option, but they cannot be used for
virtual devices such as the CDC ACM UART. The remaining solution is to
put the code and Kconfig file for it in the subsys directory.

Allow CDC ACM UART instance and USB device stack to be initialized and
enabled at boot time and to use it as serial backend for logging or
shell.

Signed-off-by: Johann Fischer <[email protected]>
(cherry picked from commit 7ffa620)
Signed-off-by: Tomasz Moń <[email protected]>
(cherry picked from commit 7de7359)
…e stack

Add sample to shows how to use the CDC ACM UART provided by the new
experimental USB device stack as a serial backend for the console.

Signed-off-by: Johann Fischer <[email protected]>
(cherry picked from commit be5e666)
Signed-off-by: Tomasz Moń <[email protected]>
(cherry picked from commit 1354027)
Remove the configuration for the new USB device stack, as there is now a
separate sample that demonstrates how to use it with Kconfig option
CONFIG_CDC_ACM_SERIAL_INITIALIZE_AT_BOOT.

Signed-off-by: Johann Fischer <[email protected]>
(cherry picked from commit 5914131)
Signed-off-by: Tomasz Moń <[email protected]>
(cherry picked from commit 399363a)
For many devices iSerialNumber is not required. The only device class
currently supported in Zephyr that requires iSerialNumber is MSC. If the
serial number is not available then iSerialNumber must be 0. Failure to
read the string descriptor for non-zero iSerialNumber fails USB Command
Verifier Chapter 9 tests.

When USBD_DESC_SERIAL_NUMBER_DEFINE() was used without CONFIG_HWINFO
then it did lead to runtime failure when requesting the string (thus
failing certification).

Fail USBD_DESC_SERIAL_NUMBER_DEFINE() at build-time if CONFIG_HWINFO is
not set to prevent the surprise at runtime. Only define serial number
descriptors if CONFIG_HWINFO is enabled.

Signed-off-by: Tomasz Moń <[email protected]>
(cherry picked from commit 7510970)
(cherry picked from commit 9442059)
…T version

It should be possible to select maximum supported MQTT version, so that
for example MQTT 5.0 features can be compiled-out in case they're not
needed.

Signed-off-by: Robert Lubos <[email protected]>
(cherry picked from commit f31a45f)
(cherry picked from commit ef311e1)
…QTT 5.0 enabled

Add test variant which enables MQTT 5.0 support. MQTT 3.1.1 should still
work just fine in such case, so it needs to be verified that's the case.

Signed-off-by: Robert Lubos <[email protected]>
(cherry picked from commit 08f8e2f)
(cherry picked from commit 5f20389)
…ngth

The macro did not take into account the 2-byte binary data length
encoded before the actual binary data.

Signed-off-by: Robert Lubos <[email protected]>
(cherry picked from commit 1eb9a5c)
(cherry picked from commit 070f6fa)
Add support for CONNECT message specified in MQTT 5.0, along with
property encoders required to encode MQTT properties which is a new
concept in MQTT 5.0. Connect and will properties can be specified by the
application in the mqtt_client structure before connecting.

Introduce a helper function which allows to verify whether MQTT 5.0 is
used or not, so that it's still possible to use MQTT 3.1 even if MQTT
5.0 support is enabled in Kconfig.

Signed-off-by: Robert Lubos <[email protected]>
(cherry picked from commit 8fe2965)
(cherry picked from commit 0b35979)
Add support for CONNACK message specified in MQTT 5.0, along with
property decoders required to decode MQTT properties. Decoded properties
are provided to the application within mqtt_connack_param structure,
accompanying the CONNACK event.

Signed-off-by: Robert Lubos <[email protected]>
(cherry picked from commit 6038676)
(cherry picked from commit cb3591a)
nordic-krch and others added 26 commits April 23, 2025 19:33
ISR safe runtime PM can only be used for all instances except for
spis120 which requires standard runtime PM.

Added compilation guard against using CONFIG_PM_DEVICE_SYSTEM_MANAGED
with spis120.

Signed-off-by: Krzysztof Chruściński <[email protected]>
(cherry picked from commit 8d6ab28)
(cherry picked from commit cbdef1a)
Add support to read identity and private key password if
configured in Enterprise mode.

Signed-off-by: Triveni Danda <[email protected]>
(cherry picked from commit 589333e)
(cherry picked from commit a90c3f7)
Fix the kconfig check for enterprise crypto support in AP mode.
Also, remove the unnecessary Hostapd enterprise crypto check in
credentials code.

Signed-off-by: Triveni Danda <[email protected]>
(cherry picked from commit b3ea4f8)
(cherry picked from commit 75d5c70)
Based on few tests, it was observed that WPA supplicant's maximum usage
for connection and disconnection is 4360.

This would save ~4K which is huge as we have a crunch for RAM.

This was missed when hostap was upstreamed from NCS.

Signed-off-by: Chaitanya Tata <[email protected]>
(cherry picked from commit 83592e8)
(cherry picked from commit 88c6921)
When connecting to a WPA3 connection, the max stack size observed was
5456, fix the SoF by increasing by 200bytes (cushion added).

Signed-off-by: Chaitanya Tata <[email protected]>
(cherry picked from commit 24cbc88)
(cherry picked from commit 2861e27)
During experiments it was observed that workqueue uses a maximum of
3872 bytes, so, with cushion added set it to 4096.

Signed-off-by: Chaitanya Tata <[email protected]>
(cherry picked from commit 96dc3d3)
(cherry picked from commit ef18ad8)
In case interface is UP, the interface is added to WPA supplicant in the
iface_wq itself and the max stack size is 4264, so, increase the stack
size of the iface_wq.

If the interface is added via net_mgmt thread then it works fine.

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

Increase stack size of supplicant thread to fix crash seen during
enterprise mode connection. Increase heap requirement of hostap
to handle TLS processing failures.

Signed-off-by: Ravi Dondaputi <[email protected]>
(cherry picked from commit d073e62)
(cherry picked from commit ae37a77)
… security

Add support for configuring enterprise mode security.
Fixes SHEL-3573.

Upstream PR #: 88653

Signed-off-by: Ravi Dondaputi <[email protected]>
(cherry picked from commit 5ebd033)
Enable Wi-Fi credentials support. Update the heap sizes as
required for enterprise mode.

Upstream PR #: 88653

Signed-off-by: Ravi Dondaputi <[email protected]>
(cherry picked from commit b2c3f2c)
… overflow

Inclusion of CONFIG_WIFI_SHELL_RUNTIME_CERTIFICATES causes build time
RAM overflow issues. Decrease NRF_WIFI_DATA_HEAP_SIZE to accommodate
the RUNTIME_CERTIFICATES feature.

Upstream PR #:88861

Signed-off-by: Ravi Dondaputi <[email protected]>
(cherry picked from commit a4b75c0)
These are QSPI related which is part of buslib.

Upstream PR #: 88897

Signed-off-by: Chaitanya Tata <[email protected]>
(cherry picked from commit ad17ea8)
These are applicable for Wi-Fi over QSPI (nRF7002DK) or Flash over QSPI
(nRF52/53 + nRF7002EK) and as most Wi-Fi samples run on 128MHz (for
performance), disable the anomalies for both.

Upstream PR #: 88897

Signed-off-by: Chaitanya Tata <[email protected]>
(cherry picked from commit 63c239c)
Discard the eh_frame section when C++ exceptions are disabled.

In principle the eh_frame may be used for other purposes such as
backtracing when linking C programs, then Zephyr compiles each source
file with '-fno-asynchronous-unwind-tables', thus keeping the eh_frame
in the elf output just takes up space.

When using gcc/ld, then the eh_frame is generally generally discarded
per default, however for clang/lld it will be included but give a
warning that the section is auto-placed.

Some platforms already discards the eh_frame, so unify this for all
targets.

As eh_frame is now discarded in linker scripts then post processing step
of removing the section during hex or bin conversion can also be
removed.

Upstream PR #: 88970

Signed-off-by: Torsten Rasmussen <[email protected]>
Move creation of last section id from ld linker script LONG() usage to
C code with last section attribute.

The use of `LONG()` works correctly with ld but lld emits a warning
because .last_section section is not allocated as there are no matching
input sections and discards the `LONG()` call, meaning the last section
identifier will not be present in the flash.
> ld.lld: warning: ignoring memory region assignment for
>                             non-allocatable section '.last_section'

Placing the last section id in `.last_section` in C code makes lld
allocate the memory for the id and thereby create the output section
with the correct output.

Upstream PR #: 88970

Signed-off-by: Torsten Rasmussen <[email protected]>
SoftAP operation needs around 5700 bytes of stack. With a
buffer of 100 bytes, set the supplicant stack size to 5800.
Fixes SHEL-3604.

Upstream PR #: 89116

Signed-off-by: Ravi Dondaputi <[email protected]>
(cherry picked from commit 5db46db)
…P is re-enabled

Add a simple non-XIP transaction before deactivating the QSPI after
a XIP transaction is performed. This prevents a CPU hang from occuring
when another XIP transaction is attempted after the QSPI is activated
again.

Signed-off-by: Andrzej Głąbek <[email protected]>
(cherry picked from commit fb1d078)
Add simple helper macro so users can define a CCCD with a write cb
without having to combine BT_GATT_CCC_MANAGED() and
BT_GATT_CCC_INITIALIZER() themselves.

Unlike the changed callback the write callback has a return value
that can be used to reject the write request.

Signed-off-by: Olivier Lesage <[email protected]>
(cherry picked from commit 7b61bd6)
(cherry picked from commit 336b11a)
The parameter length for this command was missing the additional
length from the arrayed parameters.

Upstream PR #: 89092

Signed-off-by: Olivier Lesage <[email protected]>
(cherry picked from commit 59d05a4)
Updated `cellular_modem.c` to include recent changes from upstream Zephyr,
including bug fixes, improvements, and the addition of support for the A76xx
modem driver.
@olalonde olalonde closed this May 18, 2025
@NordicBuilder
Copy link
Contributor

none

Note: This comment is automatically posted and updated by the Contribs GitHub Action.

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
3 Security Hotspots
8.8% Duplication on New Code (required ≤ 3%)
E Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.