Commit graph

24,075 commits

Author SHA1 Message Date
Jordan Yates
d185f8edd0 testsuite: optional limiting of coverage dumps
Add an option that excludes generation of a given path of `.gcda` files
when running coverage testing. This can be useful when running testing
coverage on downstream repos, which would otherwise result in large
`.gcda` files for paths we don't care about filling up the disk.

One example of using this is to exclude coverage outputs from
mbedtls files with the following:
`CONFIG_COVERAGE_DUMP_PATH_EXCLUDE="*modules/crypto/mbedtls*"`

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-10-05 06:18:05 -04:00
Daniel Leung
4ef1163e39 samples: tracing: fix missing k_event funcs for UART test
With the UART transport test (sample.tracing.transport.uart),
it would fail on qemu_x86_64 complaining about missing
k_event tracing functions. So add them to fix the compilation
error.

Fixes #96818

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2025-10-03 21:19:57 -04:00
Fabio Baltieri
37717b229f sys: util: rename Z_MIN Z_MAX Z_CLAMP to min max and clamp
Rename these three macros to an unprefixed lower-case variant. This is
normally not done for Zephyr macros (see container_of) but in this case
it seems like a good idea to adopt the lowercase names to:

1. have the same convention as the equivalent Linux macros, helping devs
   working cross project recognizing (mis)use patterns.
2. make it somewhat intuitive that the lowercase ones are meant to be
   used in functions while the uppercase ones are to be used for static
   evaluation.

Add few c++ guards to avoid colliding with std::min and std::max.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-10-03 21:14:11 -04:00
Fin Maaß
e88be20d52 sd: sdmmc: only with to 4 bit, if supported by host
only switch to 4 bit mode, if it is supported
by the host. for MMC it is already checked,
but not for the sd card.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-10-03 20:59:01 -04:00
Martin Koehler
cd2a38cc2e logging: Fixes #96880
Now only deletes old log files if more data is needed than is available.

Signed-off-by: Martin Koehler <koehler@metratec.com>
2025-10-03 20:58:34 -04:00
Emil Gydesen
5d8170bba8 Bluetooth: BAP: Add conn check assert in bt_bap_iso_bind_ep
Adds assert for bt_bap_iso_bind_ep to ensure that endpoints
from different connection don't share a CIS (a bt_bap_iso).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-10-03 12:51:45 +03:00
Emil Gydesen
1dc98dd932 Bluetooth: BAP: Add check to verify that eps have correct iso
Add a check that verifies that 2 endpoints from different
connection don't share a CIS, which would be invalid.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-10-03 12:51:45 +03:00
Emil Gydesen
4f2ef519b6 Bluetooth: BAP: UC: Move iso_bind_ep to config instead of QoS
We can actually already when we bind the endpoint to the stream
perform the call to bt_bap_iso_bind_ep, if the stream has been
added to a group.

If the stream has not yet been added to a group, then when
the stream is added to a group, then bt_bap_iso_bind_ep will
be done there (existing behavior).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-10-03 12:51:45 +03:00
Benjamin Cabé
febf4e8e53 shell: fix app version sub commands
commands should not have spaces around hyphens:
version - extended --> version-extended
build - version --> build-version

Fixes: zephyrproject-rtos/zephyr#96591

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-10-02 22:00:11 +02:00
Alberto Escolar Piedras
896bdce53a subsys/tracing/tracing_backend_posix: Set file to be closed on exec
If the process does an exec() (or fork, or..) all descriptors are kept
open by default, unless O_CLOEXEC is set when opening them.
This is usefull for stdin/out/err so that new process is connected to
them, but it is very rare for it to be usefull for any other descriptor.

In general this leads to descriptors being kept open unnecessarily,
which either will block other process from getting them (for example
if the child survives the parent but it does something else).
Or for a "leak" which unnecessarily uses descriptors and memory in the
child process.

Let's ensure we do not leak it for this component as we do not need it.

Note glibc fopen supports the "e" modifier as an extension to pass
O_CLOEXEC to the open syscall.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-10-02 22:00:02 +02:00
Jakub Michalski
a0dbd67262 fs: virtiofs: fix off-by-one in virtqueue initialization
REQUEST_QUEUE was passed as queue_num to virtio_init_virtqueues
where REQUEST_QUEUE+1 was required

Signed-off-by: Jakub Michalski <jmichalski@antmicro.com>
2025-10-02 21:59:01 +02:00
Andreas Schweigstill
78b8950fd1 net: http_server: Fix crash when cb refuses new websocket connection
Zephyr crashes when a new websocket connection is refused by the
user supplied callback function. This is caused by multiple calls
of close_client_connection(). After the first call the file handle
and the client->service pointer are invalid.

This fix checks if the file handle is valid.

Signed-off-by: Andreas Schweigstill <andreas@schweigstill.de>
2025-10-02 21:58:28 +02:00
Yangbo Lu
9304035610 net: bridge: support DSA port
DSA switch performs L2 switching on hardware on DSA user ports.
The promisc mode requirement doesn't apply to DSA user ports.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-10-02 21:57:32 +02:00
Anouar Raddaoui
b27ab80d20 modbus: support UART ASYNC API in modbus serial
Reason for this extension are CRC mismatches happening due to RX data
loss when using the interrupt driven API at higher speeds and/or high
CPU load. It is recommended to use the ASYNC API along with hardware
byte counting requiring a timer instance and one PPI channel to achieve
a robust communication at high baudrates on nRF platforms.

Signed-off-by: Anouar Raddaoui <a.raddaoui@smight.com>
2025-10-02 21:56:37 +02:00
Tim Pambor
9041793ccb Revert "ztest: Add validation of zassert strings"
This reverts commit ef73155f96.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2025-10-02 15:14:45 +03:00
Tim Pambor
ef73155f96 ztest: Add validation of zassert strings
Add __printf_like attribute to ztest assertion functions
zassert, zassume, zexpect to validate format strings and arguments
at compile time.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2025-10-02 11:47:01 +03:00
Michael Zimmermann
f07f0d288e net: mqtt_sn: Implement updating will topic and message
Since the protocol doesn't have message IDs in the responses to these
update messages, there's no reliable way to know, if an update succeeded or
not. I use that fact to simplify the implementation by:
- Not providing success/failure callbacks.
- Not handling updating the variables in the client struct while
  an update is in progess.

In addition to adding some tests, I tested this with the emqx server.

Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
2025-10-02 09:31:53 +02:00
Seppo Takalo
0025751414 modem: cmux: Rework the drop handling
Do not read extra byte when we decide to drop a frame.
Instead go directly to MODEM_CMUX_RECEIVE_STATE_SOF, so the next
flag character will start a new frame.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2025-10-01 17:12:50 -04:00
Guennadi Liakhovetski
ca641d8410 llext: only build fs_loader.c if file-systems are enabled
No need to build fs_loader.c if CONFIG_FILE_SYSTEM=n.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2025-10-01 17:12:22 -04:00
Robert Lubos
e8548e697a net: sockets: Reserve a default heap space for getaddrinfo
Add a default heap reservation for gettaddrinfo(), enough for a single
function call in a default configuration on 64-bit platform.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-10-01 17:11:58 -04:00
Ashirwad Paswan
21da2d056d Bluetooth: Controller: Fix missing null pointer check
Added a check for null pointer in ull_sync_iso.c file
to avoid potential crashes.

Fixes: #81997

Signed-off-by: Ashirwad Paswan <ashi06712@gmail.com>
2025-10-01 08:27:33 +02:00
Charles Hardin
f06840221e net: dns: swallow packets that have no useful records in them
There are some poorly compliant mdns responders on the network
that will respond with zero counts on the answers and the additional
records (in addition to the qdcount). So, this removes the checks
in the unpack method since this is a "valid" DNS packet but the
logic is already partially handled in the dns_read code already.

An example packet can be seen in this decode

  0000   33 33 00 00 00 fb 9a f8 c3 0c 07 0b 86 dd 60 07   33............`.
  0010   c4 e4 00 14 11 ff fe 80 00 00 00 00 00 00 98 f8   ................
  0020   c3 ff fe 0c 07 0b ff 02 00 00 00 00 00 00 00 00   ................
  0030   00 00 00 00 00 fb 14 e9 14 e9 00 14 f1 64 00 00   .............d..
  0040   84 00 00 00 00 00 00 00 00 00                     ..........

  User Datagram Protocol, Src Port: 5353, Dst Port: 5353
    Source Port: 5353
    Destination Port: 5353
    Length: 20
    Checksum: 0xf164 [unverified]
    [Checksum Status: Unverified]
    [Stream index: 2]
    [Stream Packet Number: 1]
    [Timestamps]
    UDP payload (12 bytes)
  Multicast Domain Name System (response)
    Transaction ID: 0x0000
    Flags: 0x8400 Standard query response, No error
        1... .... .... .... = Response: Message is a response
        .000 0... .... .... = Opcode: Standard query (0)
        .... .1.. .... .... = Authoritative: Server is an authority
                              for domain
        .... ..0. .... .... = Truncated: Message is not truncated
        .... ...0 .... .... = Recursion desired: Don't do query recursively
        .... .... 0... .... = Recursion available: Server can't do
                              recursive queries
        .... .... .0.. .... = Z: reserved (0)
        .... .... ..0. .... = Answer authenticated: Answer/authority
                              portion was not authenticated by the server
        .... .... ...0 .... = Non-authenticated data: Unacceptable
        .... .... .... 0000 = Reply code: No error (0)
    Questions: 0
    Answer RRs: 0
    Authority RRs: 0
    Additional RRs: 0

Signed-off-by: Charles Hardin <ckhardin@gmail.com>
2025-10-01 08:20:34 +02:00
Seppo Takalo
dac7a0fe06 modem: cmux: Clean debugging a bit
Full CMUX frames are way too much to fill the debug log
so disable those by default.
Sometimes it is enough to see the CMD and response types, without
hexdump.
Added also debug messages for opening and closing events.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2025-09-30 17:57:40 +03:00
Grzegorz Swiderski
335e1c2a97 Revert "fs: zms: Add FLASH_MAP dependency"
This reverts commit 77f19eb1b5.

This dependency was misplaced. See the parent commit.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2025-09-30 15:29:59 +03:00
Grzegorz Swiderski
4a7126d457 settings: zms: Add FLASH_MAP dependency
The ZMS backend for Settings uses the `flash_area` API, which means it
requires CONFIG_FLASH_MAP to be enabled, so update Kconfig accordingly.
Note that ZMS itself does not depend on this.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2025-09-30 15:29:59 +03:00
Tomasz Chyrowicz
cbcf81e3a4 mcumgr: Enable permanent updates in overwrite mode
It is essential for the overwrite mode to allow confirming the secondary
slot to provide the permanent update.
This types of updates is the only mode in which the application may be
upgraded.

Signed-off-by: Tomasz Chyrowicz <tomasz.chyrowicz@nordicsemi.no>
2025-09-30 15:29:33 +03:00
Tomasz Chyrowicz
2e0d9ed2cf mgmt: Add missing CONFIG_ prefixes
Fix the incorrect usage of Kconfig symbols and revert back the default
behavior to allow for non-active slot confirmation.

Signed-off-by: Tomasz Chyrowicz <tomasz.chyrowicz@nordicsemi.no>
2025-09-30 15:29:33 +03:00
Loic Domaigne
bfbc6365ac Bluetooth: Controller: fix assertion check for ptc value
Fix the issue reported by Coverity CID 487708. The LL_ASSERT was
performed on lll->ptc, which is a 4-bit bitfield and therefore always
succeeds. Instead, the computation (lll->nse - nse) should be checked
to ensure it falls within the 4-bit value range before assigning it
to lll->ptc.

Signed-off-by: Loic Domaigne <tech@domaigne.com>
2025-09-30 15:28:36 +03:00
Tim Pambor
00a9905f83 usb: device_next: cdc_acm: init uart config from default line coding
Initialize the UART configuration from the default line coding
when the CDC ACM device is started. This ensures that the UART
configuration matches the default line coding until the host sets
the line coding for the first time.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2025-09-30 15:27:33 +03:00
Emil Gydesen
87e6bff4ef Bluetooth: CAP: Shell: Change to use default_unicast_group
Use default_unicast_group everywhere in the CAP shell, and mark
all creation of it as default_unicast_group.is_cap = true.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-09-30 11:02:29 +02:00
Emil Gydesen
ca80d25bd9 Bluetooth: CAP: Shell: Move ac_create_unicast_group to CAP
Move the function bap_ac_create_unicast_group to the CAP
shell, as that was the only user of it, and rename it to
cap_ac_create_unicast_group, and make it use the CAP API.

Also rename bap_unicast_ac_param to cap_unicast_ac_param

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-09-30 11:02:29 +02:00
Emil Gydesen
bf19edc8d8 Bluetooth: BAP: Shell add common unicast_group struct
Add a common unicast_group struct for both the BAP and
CAP shell, similar to the broadcast_source.

The purpose of this is to be able to use the appropriate type
for both the CAP and BAP shells, instead of using the BAP
unicast group for the CAP shell.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-09-30 11:02:29 +02:00
Seppo Takalo
b8541c53ee modem: modem_cellular: Allow PPP interface to wake up the device
Allow PPP device to wake up the underlying cellular modem.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2025-09-29 12:47:57 -04:00
Michael Zimmermann
9735cb313e net: mqtt_sn: handle timestamp being 0
When running just the test mqtt_sn_client::test_mqtt_sn_wait_suback on
native_sim, the current timestamp is still 0. That caused the test to fail,
because 0 is used as an indicator, that the message has never been sent,
thus sending it every time process_work is executed.

Instead of adding additional variables and complexity, the code now simply
treats now==0 special and waits 1ms until doing anything.

Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
2025-09-29 12:45:15 -04:00
Michael Zimmermann
9b3b5b4447 net: mqtt_sn: scope msg_id to client instance
- The paho client does that, too.
- This allows running single tests, because they don't rely on previous
  ones having incremented the msg_id a certain number of times.
- The variable already existed in the client struct, but wasn't used. I
  guess it was intended that way but never implemented.

Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
2025-09-29 12:45:15 -04:00
Michael Zimmermann
0e2e3c2ece net: mqtt_sn: implement predefined topics
Making the assumption, that mqtt_sn_connect does not process any incoming
data allows for this to be a very simple, additional API function instead
of adding more complexity to the connect function. This also means that the
user has to re-add predefined topics upon reconnects which don't reuse the
old session though.

Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
2025-09-29 12:45:15 -04:00
Daniel Leung
cf7e2e63c1 soc: intel_adsp: rework host IPC using IPC service
This reworks the Intel audio DSP host IPC driver as a backend of
the IPC service. This is the first step to rework IPC in SOF
(Sound Open Firmware) into using a more generic IPC API instead
of a SoC specific one.

For now, it keeps the old interface to maintain usability
as it is going to be a multiple process to rework IPC
over there.

Also, the structure of the new IPC backend resembles
the SoC specific driver to make it easier to compare
between them at this first iteration. Future optimizations
will probably be needed once we start modifying the SOF
side to utilize the IPC interface.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2025-09-29 12:42:00 -04:00
Håvard Reierstad
ff17e601d0 Bluetooth: Host: Add userdefined fixed l2cap chans
Adds support for the user defining their own channels within the
fixed L2CAP channel range. To make this possible, the
`bt_l2cap_fixed_chan` struct and `BT_L2CAP_CHANNEL_DEFINE` macro
needed to converted to public API. In the process of doing so, the
`_destroy` parameter was removed from the `BT_L2CAP_CHANNEL_DEFINE`
macro as it was never used (fixed channels will not be destroyed over
the lifetime of the connection). `BT_L2CAP_CHANNEL_DEFINE` is renamed
`BT_L2CAP_FIXED_CHANNEL_DEFINE` to avoid confusion

The `bt_l2cap_chan_send` function is updated to be able to send data
on fixed l2cap channels.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2025-09-29 12:38:19 -04:00
Emil Gydesen
881a24270c Bluetooth: BAP: Rename and fix bt_bap_is_x_ep
Rename the bt_bap_is_x_ep functions to better match the
modules where they are implemented.

Additionally modify the check to use IS_ARRAY_ELEMENT
in the broadcast sink and source for a stricter check.
IS_ARRAY_ELEMENT cannot easily be used in the unicast
client and server, as the endpoints are part of another
structure.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-09-29 12:38:06 -04:00
Emil Gydesen
6c1cd61792 Bluetooth: BAP: Add missing check for unicast server ep
We check for all other roles when checking whether
an endpoint can send or receive, except for the unicast server.
It is technically implied, but if the ep is not a valid pointer,
then we may access invalid memory.

Add check for bt_bap_ep_is_unicast_server (which uses the new
bt_ascs_has_ep function).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-09-29 12:38:06 -04:00
Emil Gydesen
55a72f6103 Bluetooth: CAP: Implement broadcast to unicast handover
Implement the broadcast to unicast handover procedure,
as per the Bluetooth CAP specificiation.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-09-29 12:36:00 -04:00
Andrew Featherstone
d7176c729a tests: kernel: gen_isr_table: Add support for hazard3
Extend the gen_isr_table test to support the Hazard3 cores on the
RP2350A. This allows some testing when building and running using flash,
but it seems like Twister builds with different flags. It's unclear if
this is intended or not.

Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
2025-09-29 12:30:28 -04:00
Robert Lubos
e27f8ccf91 net: context: Fix IPv4-to-IPv6 mapped sendto()
Commit 48897a9090 fixed the address
mapping for dual-stack sockets when sendmsg() was used, however the same
similar issue appears (cannot check for AF_INET family for mapped
addresses as those are AF_INET6) for regular sendto() calls.

Therefore, for the sendto() case, where dst_addr is specified, check if
the address is mapped with net_ipv6_addr_is_v4_mapped() function as
well.

This also fixes another bug in sendmsg() case, where msghdr->msg_name
could've been dereferenced even if it was NULL (for example in case
of a connected socket).

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-09-29 09:58:06 +02:00
Jordan Yates
584aa3e342 testsuite: ztest: disable ZTEST_NO_YIELD for COVERAGE_DUMP
Don't enable `ZTEST_NO_YIELD` when `COVERAGE_DUMP` is enabled, since
this option spins forever at the end of `main`, while `COVERAGE_DUMP`
occurs after `main` returns into `bg_thread_main`.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-09-26 09:35:41 -04:00
Jukka Rissanen
ed6b4a2abd net: websocket: Send CLOSE back to server when received one
When zephyr receives WS CLOSE, send it back to server and close
the TCP connection.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-09-26 09:35:24 -04:00
Jukka Rissanen
688bc4bf86 net: websocket: Fix the typo in function name
s/interal/internal/g

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-09-26 09:35:24 -04:00
Tomi Fontanilles
3ced42c5e5 secure_storage: remove experimental status
The subsystem has been out for a year.
It has been taken into use by various parties and has gone through
additional downstream testing.
It is considered stable and mature enough to not be experimental
anymore.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2025-09-26 13:24:06 +02:00
Tomi Fontanilles
fd0bf8b2f9 secure_storage: add version to psa_secure_storage Doxygen group
Align the version with the current latest published specification.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2025-09-26 13:24:06 +02:00
Tomi Fontanilles
98e48e8c90 secure_storage: document psa/error.h
Add Doxygen documentation to everything defined in this header file.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2025-09-26 13:24:06 +02:00
Tomi Fontanilles
03a349624a secure_storage: its: small language improvements to function comments
Minor tweaks for clarity.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2025-09-26 13:24:06 +02:00