Commit graph

22128 commits

Author SHA1 Message Date
Robert Lubos
271e0c54ed net: context: Reset peer address on connect with AF_UNSPEC
As per POSIX, for non-connection-mode sockets the peer address should be
reset if AF_UNSPEC family type is provided to the connect() call:

  "If the sa_family member of address is AF_UNSPEC, the socket's peer
   address shall be reset.""

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-08-11 13:23:42 -05:00
Chris Friedt
ef7c4dc3aa net: lib: ocpp: use sys_clock_gettime() instead of gettimeofday()
Use the native zephyr sys_clock_gettime() call instead of the XSI
gettimeofday(), since XSI is not required here and would normally
require CONFIG_XSI_SINGLE_PROCESS to be selected.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2025-08-11 13:21:11 -05:00
Chris Friedt
e197c312cc net: lib: ocpp: select Kconfig for reentrant function gmtime_r()
Select CONFIG_POSIX_C_LANG_SUPPORT_R for the reentrant version of
gmtime(), gmtime_r().

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2025-08-11 13:21:11 -05:00
Jamie McCrae
c58ae17389 mgmt: mcumgr: grp: img_mgmt: Show firmware loader slot info
Allows returning image information for the firmware loader image
slot, showing version of the application and flags

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-08-11 13:18:20 -05:00
Daniel Flodin
a4b66f9214 cmake: assembler optimization options
Commit f499ea0 made it so that the compiler optimization flags are also
passed to the assembler. However, this breaks for the IAR toolchain
since it uses the GNU assembler which does not have the same
optimization flags as the IAR compiler.

This commit separates the compiler and assembler optimizations to make
it possible to specify appropriate flags in a toolchains corresponding
`compiler_flags.cmake`

Signed-off-by: Daniel Flodin <daniel.flodin@iar.com>
2025-08-11 12:49:21 +03:00
Alex Fabre
bfd2ac78ad shell: add app version command
This commit brings a shell command to retreive the following application
version information:

- APP_VERSION_STRING
- APP_VERSION_EXTENDED_STRING
- APP_BUILD_VERSION

Signed-off-by: Alex Fabre <alex.fabre@rtone.fr>
2025-08-09 20:27:30 -04:00
Chris Friedt
62f62dbb0b bluetooth: classic: shell: mitigate label followed by declaration
A recent change triggered a warning in LLVM that was promoted to error
when run with twister.

```shell
goep.c:102:3: error: label followed by a declaration is a C23 extension
  [-Werror,-Wc23-extensions]
  102 |                 int err;
```

Add a scope to the switch case so that the declaration has proper scope.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2025-08-09 12:39:05 +03:00
Radosław Koppel
c62bd3a88e Bluetooth: Remove _node field of bt_conn_cb if not used
After the #93703 PR was merged we get a possibility to remove _node field
from bt_conn_cb struct if the BT_CONN_DYNAMIC_CALLBACKS option is disabled.
The list conn_cbs can also be safely removed by more macro usage.

Signed-off-by: Radosław Koppel <r.koppel@k-el.com>
2025-08-09 03:39:52 -04:00
Sam Friedman
a9dc9395a4 Bluetooth: Controller: Allow default to maximum DLE value
CONFIG_BT_CTLR_DATA_LENGTH_MAX should set its default value up to
and including the maximum value supported by the Bluetooth spec
(251 bytes).

Signed-off-by: Sam Friedman <sam@golioth.io>
2025-08-09 03:39:42 -04:00
Lyle Zhu
34bd7dc6b8 Bluetooth: GOEP: Support the empty Name header case
According to the OBEX Version 1.5, the Name header could be a empty
string.

Update function `bt_obex_add_header_name` to support the case that the
length of name could be 0.

Update function `bt_obex_get_header_name` to support the case that the
name header is found but the name length is 0.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-08 10:43:07 -05:00
Lyle Zhu
5d5add259e test: shell: GOEP: Optimize TLV-triplet setting
Add a TLV array `tlvs` to keep the pending TLV data.

Update `app_param`, `auth_challenge`, and `auth_rsp` to set the one
TLV information each time. When the optional argument `last` set,
write the all pending TLVs to the tx buffer.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-08 10:43:07 -05:00
Lyle Zhu
c418d21793 Bluetooth: GOEP: Improve TLV triplet encoding and parsing
Add a structure `struct bt_obex_tlv` to pass/save the one TLV info.

Use a array of `struct bt_obex_tlv` as the set of all TLV-triplets.
Update the following functions to  support the feature, including
`bt_obex_add_header_app_param`, `bt_obex_add_header_auth_challenge`,
and `bt_obex_add_header_auth_rsp`.

Add a function `bt_obex_tlv_parse` to parse the encoded TLV-triplets.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-08 10:43:07 -05:00
Lyle Zhu
0dfae64699 Bluetooth: OBEX: Check if the added string is valid
There are types of string can be added by using OBEX adding header
function bt_obex_add_header_*(). One is byte sequence. Another is null
terminated Unicode text.

Add a function bt_obex_string_is_valid() to check if the added string
is valid. And add a function bt_obex_unicode_is_valid() dedicated to
check Unicode string.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-08 10:43:07 -05:00
Lyle Zhu
ccad303d50 Bluetooth: shell: Add OBEX commands for GOEP
Add commands for GOEP to test OBEX features.

Add command `alloc-buf` and `release-buf` to allocate and release TX
buffer.

Add command set `add-header` to add the OBEX headers to allocated TX
buffer.

Add command set `client` to send OBEX client requests with allocated
TX buffer.

Add command set `server` to send OBEX responses with allocated TX
buffer.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-08 10:43:07 -05:00
Lyle Zhu
8d1b3e9111 Bluetooth: shell: Add transport commands for GOEP
Add commands for GOEP to test transport features.

Add commands for transport over RFCOMM, including `register-rfcomm`,
`connect-rfcomm`, and `disconnect-rfcomm`.

Add commands for transport over L2CAP, including `register-l2cap`,
`connect-l2cap`, and `disconnect-l2cap`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-08 10:43:07 -05:00
Lyle Zhu
bfd42f5c80 Bluetooth: GOEP: Improve the MTU configuration
The MTU of the GOEP should be not less than 255. So, if the transport
is RFCOMM, the CONFIG_BT_BUF_ACL_RX_SIZE should be not less than 264.
It includes,
- 255 bytes for the minimum MTU of GOEP,
- 4 bytes for L2CAP Header,
- 5 bytes for RFCOMM header and FCS.

And if the transport is L2CAP, the CONFIG_BT_BUF_ACL_RX_SIZE should
be not less than 259.
It includes,
- 255 bytes for the minimum MTU of GOEP,
- 4 bytes for L2CAP Header.

Add Kconfig `BT_GOEP_RFCOMM_MTU` to configure the maximum size for
RFCOMM transport. The range of `BT_GOEP_RFCOMM_MTU` is
`[264, BT_RFCOMM_L2CAP_MTU]`. And the GOEP MTU via RFCOMM transport
should be in the range `[255, (BT_GOEP_RFCOMM_MTU-9)]`.

Add Kconfig `BT_GOEP_L2CAP_MTU` to configure the maximum size for
L2CAP transport. The range of `BT_GOEP_L2CAP_MTU` is
`[259, BT_BUF_ACL_RX_SIZE]`. And the GOEP MTU via L2CAP transport
should be in the range `[255, (BT_GOEP_L2CAP_MTU-4)]`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-08 10:43:07 -05:00
Lyle Zhu
3d91b89ed0 Bluetooth: GOEP: Enable GOEP feature
Add a Kconfig BT_GOEP to control the GOEP feature.

Implement the GOEP protocol and transport, both for GOEP 1.1 and GOEP
2.x.

For GOEP transport, OBEX over RFCOMM, and OBEX over L2CAP are
supported.

For GOEP protocol, `put`, `get`, `abort`, `setpath`, and `action` are
supported. And only one operation can be processed at the same time.
The feature `Reliable Session` is unsupported.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-08 10:43:07 -05:00
Håvard Reierstad
f231c5f070 Bluetooth: Host: Add req/rsp l2cap validation
L2CAP channels will now, along with the ident, store the opcode of the
pending request. This commit expands the ident lookup function to also
compare received response types to this opcode, and will ignore
unsolicited responses.

Setting of idents for channels are moved after verification of buffer
allocation for the request to be sent. A TODO is added for improving
this functionality at a later time.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2025-08-08 11:53:43 +03:00
Chaitanya Tata
9dda88fcbd net: ip: Use rate limited version
As this is the hot data path, use a rate limited warning variant.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2025-08-08 11:52:54 +03:00
Chaitanya Tata
f3511602c0 logging: Add ratelimited variants
These are helpful for logging in data-path, not to overwhelm the
console but still keep the user informed about the issues.

This is similar to printk_ratelimited in Linux kernel.

Add only basic build tests for now.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2025-08-08 11:52:54 +03:00
Tyler Joseph Huffman
e57dd8e12d Bluetooth: Controller: Adds path loss monitoring functionality
This functionality is implemented in the HCI-facing side of the
controller and the ULL. LLL functionality is not implemented in this
commit.

Furthermore, this removes a dependency for LE Power Control, as the
features are related, but not necessarily required.

Signed-off-by: Tyler Joseph Huffman <tyhu@demant.com>
2025-08-08 11:52:03 +03:00
Alberto Escolar Piedras
dece77924f net: ocpp: Fix multiple issues detected by clang
Fix multiple warnings detected by clang:
* implicit conversions back and forth from enumeration type
  'enum ocpp_notify_reason' to 'enum ocpp_pdu_msg'
  in ocpp_internal_handler()
* label followed by a declarations
* variable declared after one switch case and used in another
* mapping a int to uint and later using it in < 0 comparisons
  and with negative values

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-08-07 16:20:41 +02:00
Jaro Van Landschoot
1a23d459bc modbus: serial: Divide by zero check
Check if the baudrate is not 0 before dividing by it
to get the rtu_timeout.

Signed-off-by: Jaro Van Landschoot <jaro.vanlandschoot@basalte.be>
2025-08-07 13:15:55 +02:00
Yusuke Omae
ddd41480a7 net: gptp: add missing stepsRemoved assignment
The stepsRemoved of portPriorityVector was
left unassigned when receiving Announce message.

Signed-off-by: Yusuke Omae <s1413091@gmail.com>
2025-08-07 13:15:28 +02:00
Yusuke Omae
877a31ab78 net: gptp: fix comparsion of stepsRemoved
The original implementation select the port
as best_port when stepsRemoved is equal to
the one of best_vector.
When challenger is from announce message
set in GPTP_PA_INFO_SUPERIOR_MASTER_PORT,
its stepsRemoved is the same as in the message.
When challenger is from master_priority
copied in GPTP_PA_INFO_UPDATE,
its stepsRemoved is [stepsRemoved of bestVector]+1.
Thus, we should add one to the challenger's
stepsRemoved in comparsion to avoid useless
update of bestVector.

Signed-off-by: Yusuke Omae <s1413091@gmail.com>
2025-08-07 13:15:28 +02:00
Andrzej Puzdrowski
20695ed091 arch/arm/core/cortex_m: optional memory section for _cp_context
More complex suspend and resume scheme might require exactly defined
location of this variable due to platform peculiar SW and HW requirement.

DTS zephyr,memory-region node with nodelabel `pm_s2ram` shall be used to
automatic definition of linker section for such objective.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2025-08-07 13:15:08 +02:00
Bas van Loon
1dcf123e2d fs/ext2: Fix NULL dereference when fs_stat queries root.
When fs_stat() queries the root / mountpoint it should return its root
i_node but instead it tries to return the parent i_node which does not
exist. Fix this by checking if parent is set otherwise return the root
i_node.

Fixes https://github.com/zephyrproject-rtos/zephyr/issues/94000.

Signed-off-by: Bas van Loon <bas@arch-embedded.com>
2025-08-06 21:34:29 -04:00
Johann Fischer
efaaad0a09 usb: mark new stack as unstable and set it as the default
Document that the legacy stack is now deprecated.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2025-08-06 11:57:39 -04:00
Johann Fischer
4af7549d72 usb: deprecate legacy USB device support
Deprecate legacy USB device support.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2025-08-06 11:57:39 -04:00
Saravanan Sekar
1a4f092348 net: ocpp: Add a support for Open Charge Point Protocol(OCPP v1.6) stack
Basic support for open charge point protocol v1.6 as native stack with
below functionality

1. Framework for ocpp stack and central system communication using RPC over
   websocket according to occp-j.
2. Core profile with basic PDU

Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
Co-authored-by: Sanjay Vallimanalan <sanjay@linumiz.com>
2025-08-06 11:57:13 -04:00
Emil Gydesen
b0f1eb30fb Bluetooth: AICS: Remove bad check in handle_set_gain_op
AICS gain mode does not prevent local nor remote operations from changing
the gain setting value. The gain setting value shall simply be ignored if
in the BT_AICS_MODE_AUTO_ONLY or BT_AICS_MODE_AUTO modes, but the local
application and remote devices can still modify the gain setting value.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-06 17:12:27 +03:00
Sean Madigan
1b7b6af785 bluetooth: host: add frame space update support
This commit adds support for the frame space update feature
to the bluetooth host.

This is mainly just a wrapper around the frame space update
HCI command and event.

Signed-off-by: Sean Madigan <sean.madigan@nordicsemi.no>
2025-08-06 17:11:04 +03:00
Sean Madigan
9bbc906b30 bluetooth: host: Fix BT_LE_LOCAL_SUPPORTED_FEATURES_SIZE define
Fix BT_LE_LOCAL_SUPPORTED_FEATURES_SIZE define, as this was
not working correctly without brackets around
CONFIG_BT_LE_MAX_LOCAL_SUPPORTED_FEATURE_PAGE.

Also fix CONFIG_BT_LE_MAX_LOCAL_SUPPORTED_FEATURE_PAGE help,
as this was talking about remote featues, where this only
applies for local features.

Also update for new CONFIG_BT_CONN_DYNAMIC_CALLBACKS kconfig

Signed-off-by: Sean Madigan <sean.madigan@nordicsemi.no>
2025-08-06 17:11:04 +03:00
Robert Lubos
0f66e9c680 net: context: Don't assert on address family mismatch
Providing a wrong address to the connect() call by the application is no
reason to assert, connect() should just return an error in such case.
Therefore remove the faulty assert and replace it with error log
instead.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-08-06 12:16:42 +03:00
Fabio Baltieri
6ebc196008 net: sockets: getaddrinfo: use k_ variants for memory allocation
The rest of the network (and generally Zephyr subsystem code) use the k_
prefixed variants for memory allocation, which results in data goin in
the _system_heap rather than the stdlib z_malloc_heap.

The code in getaddrinfo use the z_ ones as well apart from the actual
getaddrinfo implementation, which seems like an oversight, change it to
use k_calloc and k_free as well.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-08-06 12:15:49 +03:00
Jisheng Zhang
13bdae0ad0 arch: arm: Add initial support for Cortex-M52 Core
Add initial support for the Cortex-M52 Core which is an implementation
of the Armv8.1-M mainline architecture.

The support is based on the Cortex-M55 support that already exists in
Zephyr.

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
2025-08-06 12:15:23 +03:00
Emil Gydesen
eef2aa88b3 Bluetooth: CTS: Fix issue with writing without subscription
The write_ct function calls bt_cts_send_notification and if
bt_cts_send_notification fails to send a notification (e.g.
if there are no clients subscribed), it would return an
error, and thus send a ATT error response to the client,
even if the value was actually written.

This commit changes the behavior so that the notification
does not affect the return value (as it is not directly
linked to the write itself), but rather just logs it if
it fails to send the notification.

The notification can failed to be send for 2 main reasons:
1) The application returns an error on fill_current_cts_time
2) bt_gatt_notify fails to notify due to missing buffers

The first we cannot do much about. For the latter we can
either just live with the missing notification, or implement
a retry if we run out of buffers. For this simple fix the
former was chosen, but can be revisited if it turns out
to be a significant problem.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-06 12:12:07 +03:00
Emil Gydesen
8e5e9922c5 Bluetooth: ISO: Fix sonarcloud issues in valid_chan_qos
Fixes some sonarcloud issues relating to the if statements.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-05 13:37:13 -04:00
Emil Gydesen
3a963e5286 Bluetooth: ISO: Remove check for SDU size
Since the SDUs are now allocated by the application
and the host does not care about the SDU sizes, the check
is useless.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-05 13:37:13 -04:00
Yago Fontoura do Rosario
ca06a1d80d Bluetooth: Add configuration to control the dynamic connection callbacks
This commit allows to the user to control the use or not of dynamic
connection callbacks.
The stack is not using the dynamic connection callbacks so they are
only needed if the applications want to use it.
Setting it to true for backwards compatibility.

With dynamic connection callbacks

           FLASH:      176600 B       512 KB     33.68%
             RAM:       27428 B        64 KB     41.85%
        IDT_LIST:          0 GB        32 KB      0.00%

Without dynamic connection callbacks

           FLASH:      176376 B       512 KB     33.64%
             RAM:       27428 B        64 KB     41.85%
        IDT_LIST:          0 GB        32 KB      0.00%

Signed-off-by: Yago Fontoura do Rosario <yafo@demant.com>
2025-08-05 13:28:06 -04:00
Yago Fontoura do Rosario
e0d22a308e Bluetooth: Host: Conn callbacks registration with BT_CONN_CB_DEFINE
This commit registers the connection callbacks using BT_CONN_CB_DEFINE,
which ensures they are set up at link time rather than runtime.

Signed-off-by: Yago Fontoura do Rosario <yafo@demant.com>
2025-08-05 13:28:06 -04:00
Yago Fontoura do Rosario
b1eaf02ec1 Bluetooth: Audio: Conn callbacks registration with BT_CONN_CB_DEFINE
This commit registers the connection callbacks using BT_CONN_CB_DEFINE,
which ensures they are set up at link time rather than runtime.

Signed-off-by: Yago Fontoura do Rosario <yafo@demant.com>
2025-08-05 13:28:06 -04:00
Maochen Wang
3ad0b53003 net: l2: wifi: fix the build error of hostapd enterprise
Fix the build error when hostapd enterprise is enabled, it should use
new wifi_set_enterprise_credentials API, instead of
wifi_set_enterprise_creds.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2025-08-05 13:24:02 -04:00
Tim Pambor
be37d72a40 net: tcp: Avoid casting unaligned address to struct in_addr
This change addresses an alignment problem reported by UBSAN by
using a copy of the address. This avoids the need for extensive
rework to support *_raw variants in the routing layer.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2025-08-05 13:23:21 -04:00
Seppo Takalo
05dfc7145f net: lwm2m: Fix string truncation on some content formatters
LwM2M engine does not allow strings to be truncated as it would
lead to invalind UTF-8 strings.

However, some content formatters were truncating, so I fixed at least
these
* plain text
* TLV
* SenML CBOR
* SenML JSON
* JSON
* CBOR

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2025-08-05 13:20:57 -04:00
Daniel DeGrasse
188d78b109 mgmt: update img_mgmt_slot_in_use for ramload with revert mode
We should not block erasing pending images when using ramload with
revert mode, because uploading multiple confirmed images with the same
version would brick the device (preventing future FW updates). Update
the dependencies of img_mgmt_slot_in_use to account for this.

Signed-off-by: Daniel DeGrasse <ddegrasse@tenstorrent.com>
2025-08-05 11:53:58 +01:00
Daniel DeGrasse
2ed1ec9e33 dfu: boot: mcuboot: fix boot_fetch_active_slot
boot_fetch_active_slot needs to map the slot number to a flash ID, as
this is what the DFU subsystem expects when interacting with the flash
partition.

Signed-off-by: Daniel DeGrasse <ddegrasse@tenstorrent.com>
2025-08-05 11:53:58 +01:00
Daniel DeGrasse
e1173afe7d dfu: mcuboot: update dependencies for RAMLOAD_WITH_REVERT
Much like in RAMLOAD mode, RAMLOAD_WITH_REVERT requires that mcuboot
subsystem fetch bootloader information via the retention subsystem.

Signed-off-by: Daniel DeGrasse <ddegrasse@tenstorrent.com>
2025-08-05 11:53:58 +01:00
Vinayak Kariappa Chettimada
c8d4016e04 Bluetooth: Controller: Fix minimal Kconfig depends and defaults
Fix default value of BT_TICKER_REMAINDER_GET, it will be
selected based on enabled Controller features. This is not
needed by minimal peripheral role.

Fix depends on for BT_CTLR_CONN_RANDOM_FORCE as it is
applicable when more than one simultaneous connections is
supported. Again, this is not needed by minimal peripheral
role.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-08-04 17:02:19 -04:00
Mark Wang
f19e7983d0 bluetooth: remove the unnecessary macro wrapper in header files
It eliminates the possibility of using IS_ENABLE(), so it is better to
remove them.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-08-04 19:57:30 +01:00