Commit graph

126,787 commits

Author SHA1 Message Date
Christophe Dufaza
69cab3f6a8 Bluetooth: Host: Fix some MISRA c:M23_112 warnings
Fix some "All if ... else if constructs shall be terminated
with an else clause" (c:M23_112) issues reported by SonarQube.

Signed-off-by: Christophe Dufaza <chris@openmarl.org>
2025-09-22 13:25:11 -04:00
Christophe Dufaza
dca154df3e Bluetooth: Host: Amend disconnected() callback documentation
The API documentation for the disconnected() callback warns that
the listener can't assume that the corresponding connection object
has been freed and may me available to the application.

The recommendations given to still start a new connection
or connectable advertiser are outdated or misleading:
- "start connectable advertising": the options that "will attempt
  to resume the advertiser under some conditions" are deprecated
  since Zephyr 4.0 (BT_LE_ADV_OPT_CONNECTABLE and related)
- "using k_work_submit()": assuming everything will be fine
  when the work is actually processed is not reliable
- "increase CONFIG_BT_MAX_CONN": setting BT_MAX_CONN to N+1
  when planning N simultaneous connections is a work-around
  that users may have gotten used to (despite its footprint),
  but there is no longer any reason to advise it

Stop documenting creating new connections or restarting advertising
from the disconnected() callback and instead recommend relying
on recycled() for these use cases.

Signed-off-by: Christophe Dufaza <chris@openmarl.org>
2025-09-22 13:25:11 -04:00
Christophe Dufaza
60797818d5 Bluetooth: Host: Amend recycled() callback documentation
The API documentation for the recycled() callback predates [1],
and still warns users to "treat this callback as an ISR",
although it now runs on the system workqueue thread,
as does disconnected().
"Making Bluetooth API calls" to "re-start connectable advertising or
scanning" should no longer be "strongly discouraged".

On the contrary, we can emphasize that this is the right event
to listen for to initiate operations that will try to re-allocate
a freed connection object.

Mention that BT_MAX_CONN configures the size of the connection pool.

Refs:
- [1] efb5d83: Bluetooth: Host: Defer `conn.recycled()` to the syswq

Signed-off-by: Christophe Dufaza <chris@openmarl.org>
2025-09-22 13:25:11 -04:00
Christophe Dufaza
c3f175825e Bluetooth: Host: Fix possible inconsistent access to connection state
An assertion in bt_conn_unref() accesses the connection's state
after decrementing its reference count.
This is not consistent since, if we removed the last reference,
the Bluetooth Host stack may reuse the connection object
before the assertion is checked.
Instead, retrieve the connection property tested by the assertion
before decrementing the counter, as we do for other properties.

Simplify the code path by returning early when we did not remove
the last reference.

Remind that automatic advertiser resumption is deprecated.

Signed-off-by: Christophe Dufaza <chris@openmarl.org>
2025-09-22 13:25:11 -04:00
Christophe Dufaza
51f57da387 Bluetooth: Host: Fix use of local variable as atomic target
In bt_conn_unref(), a local variable is used as atomic target:

    atomic_val_t old = atomic_dec(&conn->ref);
    /* Prevent from accessing connection object */
    bool deallocated = (atomic_get(&old) == 1);

Using atomic_get() to access a non-shared local variable
cannot prevent any data race on that variable,
and only causes confusion.

Moreover, this call to atomic_get() is incorrect: the API expects
an atomic_t* argument (target), not an atomic_val_t* (value).
This compiles and /works/ only because Zephyr defines both to be
the same integer type, and thus: atomic_get(&old) == old.
The equivalent C11 code, where _Atomic(T) and T are different types,
wouldn't compile.

Signed-off-by: Christophe Dufaza <chris@openmarl.org>
2025-09-22 13:25:11 -04:00
Szymon Janc
9354e06422 Bluetooth: SMP: Print extra state information on timeout
This gives some extra information on what could be a reason
for SMP timeout.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2025-09-22 11:17:59 +02:00
Jonas Berg
81dc0ecf33 boards: shields: Add Adafruit VEML7700 light sensor shield
Product photo from https://learn.adafruit.com/assets/122469,
which has the CC BY-SA 3.0 license.

Tested with the command mentioned in the index.rst page.

Signed-off-by: Jonas Berg <jonas.s.t.berg@gmail.com>
2025-09-22 11:17:52 +02:00
Eve Redero
6b809c2107 boards: add steelseries apex_pro_mini
Initial support for the Apex Pro Mini keyboard,
based on STM32L412.

Signed-off-by: Eve Redero <eve.redero@gmail.com>
2025-09-22 11:17:44 +02:00
Benjamin Cabé
59bf4e7895 cmake: clang: set no_track_macro_expansion properly
Compiler property no_track_macro_expansion is controlled by
CONFIG_COMPILER_TRACK_MACRO_EXPANSION.
When that Kconfig is set to Y, clang fails with the following error
message:

   unknown argument: '-ftrack-macro-expansion=0'

This commit modifies clang/compiler_flags.cmake so that there is a
proper clang compiler option for this flag.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-09-22 11:17:34 +02:00
Ludvig Jordet
8720ab7390 Bluetooth: Mesh: Deprecate blob_io_flash erase cap options
The only reason to keep these would be to enable conditional compilation
of some parts of the code. However, we can't see enough benefit in doing
this, particularly since the flash driver itself will conditionally
handle certain paths depending on erase caps, so the options are
deprecated to reduce complexity.

Signed-off-by: Ludvig Jordet <ludvig.jordet@nordicsemi.no>
2025-09-22 11:17:25 +02:00
Ludvig Jordet
db207b04a8 Bluetooth: Mesh: decouple blob_io_flash from internal flash
This fully decouples blob_io_flash from specific flash device details,
by not reading the write block size from a hard-coded device tree node,
instead pulling this from the actual flash device used.

The block write routine has been updated to be more generic and fix a
few bugs:

  * The write buffer is now sized based on a KConfig option instead of
    basing it off the device tree - this makes the module usable with
    any flash device, not just the internal memory. The configured value
    is checked during initialization, to ensure that the configured size
    will fit the write block size required by the device passed to the
    init function.
  * The erase value used to fill the buffer when using a device with
    explicit erase is now pulled from the flash parameters instead of
    being hard-coded to `0xff`.
  * An additional write block sized piece of buffer is allocated - the
    previous buffer sizing with rounding up only worked if
    `BLOB_RX_CHUNK_SIZE % WRITE_BLOCK_SIZE` was 0 or 1 (which
    coincidentally worked in all testing because the chunk size defaults
    to 161, and for internal flash w/write block size of 4,
    `161 % 4 == 1`).
  * The choice of whether to just write the chunk as-is or to
    write-block align it is now based on the erase cap pulled from the
    flash parameters, instead of checking the type of memory in the SOC.
    This means the module dos _not_ currently support the case where
    memory has to be written write-block aligned, but the memory does
    _not_ use explicit erase. It uses a trick of filling the write
    buffer with the erase value to avoid overwriting existing chunks,
    which will not work in this case. This trick is required to support
    random ordered chunks while still writing write-block aligned.
  * The code has been cleaned up a bit in general.

Signed-off-by: Ludvig Jordet <ludvig.jordet@nordicsemi.no>
2025-09-22 11:17:25 +02:00
Ludvig Jordet
99190cb08f Bluetooth: Mesh: make blob_io_flash support smaller blocks
Only erase a page when starting the first block on that page.
This fixes a bug where, if the block size is smaller than the page size,
the entire page would be erased upon start of each block when writing,
meaning only the final block on each page would be retained. This works
because blocks are always received in order.

Signed-off-by: Ludvig Jordet <ludvig.jordet@nordicsemi.no>
2025-09-22 11:17:25 +02:00
Ludvig Jordet
294a2cd9db Bluetooth: Mesh: Decouple blob_io_flash erase from flash config
This adds a Kconfig dependency on FLASH_PAGE_LAYOUT when using flash
with explicit erase, removing all code dependencies on flash
configuration from the erasure logic. This module already requires
FLASH_PAGE_LAYOUT to be set when using it with flash with explicit
erase, as a silent requirement. The current code does not work without
this option enabled except for the case where a BLOB has a size which is
a multiple of the page size (since, without it, trying to erase flash
space for the final block, which is of variable size, will fail). Also
cleans up the code a bit.

Signed-off-by: Ludvig Jordet <ludvig.jordet@nordicsemi.no>
2025-09-22 11:17:25 +02:00
Andre Heinemans
c2190552cc boards: imx95_evk: add zephyr,flash-controller to dts
Choose mt35xu01gbba for zephyr,flash-controller. This is needed for
building mcuboot or other application accessing flash.

Signed-off-by: Andre Heinemans <andre.heinemans@nxp.com>
2025-09-22 11:17:17 +02:00
Andre Heinemans
0c545f272d boards: imx95_evk: add flash target
Add target for imx95-evk that runs code from the mt35xu01gbba external
flash connected through flexspi

Signed-off-by: Andre Heinemans <andre.heinemans@nxp.com>
2025-09-22 11:17:17 +02:00
Jordan Yates
c0a2928f46 modem: at_shell: extract user pipe handling
Extract the user pipe setup and claim/release logic so that it can be
re-used by other software modules, if the AT shell is not used. Ideally
the chat instance would live within the `modem_at_user_pipe.c` and be
handed out by `modem_at_user_pipe_claim`, but the current chat API
doesn't make this possible.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-09-22 09:53:00 +02:00
Khoa Tran
9432e6c360 tests: pm: power_mgmt_soc: Enable tests on Renesas RA boards
Enable SoC power management on these Renesas RA boards.
- ek_ra8m1
- ek_ra8d1
- mck_ra8t1
- ek_ra8p1/r7ka8p1kflcac/cm85

Signed-off-by: Khoa Tran <khoa.tran.yj@bp.renesas.com>
2025-09-22 09:52:27 +02:00
Khoa Tran
c2bb4bd80e drivers: pwm: Add initial polarity value for Renesas RA GPT PWM
Add initial polarity value for Renesas RA GPT PWM

Signed-off-by: Khoa Tran <khoa.tran.yj@bp.renesas.com>
2025-09-22 09:52:27 +02:00
Khoa Tran
00d18a6113 soc: renesas: ra: Change the counter of g_protect_counters
Change the counter value of g_protect_counters following HAL

Signed-off-by: Khoa Tran <khoa.tran.yj@bp.renesas.com>
2025-09-22 09:52:27 +02:00
Khoa Tran
620738016e manifest: Update revision of hal_renesas
Update revision of hal_renesas to get the FSP 6.1.0 migration

Signed-off-by: Khoa Tran <khoa.tran.yj@bp.renesas.com>
2025-09-22 09:52:27 +02:00
Robert Lubos
178150590c net: tcp: Fix ACK processing when FIN packet is received
In case FIN packed also acknowledged most recently sent data, not all
ack-related TCP context variables were updated, resulting in invalid SEQ
number values sent in consecutive packets.

Fix this by refactoring the FIN handling in TCP_ESTABLISHED state.
Instead of having a separate block strictly for FIN packet processing,
let the packet be processed by common code responsible for regular
data/ack processing. This should be less error-prone for any future
modifications or not-yet-discovered issues. Only after the common
processing of data/ack is done, we check whether FIN flag was present in
the packet, and mark the connection for closing.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-09-22 09:52:13 +02:00
Robert Lubos
99b435788e tests: net: tcp: Add test for FIN,ACK received after final data
Add a test case for a scenario where the final data sent by one peer is
acknowledged in the FIN,ACK response from the other peer. Verify that
the acknowledgment is handled correctly, and a consecutive sequence
number sent by the TCP stack in such case is set correctly.

This complements the other existing test for FIN packet handling, which
verified that data received in a FIN packet is handled correctly. With
those tests in place it should be safer to update any logic related to
FIN packet handling.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-09-22 09:52:13 +02:00
Cristian Bulacu
5f64a3a666 samples: net: openthread: border_router: Enable IPv4 to IPv6 mapping
Updated border router configuration to enable IPv4 to IPv6 address
mapping feature

Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
2025-09-22 09:52:03 +02:00
Cristian Bulacu
58743ee840 modules: openthread: udp: Allow IPV4 traffic to OT UDP sockets
When CONFIG_NET_IPV4 && CONFIG_NET_IPV4_MAPPING_TO_IPV6 are enabled,
allow IPV4 traffic to platform sockets by setting IPV6_ONLY to 0.

Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
2025-09-22 09:52:03 +02:00
Cristian Bulacu
ecd455bb72 modules: openthread: mdns_socket: Add IPv4 addresses to localhost
This commit aims to add IPv4 addresses to mDNS localhost.

Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
2025-09-22 09:52:03 +02:00
Fin Maaß
186bb57b97 drivers: serial: litex: make sure to just disable irq
just disable irq and not plush pending events,
so we don't loose them, when they are enabled
again.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-09-22 09:51:36 +02:00
Robert Lubos
eda76ad21b net: tcp: Preallocate TX packet for TCP context
TCP context cannot operate w/o a TX packet for buffering transmitted
data. So far this net_pkt was allocated at runtime from the common
packet pool, but this created some not-obvious memory requirement on TCP
and could lead to TX packet starvation in case many TCP connections are
open in parallel. Therefore, allocate this packet structure statically,
as a part of the TCP context instead.

This increases the memory requirement of the TCP context by ~64 bytes,
however if that's a concern for the application, the maximum number of
TX packets can be lowered instead. In return, we get a clear separation
between the number of TCP connections opened, and the amount of packets
that can be transmitted.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-09-22 09:51:10 +02:00
Robert Lubos
b8c7984099 net: pkt: Add helper function to initialize TX packet
Add helper function to initialize externally allocated TX packet. It's
especially important to configure net_buf slab for the packet so that
net buffers are allocated from a correct pool for the packet.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-09-22 09:51:10 +02:00
Robert Lubos
aca511c91f net: tcp: Use net_buf pointer directly for out-of-order recv queue
Using net_pkt for TCP out-of-order recv queue was an overshot, as the
mechanism mostly used net_buf operations directly anyway. It can be
easily replaced with a direct net_buf pointer, so that it's not longer
needed to hog one net_pkt per TCP context anymore.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-09-22 09:51:10 +02:00
Sheeba Babu
71f6840a1b doc: clarify gcc-multilib instructions for AArch64
Changed 'remove' to 'omit' to clarify package instructions for
AArch64 systems. This improves clarity for users following the
Zephyr SDK setup guide.

Signed-off-by: Sheeba Babu <sheebakarickom@gmail.com>
2025-09-21 20:52:47 -07:00
Anas Nashif
e3d2e7d60d tests: kernel: fix issue with stack overflow detection
on arc, the test fails with an MPU error instead of a stack
overflow because the priv stack is merged into the defined
stack.

Fixes #68682

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-09-21 18:10:16 -04:00
Ayush Singh
1c1598601b boards: beagle: pocketbeagle_2: a53: Enable watchdog
- Enable main_rti0 watchdog timr.
- Tested on PocketBeagle 2 with the samples/drivers/watchdog.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-09-20 23:05:44 +02:00
Ayush Singh
2ac7899791 dts: arm64: ti: am62x_a53: Add MAIN domain RTI
- Add Real Time Interrupt (RTI) nodes.
- Works as watchdog timers.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-09-20 23:05:44 +02:00
Jonas Berg
ab00c2b718 boards: shields: Add Adafruit 8-channel solenoid shield
Tested with the commands mentioned in index.rst

The product photo is from
https://learn.adafruit.com/assets/137335
with the license CC BY-SA 3.0

Signed-off-by: Jonas Berg <jonas.s.t.berg@gmail.com>
2025-09-20 23:05:14 +02:00
Fabio Baltieri
9e42f0cfa1 samples: capture: fix a double promotion warning
Fixes

samples/drivers/pwm/capture/src/main.c:50:47: warning: implicit
conversion from 'floa' to 'double' when passing argument to function
[-Wdouble-promotion]
   50 |                         (float)tim_clk_cycles / (float)period,
      |                         ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
samples/drivers/pwm/capture/src/main.c:51:46: warning: implicit
conversion from 'floa' to 'double' when passing argument to function
[-Wdouble-promotion]
   51 |                         (float)(width * 100) / (float)period);
      |                         ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-09-20 11:11:21 +02:00
Declan Snyder
a6836866b1 drivers: lpuart: Dont say we support async without DMA
The dma has to be enabled on the platform in order for ASYNC API to
work. This can be indicated by whether or not any LPUART node has the
`dmas` property set.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-09-20 11:11:09 +02:00
Ederson de Souza
960050bc38 MAINTAINERS: Add boards/intel/btl to Intel Platforms (x86)
It helps bots to find reviewers for PRs.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-09-20 11:10:59 +02:00
Ederson de Souza
823c519db2 subsys/llext: Fail if section name index is outside strings area
Avoid unintended out of bounds accesses.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-09-20 11:10:51 +02:00
Ederson de Souza
2bc84dc6d6 subsys/llext: Fail if symbol name index is outside strings area
Avoid unintended out of bounds accesses.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-09-20 11:10:51 +02:00
Ederson de Souza
3f6734034a subsys/llext: Fail if stated symbol size doesn't fit elf_sym_t
As it avoid unintended overflows.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-09-20 11:10:51 +02:00
Quy Tran
77d02aa1f9 drivers: sdhc: Update timeout unit to us for event wait
r_sdhi_wait_for_event requires input timeout as us but the current
implemetation using timeout_ms instead

Signed-off-by: Quy Tran <quy.tran.pz@renesas.com>
2025-09-20 11:10:24 +02:00
Zhaoxiang Jin
19ef6117df boards: nxp: Cleanup XIP, XMCD and DCD files
Cleanup XIP, XMCD and DCD files to convert
camel case to snake case.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2025-09-20 11:10:05 +02:00
Zhaoxiang Jin
39f6b5e9e3 soc: nxp: imxrt: Convert camel case to snake case
Convert camel case to snake case

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2025-09-20 11:10:05 +02:00
Mahesh Mahadevan
efe34d04d2 drivers: nxp: Use a MACRO to enable Wakeup signals
Switch to using the new NXP_ENABLE_WAKEUP_SIGNAL and
NXP_DISABLE_WAKEUP_SIGNAL macros to avoid adding
platform specific calls in the Zephyr drivers.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2025-09-20 11:09:00 +02:00
Mahesh Mahadevan
b0624af741 soc: nxp: Add Macros to handle variation in managing Wakeup IRQ
The SDK code to handle managing Wakeup IRQ's for low power mode
varies between SoC's.
Add a MACRO that can be called by the Zephyr drivers so we
can manage these variations without adding SoC specific code
to the drivers.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2025-09-20 11:09:00 +02:00
Mahesh Mahadevan
fd040a40c0 soc: nxp: Add common folder to the include path
This will allow us to add header files to the
common folder

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2025-09-20 11:09:00 +02:00
Alexandre Rey
0a9d278ccc boards: nxp: disable COP watchdog by default
To preserve the previous logic, the watchdog must be disabled by default
using the dedicated Kconfig option.

Signed-off-by: Alexandre Rey <alx.rey@icloud.com>
2025-09-20 11:08:45 +02:00
Alexandre Rey
65880fab56 soc: nxp: replace WDOG_ENABLE_AT_BOOT by WDT_DISABLE_AT_BOOT
Using WDT_DISABLE_AT_BOOT instead of WDOG_ENABLE_AT_BOOT prevents the
definition of z_arm_watchdog_init, which is important because the COP
watchdog configuration register can only be configured once.

Signed-off-by: Alexandre Rey <alx.rey@icloud.com>
2025-09-20 11:08:45 +02:00
Alexandre Rey
9291bac573 drivers: cop: add support of WDT_DISABLE_AT_BOOT
Add support for CONFIG_WDT_DISABLE_AT_BOOT Kconfig option.

Signed-off-by: Alexandre Rey <alx.rey@icloud.com>
2025-09-20 11:08:45 +02:00
Alexandre Rey
d571f90183 drivers: cop: add NXP cop driver
Port NXP cop driver to Zephyr

Signed-off-by: Alexandre Rey <alx.rey@icloud.com>
2025-09-20 11:08:45 +02:00