Skip to content

samples: wifi: wfa_qt_app: Reduce allocated heap - #33

Open
rado17 wants to merge 51 commits into
rlubos:upmerge-07-2026from
rado17:upmerge-07-2026
Open

samples: wifi: wfa_qt_app: Reduce allocated heap#33
rado17 wants to merge 51 commits into
rlubos:upmerge-07-2026from
rado17:upmerge-07-2026

Conversation

@rado17

@rado17 rado17 commented Jul 22, 2026

Copy link
Copy Markdown

RAM usage increase is observed after upmerge. Possible areas seem to be the moving to static memory allocation in network routing libs. To compensate for this, reduce the data heap pool allocated to Wi-Fi driver.

Fixes SHEL-4336.

rlubos and others added 30 commits July 21, 2026 16:14
Update sdk-zephyr revision, pointing to the latest upmerge.

Update other repositories to include upmerge fixes:
* sdk-hostap to align with upstream module
* sdk-connectedhomeip replace removed Kconfig symbol, update include
  paths for generated files
* memfault-firmware-sdk update include paths for generated files
* sdk-find-my update include paths for generated files, drop deprecated
  APIs use
* nrf_wifi fix non-existent keepalive_period reference

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The upstream DEBUG_COREDUMP_BACKEND_LOGGING_UDP backend adds a
"select LOG" within the coredump backend choice while depending on the
networking stack. On its own this is harmless, but combined with the
nRF RPC subsystem it closes a Kconfig dependency loop:

  LOG -> DEBUG_COREDUMP_BACKEND_LOGGING_UDP -> NET_SOCKETS -> ... ->
  SHELL -> NRF_RPC_UTILS_REMOTE_SHELL -> NRF_RPC -> LOG_RPC -> LOG

The ring only closes through nRF-specific Kconfig: LOG_RPC reverse-
selects NRF_RPC while NRF_RPC_UTILS_REMOTE_SHELL selects SHELL, so
NRF_RPC ends up transitively depending on LOG. Stock Zephyr has neither
symbol and cannot form this loop, so it must be broken downstream.

Break the NRF_RPC -> LOG edge by making the logging-over-RPC features
depend on NRF_RPC instead of selecting it. Enabling logging over RPC
without the RPC library is meaningless, so this is the correct
dependency direction; it also requires no changes to in-tree
configurations, which already enable CONFIG_NRF_RPC.

Assisted-by: Cursor:Claude Opus 4.8
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Upstream Zephyr disabled the CONFIG_LEGACY_GENERATED_INCLUDE_PATH
compatibility shim by default (commit d78bf6c1658 "kconfig: Deprecate
LEGACY_GENERATED_INCLUDE_PATH"). Since then the build-time generated
headers that were namespaced under zephyr/ back in commit bbe5e1e
("build: namespace the generated headers with `zephyr/`") can no longer
be included via their old top-level paths.

As a result, sources still using <version.h>, <app_version.h> and
<autoconf.h> fail to build with e.g.:

    fatal error: version.h: No such file or directory

Update the affected includes to the zephyr/ prefixed paths:
  <version.h>     -> <zephyr/version.h>
  <app_version.h> -> <zephyr/app_version.h>
  <autoconf.h>    -> <zephyr/autoconf.h>

Assisted-by: Cursor:Claude Opus 4.8
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Upstream Zephyr disabled CONFIG_LEGACY_GENERATED_INCLUDE_PATH by
default, so generated syscall headers must be included via
<zephyr/syscalls/...>.

Assisted-by: Cursor:Composer 2.5
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Upstream iperf3 expects an autotools-generated version.h, but the
Zephyr port never provides one. Previously #include "version.h"
silently picked up Zephyr's generated kernel version.h via the
legacy include path; after generated headers were namespaced under
zephyr/ and CONFIG_LEGACY_GENERATED_INCLUDE_PATH was disabled by
default, the include fails to resolve. Guard it for NRF integration
builds, since iperf_config.h already defines IPERF_VERSION.

Assisted-by: Cursor:Composer 2.5
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Due to inclusion of b96deb12ad29 ("net: lwm2m: Align URI size in FW
object with FW pull helper") in Zephyr 4.4.1 it's necessary to
additionally provide CONFIG_LWM2M_SWMGMT_PACKAGE_URI_LEN for the test.

Signed-off-by: Antoni Duda <antoni.duda@nordicsemi.no>
Upstream Zephyr commit 10f3251be4f ("i2c: nrfx: use the generic
I2C_TRANSFER_TIMEOUT_MS option") removed
CONFIG_I2C_NRFX_TRANSFER_TIMEOUT in favor of the generic
CONFIG_I2C_TRANSFER_TIMEOUT_MS option.

Assisted-by: Cursor:Composer 2.5
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Upstream Zephyr commit 7f3c897f969 ("drivers: bluetooth: Handle recv()
callback in common layer") moved recv callback handling into the common
HCI layer. Stop passing recv to open() and use bt_hci_recv() instead.

Assisted-by: Cursor:Composer 2.5
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Upstream Zephyr commit 4fd240b4d0f ("doc: Adding Mermaid support for
html documentation") enables sphinxcontrib.mermaid in Zephyr conf.py.
NCS doc CI only installs nrf/doc/requirements.txt, so the Zephyr
docset build failed with ModuleNotFoundError.

Assisted-by: Cursor:Composer 2.5
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Mirror the in_driverbackendgroup ALIAS from upstream Zephyr so the
Zephyr docset build no longer emits unknown command warnings on driver
headers when Sphinx runs with -W.

Assisted-by: Cursor:Composer 2.5
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Commit e6e39f7 removed nrf_cloud_log.h from
nrf_cloud_codec_internal.h, which had been providing
zephyr/logging/log.h transitively. Add the include
directly to nrf_cloud_codec.c.

Assisted-by: Cursor:Composer 2.5
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
CONFIG_DCACHE_LINE_SIZE is no longer defined on Cortex-M cores without a
data cache (e.g. nRF54L) since upstream commit 83b739049cc ("arch: arm:
don't overwrite D/ICACHE_LINE_SIZE from dt") switched the symbol to
configdefault, so it is only defined when DCACHE is enabled. Fall back
to word alignment for the CTR_DRBG stack buffers in that case.

Assisted-by: Cursor:Claude Opus 4.8
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Upstream Zephyr commit 480d0eee454 ("kernel: work: deprecate `thread`
field in struct k_work_q") deprecated k_work_q.thread in favor of
thread_id. Builds with -Werror now fail when naming work queue threads
via the old field.

Assisted-by: Cursor:Composer 2.5
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Upstream Zephyr commit db984ee196b extended ethernet_api and
wifi_mgmt_ops callbacks with struct net_if *iface. Update the
eth_rtt and nrf71 Wi-Fi driver callbacks to match.

Assisted-by: Cursor:Composer 2.5
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Upstream Zephyr commit 0dcf6a345a6 changed uart_irq_update() to return
void, so callers that checked its return value no longer compile. Call
uart_irq_update() on each IRQ loop iteration and test pending/RX state
separately instead.

Assisted-by: Cursor:Composer 2.5
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Upstream Zephyr commits e7cd3fe50fc and 6a7c726903e moved the Bluetooth
shell advertise and scan commands to sys_getopt_long(), and upstream
BT_SHELL selects SHELL_GETOPT and GETOPT_LONG. The duplicated BT_SHELL
for BT_RPC_CLIENT was missing those selects, causing implicit
declaration errors when building the shell on the RPC stack.

Assisted-by: Cursor:Composer 2.5
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Upstream Zephyr commit 6455871bcfb switched the Bluetooth shell to use
bt_conn_drop() instead of bt_conn_unref(), but the RPC client did not
implement the new helper, causing undefined reference errors at link
time when BT_SHELL is enabled on the RPC stack.

Assisted-by: Cursor:Composer 2.5
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Upstream Zephyr commit 0dcf6a345a6 changed uart_driver_api.irq_update
to return void, so the lpuart driver no longer compiles when
CONFIG_NRF_SW_LPUART_INT_DRIVEN is enabled.

Assisted-by: Cursor:Composer 2.5
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Upstream Zephyr commit 1bb2215a455 extended wifi_mgmt_ops with
struct net_if, breaking nrf71 driver builds against recent
sdk-zephyr updates.

Assisted-by: Cursor:Composer 2.5
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
…hange

Upstream Zephyr commit 23099b621b0 changed bt_dev.random_addr from
bt_addr_le_t to bt_addr_t, breaking nrf_audio builds that access the
internal host struct via hci_core.h.

Assisted-by: Cursor:Composer 2.5
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Upstream Zephyr commit 451cfb77b1c made Coordinated Set Size, Set
Member Lock and Set Member Rank optional CSIS characteristics and
required them for BT_CAP_ACCEPTOR_SET_MEMBER, causing nrf_audio
headset builds to fail linking bt_cap_acceptor_register().

Assisted-by: Cursor:Composer 2.5
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Upstream Zephyr commit 9969e524ad3 ("Bluetooth: BAP: Make codec_cfg
param const") changed
bt_cap_initiator_broadcast_subgroup_param.codec_cfg to
const struct bt_audio_codec_cfg *, reflecting that CAP APIs now treat
codec configuration as read-only input and copy it internally rather
than retaining a mutable reference.

bt_audio_codec_cfg_set_chan_allocation() and related helpers still take
a non-const codec_cfg because they modify the configuration in place.
create_param_produce() was assigning the preset pointer into the CAP
subgroup param and then calling those setters through the now-const
field, triggering -Werror=discarded-qualifiers in nrf_audio gateway and
nrf_auraconfig builds.

Configure the preset via a local non-const pointer before assigning it
to subgroup_params[i].codec_cfg, matching the pattern used in upstream
tests such as gmap_ugg_test.c. Also drop the const qualifier from
ext_create_param since this path mutates group_lc3_preset.codec_cfg.

Assisted-by: Cursor:Composer 2.5
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Upstream Zephyr commit be842dfd314 ("Bluetooth: BAP: Make
bt_bap_stream.qos const") changed bt_bap_stream.qos to
const struct bt_bap_qos_cfg *, so writing the presentation delay
through stream->bap_stream.qos->pd triggered an assignment to a
read-only object in nrf_audio unicast builds.

Set the presentation delay via a local non-const pointer, which is safe
here since qos points to app-owned mutable preset storage.

Assisted-by: Cursor:Claude Opus 4.8
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Upstream Zephyr commit 5ac0d14e422 deprecated FUEL_GAUGE_VOLTAGE and
FUEL_GAUGE_RELATIVE_STATE_OF_CHARGE in favor of unit-suffixed names,
causing locator_tag builds to fail with -Werror=deprecated-declarations.

Assisted-by: Cursor:Composer 2.5
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Stop recovering the OpenThread work queue via the deprecated
k_work_q.thread field when kicking the system health watchdog.

Assisted-by: Cursor:Composer 2.5
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Upstream Zephyr added CURRENT_TIME_RID to lwm2m_resource_ids.h for the
IPSO Time object, redefining the macro already used locally for Device
object resource 13 and causing -Werror build failures in lwm2m_client.

Assisted-by: Cursor:Composer 2.5
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Upstream Zephyr renamed MSPI devicetree bindings (jedec,mspi-nor to
jedec,nor and zephyr,mspi-emul-device to zephyr,emul-device-mspi) in
78f9b99ef614 ("bindings: update mspi bindings names and compat string")
and ed16d687b56 ("drivers: mspi: update compat string in device
drivers"), so Nordic overlays no longer matched and MSPI builds failed
with undefined __device_dts_ord_* linker errors.

Assisted-by: Cursor:Composer 2.5
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Upstream Zephyr disabled the usbhs_wrapper node by default and
UDC_DWC2 now selects NRF_USBHS_WRAPPER on nRF54L, which caused
Kconfig build failures on dongle USB samples that only enabled
&usbhs.

Assisted-by: Cursor:Composer 2.5
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Upstream Zephyr renamed net_route_add() to net_route_ipv6_add()
when IPv4 routing was split out, causing implicit declaration
build failures in DECT integration tests.

Assisted-by: Cursor:Composer 2.5
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Upstream Zephyr added struct net_if to wifi_mgmt_ops callbacks, causing
a build failure due to the incompatible scan function signature.

Assisted-by: Cursor:Composer 2.5
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
degjorva and others added 17 commits July 21, 2026 16:14
The nRF5340 NS mesh overlays rebalance the upstream partition layout,
leaving the nordic,tz-{secure,nonsecure} descriptors pointing at
partitions that no longer fit (and at deleted nodes in the emds case).
Override the descriptors per overlay so they match what's left.

Signed-off-by: Dag Erik Gjørvad <dag.erik.gjorvad@nordicsemi.no>
Add nordic,tz-{secure,nonsecure} descriptors so TF-M can derive the
flash layout on PM-off builds. Thingy:91 lists both slots plus
storage; Thingy:91 X only lists slot0 since slot1, fmfu_storage and
storage live on external flash.

Signed-off-by: Dag Erik Gjørvad <dag.erik.gjorvad@nordicsemi.no>
Upstream renamed the secure slot from slot0_partition to
slot0_s_partition on the L10/L15/LM20/7120 NS partition dtsis,
leaving the MCUboot signing helpers without a REQUIRED label.
Probe the old name first and fall back to slot0_s_partition.

Signed-off-by: Dag Erik Gjørvad <dag.erik.gjorvad@nordicsemi.no>
…tions

Upstream Zephyr added nordic-tz-secure/-nonsecure descriptor nodes that
reference the individual flash partitions (the secure/non-secure code
slots, the TF-M data partitions and the settings storage). Overlays that
redefine the partition map drop or restructure those referenced
partitions, leaving the descriptors with dangling phandles and failing
the devicetree build.

Rather than deleting the descriptors, recreate them in the overlays (and
in the shared partition includes) so they mirror the partition layout
each overlay actually defines. TF-M and the SoC soc_secure helpers
derive the TrustZone-M flash layout from these descriptors, so they must
stay in sync with the partitions instead of being removed. Overlays that
redefine partitions in place with the same labels keep inheriting the
upstream descriptor; only those that change the referenced set carry a
recreated descriptor. Secure and bootloader layouts that have no
TrustZone split drop the inherited descriptors, as there are no
secure/non-secure image partitions left to describe.

The descriptors were introduced by upstream commit d8938887620 ("dts:
vendor: nordic: nrf91: Add TrustZone region descriptors") and its
sibling commits adding the same descriptors for nrf5340 (8b839cf1463),
nrf54l15 (e616439918a), nrf54l10 (0efc15d8be8) and nrf54lm20
(a205eb284c1).

Assisted-by: Cursor:Claude Opus 4.8
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Upstream Zephyr renamed the nRF54L Trusted Execution secure slot from
slot0_partition to slot0_s_partition, so overlays and partition includes
that deleted or referenced &slot0_partition failed the devicetree build
with "undefined node label 'slot0_partition'". Rename the affected
&slot0_partition references in the nRF54L10, nRF54L15 and nRF54LM20
samples/tests to the new &slot0_s_partition label.

The shared Matter base partition include cannot simply rename the label:
it is pulled in both by the secure (MCUboot) build, where the vendor
label is still slot0_partition, and by the non-secure build, where it is
slot0_s_partition. It therefore deletes the whole default partitions
node to stay label-agnostic across both layouts. Because the base drops
the entire node, the Matter application include no longer deletes the
individual vendor leaves (slot0_s/slot0_ns/tfm_*/storage) - they are
already gone - which would otherwise fail with "undefined node label" in
the FILE_SUFFIX=tfm build.

The label was renamed by upstream commit 28ae7e8bccb ("dts: vendor:
nordic: Add _s to TF-M slot0_partition name").

Assisted-by: Cursor:Claude Opus 4.8
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Regenerate ASM files after changes in handling IRQ in upstream
Zephyr.

Signed-off-by: Magdalena Pastula <magdalena.pastula@nordicsemi.no>
Nordic i2c target driver based on TWIS peripheral depends on it.

Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no>
Generated test boards for TF-M NS builds lacked nordic-tz-secure and
nordic-tz-nonsecure nodes, so TF-M flash_layout.h failed the build.

Assisted-by: Cursor:Composer 2.5
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Upstream Zephyr now NET_ASSERTs when net_if_get_device() is called on
a non-NULL iface without if_dev. Use an unregistered iface with if_dev
set but no backing device so the test still expects -ENOTSUP.

Assisted-by: Cursor:Composer 2.5
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Upstream Zephyr commit f5240318d48 added i
dts/bindings/buzzer/pwm-buzzer.yaml, which conflicts with this
sample-local copy and breaks the devicetree build.
The bindings were identical, so the sample can use the upstream one
as-is.

Assisted-by: Cursor:Composer 2.5
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Skip Zephyr tests that fail in NCS CI after the upmerge until the
underlying issues are resolved.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Signed-off-by: Katarzyna Giądła <katarzyna.giadla@nordicsemi.no>
Update python packages.

Add PYSEC-2026-3447 to pip whitelist.
Setuptools cannot be updated atm due to conflict with spsdk package

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Signed-off-by: Jan Gałda <jan.galda@nordicsemi.no>
CONFIG_LOG_RUNTIME_FILTERING is enabled by default whenever
CONFIG_SHELL is enabled. However, this is not really useful unless
CONFIG_LOG_CMDS is enabled, or log_filter_set() is used at run-time.
While this is done to make sample.cellular.modem_shell_modem_uart_trace
configuration from sample.yaml to fit into FLASH for thingy91,
all configurations benefit from this by ~5.5kB of FLASH.

Signed-off-by: Tommi Rantanen <tommi.rantanen@nordicsemi.no>
Upstream Zephyr moved device API structs into per-class iterable linker
sections and made the sensor accessors resolve the API through
DEVICE_API_GET(sensor, dev). With CONFIG_DEVICE_API_ASSERT enabled
(default when CONFIG_ASSERT=y) this asserts that dev->api points inside
the _sensor_driver_api section, otherwise it fails at runtime with
"device API is not sensor".

The Nordic sensor_sim and sensor_stub drivers still declared their API
as a plain "static const struct sensor_driver_api", so the struct was
not placed in that section and the assert fired the first time the CAF
sensor manager called sensor_sample_fetch(). This broke the
caf_sensor_manager.core test (sensor_sim) and the caf_sensor_manager
sample (sensor_stub) on qemu_cortex_m3 after the upmerge.

Declared both driver APIs with DEVICE_API(sensor, ...), matching the
idiom used by all upstream sensor drivers, so the API lands in the
_sensor_driver_api iterable section and passes the runtime check.

Ref: NCSDK-40421

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
Upstream Zephyr (zephyrproject-rtos/zephyr#103802) moved device API
structs into per-class iterable linker sections and made
DEVICE_API_GET() assert that dev->api points inside the section for
the requested API class. Any driver still declaring its API as a plain
"static const struct <class>_driver_api" leaves the struct outside that
section, so the newly added assert fires at runtime on the first
subsystem call against the device.

Declare the remaining sdk-nrf driver APIs with DEVICE_API() so their
structs land in the correct iterable section:

- bluetooth: controller: SoftDevice Controller HCI driver (bt_hci)
- drivers: serial: uart_ipc (uart)
- drivers: sensor: pmw3360, paw3212, bme68x_iaq, bh1749 (sensor)
- drivers: gpio: gpio_hpf (gpio)
- drivers: flash: flash_rpc controller (flash)
- drivers: entropy: entropy_cc3xx (entropy)
- subsys: uart_async_adapter (uart)

Assisted-by: Cursor:Claude Opus 4.8
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
NRF_SECURITY_ENABLER applies nRF-Security-oriented defaults whenever
Bluetooth crypto is enabled, most notably implying MBEDTLS_ENABLE_HEAP.
That routes all Mbed TLS / PSA allocations through the fixed-size Mbed TLS
static heap (MBEDTLS_MEMORY_BUFFER_ALLOC_C), whose size defaults to the
upstream Zephyr value of 512 bytes.

The nRF Security (Oberon) backend is only available on Nordic Arm cores
(NRF_SECURITY depends on SOC_FAMILY_NORDIC_NRF && ARM), so any other
target falls back to the vanilla Mbed TLS PSA provider. That provider
expects to allocate from the C library heap; with the 512-byte static
heap forced on instead, AES-ECB and AES-CMAC operations run out of memory
and PSA returns PSA_ERROR_INSUFFICIENT_MEMORY (-141). This broke
Bluetooth host crypto tests on qemu_cortex_m3 and qemu_x86 (bluetooth.addr
RPA resolution and the bluetooth.gatt* db-hash generation), which pass on
upstream Zephyr precisely because upstream does not enable the static heap
for these builds.

The enabler only makes sense where nRF Security can actually be used, so
gate it on the same SOC_FAMILY_NORDIC_NRF && ARM condition as
NRF_SECURITY. Non-Nordic targets then behave like upstream Zephyr and
allocate PSA scratch memory from the C library heap. The now-unreachable
BOARD_NATIVE_SIM branch of the ENTROPY_GENERATOR imply is dropped
accordingly.

Assisted-by: Cursor:Claude Opus 4.8
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
RAM usage increase is observed after upmerge. Possible areas
seem to be the `moving to static memory allocation in network
routing libs`. To compensate for this, reduce the data heap pool
allocated to Wi-Fi driver.

Fixes SHEL-4336.

Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
@rlubos
rlubos force-pushed the upmerge-07-2026 branch 6 times, most recently from 5f149a2 to b01b5b6 Compare July 29, 2026 10:18
@rlubos
rlubos force-pushed the upmerge-07-2026 branch 6 times, most recently from 838d5a3 to 7c0622c Compare July 31, 2026 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants