Skip to content

Conversation

@nordic-krch
Copy link
Contributor

WIP

kartben and others added 28 commits March 24, 2025 07:38
…_WHITELIST macro

Macro has been deprecated since 2.7 LTS(!) and is using non-inclusive
terminology. Drop it.

Signed-off-by: Benjamin Cabé <[email protected]>
(cherry picked from commit 110c49f)
When scanning is started on bt_bap_broadcast_assistant_scan_start then
BAP_BA_FLAG_SCANNING flag for the broadcast assistant instance should
not be cleared.

Fixes #85937

Signed-off-by: Jens Rehhoff Thomsen <[email protected]>
(cherry picked from commit c443343)
…nd buffer

Remove nested allocation of HCI command buffer so that one
less HCI command buffer is needed starting extended
advertising with privacy enabled.

Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
(cherry picked from commit cc1b534)
The gatt docs are very sparce, this commit adds imrpovements for the
GATT server API part. Others will follow.

Signed-off-by: Kyra Lengfeld <[email protected]>
(cherry picked from commit 775cc35)
… BT RX thread

This commit alignes the timeout value for allocating buffers within att
on the BT RX thread, making it consistent within att.c, see
bt_att_req_alloc.

We are inferring in many bt_gatt_* functions that if called from a BT RX
thread (which is inherently the case if called from a callback when
running a Bluetooth application), we don't block and instead return
-ENOMEM when the ATT request queue is full, avoiding a deadlock.
This promise is fulfilled within bt_att_req_alloc, where the timeout for
allocation of the request slab is set to K_NO_WAIT if we are on the BT
RX thread. Unfortunately, we break this promise in
bt_att_chan_create_pdu, where the timeout for allocation of the att pool
is still K_FOREVER and deadlocks can (and do) occur when too many
requests are sent yet the pool is depleted.

Note: Both req_slab and att_pool sizes are defined by
CONFIG_BT_ATT_TX_COUNT. If applications start getting -ENOMEM with this
change, they were at risk of such a deadlock, and may increase
CONFIG_BT_ATT_TX_COUNT to allocate the att pool for their requests.

Note: This possible deadlock has been flying under the radar, as
att_pools are freed when the HCI driver has sent it to the controller
(instead of when receiving the response, as it happens with req_slabs)
and due to the att_pool and the req_slab being both sized by
CONFIG_BT_ATT_TX_COUNT, and req_slab being allocated before and
returning -ENOMEM already if there is no space, it takes a more specific
situation to deplete the att_pool but not the req_slab pool at this
point.

Note: Ideally, we don't want functions to behave differently depending
on which thread they are running, and while this commit makes it more
consistent, it should be considered a workaround solution.

Signed-off-by: Kyra Lengfeld <[email protected]>
(cherry picked from commit 6464ffa)
…_uuid

bt_gatt_find_by_uuid used bt_gatt_attr_value_handle but that
function only works to get the value handle of a characteristic
declaration, i.e. if the UUID is not BT_UUID_GATT_CHRC then it
would always return handle = 0. This meant that
bt_gatt_find_by_uuid would always use handle = 0 as the starting
handle for non-BT_UUID_GATT_CHRC attributes, instead of the handle
of the provided attr.

This was not an issue for any UUIDs that may only exist once on a
GATT server, which is most UUIDs, but for UUIDs like the
BT_UUID_TBS_* UUIDs that may be multiple instances of, it would
always return the first attribute rather than the one starting
from the provided start attr.

This commit also ensures that we do not overflow the `end_handle`
when adding 2 uint16_t values.

Signed-off-by: Emil Gydesen <[email protected]>
(cherry picked from commit e4c5bb9)
Adds improvement to the GATT API documentation by providing examples of
where (and how) certain structs are used, and adds specification
references to the fields of bt_gatt_cpf to clarify their purpose.

Signed-off-by: Håvard Reierstad <[email protected]>
(cherry picked from commit c7a19da)
This commit adds improvements for the
GATT client API part.

Signed-off-by: Kyra Lengfeld <[email protected]>
(cherry picked from commit b136f6d)
…tures

The function supports reading multiple controller-based values.
It is effectively a copy of struct bt_dev_le but in a more
application-oriented definition.

It was chosen to keep the features as an array rather than a
64-bit value, as the comparison macros work on arrays and that
there already exists new bits > 64 in the core spec which is not
yet supported by Zephyr.

It is being smoke tested in a generic GATT client test,
as the individual values may depend on several Kconfig options.

Signed-off-by: Emil Gydesen <[email protected]>
(cherry picked from commit 44c5c1d)
When allocation fails in `hci_rx_cb`, we should return immediately
instead of continuing the execution of the function.

Also, we need to free the allocated buffer from the heap when sending
to the message queue fails to avoid memory leak.

Signed-off-by: Axel Le Bourhis <[email protected]>
(cherry picked from commit 0034e12)
…mplete event

As the previous version of the MCXW71 BLE Controller wasn't sending a
command complete event after setting the BD address, we used a
workaround to directly send the HCI command without using zephyr's API.
Now, on the latest version of MCXW72 and MCXW71, this issue is fixed,
so we need to use `bt_hci_cmd_send_sync` to properly expect the
command complete event.

Signed-off-by: Axel Le Bourhis <[email protected]>
(cherry picked from commit e5a1c0b)
…when bt disable

remove the power off BLE controller function since the hci_reset cmd
is enough, also for wifi-ble coex scenario, need to maintain BLE controller
for some info in SMU region

Signed-off-by: Ying Zhang <[email protected]>
(cherry picked from commit 6b16d10)
- added HCI command to send hci-reset in bt_disable() func, and
  remove its call from the driver close() call.
- remove rsp buf pass to 'hci_reset_complete()' func as status is
  already checked under 'bt_hci_cmd_send_sync()'.

Signed-off-by: Nirav Agrawal <[email protected]>
(cherry picked from commit 438701f)
Clarifying `bt_gatt_attr` docs.

Signed-off-by: Kyra Lengfeld <[email protected]>
(cherry picked from commit c31b962)
This commit adds more detailed description to the "Bluetooth APIs" and
"GAP" group within the bluetooth header.

Signed-off-by: Kyra Lengfeld <[email protected]>
(cherry picked from commit 3570783)
This commit changes log level for already registered callback from
warning to debug as this is cause unnecessary noise and doesn't indicate
actual issue. Caller gets a certain error code for this case which can
be handled properly.

Signed-off-by: Pavel Vasilyev <[email protected]>
(cherry picked from commit 886faba)
The api has not changed since its introduction some time ago,
mark it as stable.

Signed-off-by: Herman Berget <[email protected]>
(cherry picked from commit 8b909b4)
…ection Subrating

The API has not changed since it was introduced so should no longer be
considered experimental.

Signed-off-by: Timothy Keys <[email protected]>
(cherry picked from commit 7ef8116)
Fix the following warning
att.c:734:3: warning: label followed by a declaration is a C23 extension
[-Wc23-extensions]
  734 |                 k_tid_t current_thread = k_current_get();
      |                 ^
By wrapping that code as a compound statement

Signed-off-by: Alberto Escolar Piedras <[email protected]>
(cherry picked from commit 1dab77b)
…_amend()

Extend `zephyr_library_amend()` to support an optional directory
argument.
The current `zephyr_library_amend()` works well when used inside a
Zephyr module with same structure, but fails when the macro is called
from Zephyr module integration code is located in a Zephyr
`MODULE_EXT_ROOT` because in this case the CMake code being executed
is not present in the Zephyr module itself, in which case the dir name
creation based on relative to module dir give wrong result.

For this use-case then support a base directory.
This also allows for use-cases in Zephyr modules where the directory
structure matching Zephyr's own structure is placed in a sub-folder.

Upstream PR #: 87274

Signed-off-by: Torsten Rasmussen <[email protected]>
noup since this option does not exist upstream.

The Oberon PSA core has an option to manually set
the buffer size of the PSA key slots in bytes.

This option here:
MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE

This option has a default value of 16 since it
directly affects the memory usage.

The crypto tests use a secp256r1 key and thus since
the public key for this key is 65 bytes long we need
to set the option in the sample.

Signed-off-by: Georgios Vasilakis <[email protected]>
…and MODE_QUAD_1_4_4"

This reverts commit dd02c86.

Signed-off-by: Marcin Szymczyk <[email protected]>
…_QUAD_1_4_4

Extend driver to support single lane and 1-4-4 IO modes.

Upstream PR #: 85520

Signed-off-by: Marcin Szymczyk <[email protected]>
Allow configuring MTU for CMUX.
Some AT manual and specification define this as a
frame size. Linux ldattach default to 127 bytes,
3GPP TS 27.010 defaults to 31.

We should limit our CMUX frames to a size that
remote end is capable of handling.
Linux silently drops oversized frames.

Also, remove MODEM_CELLULAR_CMUX_MAX_FRAME_SIZE as
this was only limiting a buffer sizes, and resulted
CMUX frames to be capped to same value.
Use MODEM_CMUX_WORK_BUFFER_SIZE and MODEM_CMUX_MTU instead.

Also rename CONFIG_MODEM_CELLULAR_CHAT_BUFFER_SIZES to
CONFIG_MODEM_CELLULAR_CHAT_BUFFER_SIZE as it is now
only used as a Chat module. DLCI pipes use
CONFIG_MODEM_CMUX_WORK_BUFFER_SIZE.

Signed-off-by: Seppo Takalo <[email protected]>
(cherry picked from commit c78081e)
If we end up writing zero bytes to cmux output, we can return
zero instead of -ENOMEM as it would break various modules when
using small buffers. For example modem_chat.c does not tolerate
-ENOMEM but handles zero OK.

Signed-off-by: Seppo Takalo <[email protected]>
(cherry picked from commit 15b0f90)
…` folder

Relocated `bt_shell_private.c` to the `common` folder to enable
independent use between `BT_SHELL` and `BT_MESH_SHELL`.

Signed-off-by: Pisit Sawangvonganan <[email protected]>
(cherry picked from commit eeda631)
This change aims to eliminate the dependency on `ctx_shell` in
the Bluetooth `audio/shell/*`, making the code more maintainable.
Replaced `shell_*` functions that depended on `ctx_shell` with
the appropriate `bt_shell_*` functions.

Signed-off-by: Pisit Sawangvonganan <[email protected]>
(cherry picked from commit f1516c9)
…ests

Instead of using rs=1,2,3 and 4 we make it 10, 20, 30, 40 as the
other values could cause some connection issues.

Signed-off-by: Emil Gydesen <[email protected]>
(cherry picked from commit 7d24771)
nordicjm and others added 25 commits April 7, 2025 08:24
Adds a configuration file which is used with nrfutil to allow
programming QSPI on the device

Upstream PR #: 86985

Signed-off-by: Jamie McCrae <[email protected]>
Adds a configuration file which is used with nrfutil to allow
programming the SPI flash on the device

Upstream PR #: 86985

Signed-off-by: Jamie McCrae <[email protected]>
Adds a configuration file which is used with nrfutil to allow
programming QSPI on the device

Upstream PR #: 86985

Signed-off-by: Jamie McCrae <[email protected]>
Adds a configuration file which is used with nrfutil to allow
programming QSPI on the device

Upstream PR #: 86985

Signed-off-by: Jamie McCrae <[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]>
…lue."

This reverts commit 1e69738.

Upstream PR #: 88121

Ref: NCSDK-32650

Signed-off-by: Tomasz Chyrowicz <[email protected]>

This reverts commit 1e69738
This reverts commit a53cb73.

Upstream PR #: 88121

Ref: NCSDK-32650

Signed-off-by: Tomasz Chyrowicz <[email protected]>

This reverts commit a53cb73.
UDC API passes struct udc_ep_config to all functions. Some UDC functions
were using endpoint config structure while some were using device and
endpoint number. This API inconsistency led to completely unnecessary
endpoint structure lookups. Remove unnecessary lookups by using endpoint
config structure pointer where it makes sense.

Signed-off-by: Tomasz Moń <[email protected]>
(cherry picked from commit 1cccf28)
… hibernated

When endpoint is disabled while hibernated, the UDC endpoint state has
to be reset. Set the busy to false to keep UDC endpoint state in sync
with peripheral register state.

Upstream PR #: 88236

Fixes: 2be960a ("drivers: udc_dwc2: Disable endpoint while
hibernated")

Signed-off-by: Tomasz Moń <[email protected]>
…aly 30.

Applied fix for nRF54L anomaly 30, which requires a periodic
calibration of high-frequency clock.

Upstream PR #: 88112

Signed-off-by: Michał Stasiak <[email protected]>
…and MODE_QUAD_1_4_4"

This reverts commit 999e700.

Signed-off-by: Marcin Szymczyk <[email protected]>
…nable bit"

This reverts commit a7e820a.

Signed-off-by: Marcin Szymczyk <[email protected]>
Separate compatible is required for Flash MSPI quirks.

Upstream PR #: 85520

Signed-off-by: Marcin Szymczyk <[email protected]>
…_QUAD_1_4_4

Extend driver to support single lane and 1-4-4 IO modes.
Move flash chip quirks to a separate file.

Upstream PR #: 85520

Signed-off-by: Marcin Szymczyk <[email protected]>
Upstream PR #: 88166

Some OpenThread functions were called without verifying the return
value, which not only is not the best practice, but also could lead to
build warnings with llvm. This commit fixes it.

Signed-off-by: Robert Lubos <[email protected]>
Commit fixes bug when corresponding group ID was never
incremented for independent corresponding relationships.

Signed-off-by: Aleksandr Khromykh <[email protected]>
(cherry picked from commit 69c5c6f)
Signed-off-by: alperen sener <[email protected]>
…using launcher

Add possibility to use pinctrl to configure pins that should be assigned
to nRF VPR coprocessors and also provide a way of preventing activation
of the nordic_vpr_launcher driver for an enabled VPR so that it can be
supplied with the code to execute and launched in a custom way.

Signed-off-by: Andrzej Głąbek <[email protected]>
(cherry picked from commit 54d8c80)
…ion in nRF54H/nRF92

Add an entry for the RAM region assigned to soft peripherals that will
disable caching for that region. Without this, communication with the
FLPR coprocessor cannot be performed correctly.

Signed-off-by: Andrzej Głąbek <[email protected]>
(cherry picked from commit 4dded19)
nrf-squash! [nrf noup] drivers: pinctrl: Add SDP MSPI pin configuration

Make it possible to use SDP_MSPI_* functions also in pinctrl nodes
assigned to VPR cores and also for nRF54H SoCs.

Signed-off-by: Andrzej Głąbek <[email protected]>
Upstream PR #: 88359

Do not ignore return values of OT functions registering IPv6 addresses.
As this is called from the net_mgmt callback context, which returns
void, there's not much that can be done, other than logging the error.

To simplify the logging code and avoid the need to use extra buffer,
use net_sprint_ipv6_addr() networking utility function within the log
message to convert binary address to string.

Signed-off-by: Robert Lubos <[email protected]>
Upstream PR #: 88359

clear_pending_events() was not used anywhere.

Signed-off-by: Robert Lubos <[email protected]>
Declaration of variables after a label inside a switch statement is a
c23 extension, not c99.

This results in the following warning when compiling with clang:
> .../subsys/net/lib/zperf/zperf_shell.c:912:4: warning: label followed
>                by a declaration is a C23 extension [-Wc23-extensions]
>   912 |                      int seconds = parse_arg(&i, argc, argv);
>       |                         ^
> .../subsys/net/lib/zperf/zperf_shell.c:1145:4: warning: label followed
>                by a declaration is a C23 extension [-Wc23-extensions]
>  1145 |                      int seconds = parse_arg(&i, argc, argv);
>       |                         ^
> 2 warnings generated.

There are no practical reasons why the variable should be declared
inside the switch statement, therefore move the declaration and place it
together with declaration of other variables.

Upstream PR #: 88403

Signed-off-by: Torsten Rasmussen <[email protected]>
@sonarqubecloud
Copy link

meijemac added a commit to meijemac/sdk-zephyr that referenced this pull request Jun 10, 2025
PR merged and rebased from Krzysztof Chr. - nrfconnect#2524
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.