Commit graph

896 commits

Author SHA1 Message Date
Egill Sigurdur
16ac4a5b78 kernel: mem_slab: add K_MEM_SLAB_DEFINE_TYPE for automatic alignment
Introduces K_MEM_SLAB_DEFINE_TYPE() and K_MEM_SLAB_DEFINE_STATIC_TYPE()
helpers to allow the user to declare slabs for types without having to
manually ensure the alignment is correct.

Manual slab alignment was very error-prone and this change fixes several
instances of misalignment that would be trapped by the undefined
behavior sanitizer when running on 64-bit targets.

Signed-off-by: Egill Sigurdur <egill@egill.xyz>
2026-05-07 18:09:41 -05:00
Tomasz Chyrowicz
ce334a9c9f mgmt: img_mgmt: Add a transport-specific req
Add a dependency on the NETBUF size if the UART transport and the
img_mgmt group is selected.

Signed-off-by: Tomasz Chyrowicz <tomasz.chyrowicz@nordicsemi.no>
2026-05-07 13:19:00 +01:00
Tomi Fontanilles
7d65b380e2 modules: mbedtls: link to mbedTLS only when CONFIG_MBEDTLS_BUILTIN
393350fd65 made it so that the `mbedTLS`
library is only created when `CONFIG_MBEDTLS_BUILTIN`.

Before this commit, users of Mbed TLS did the following:
`zephyr_library_link_libraries_ifdef(CONFIG_MBEDTLS mbedTLS)`

If the `mbedTLS` CMake library doesn't exist but is still linked to
(as is the case when `CONFIG_MBEDTLS && !CONFIG_MBEDTLS_BUILTIN`),
the linker command is populated with `-lmbedTLS` which makes the build
fail because there is no `libmbedTLS.a` in the build.

Make it so that users of Mbed TLS only link to the `mbedTLS` CMake
library when the builtin version is used.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2026-05-07 09:11:36 +02:00
Jamie McCrae
a64883ef5d mgmt: mcumgr: grp: os_mgmt: Fix MPSTAT invalid map
Fixes wrongly having an extra map entry for this response

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-05-05 14:05:44 -05:00
Jamie McCrae
6f363ec6f7 mgmt: mcumgr: transport: Fix resetting invalid buffer
Fixes an issue whereby the buffer was not checked to be valid
before resetting it

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-04-27 14:20:21 +02:00
Martin Stumpf
b00f4a1e28 mcumgr: serial: fix tx frame size
The `max_input` variable gets reduced by 3 bytes to make room for the
size header in the first frame; it does not however get reset to its
previous value in the following frame, which permanently reduces
the frame size by three bytes.

Signed-off-by: Martin Stumpf <finomnis@gmail.com>
2026-04-23 08:16:34 -04:00
Jamie McCrae
9da5c07615 mgmt: mcumgr: grp: img_mgmt: Fix non-progressive swap offset erase
Fixes not erasing the first sector when using swap using offset mode

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-04-20 13:22:14 +02:00
Jamie McCrae
f99dbd622e mgmt: mcumgr: grp: fs_mgmt: Fix not checking if write completed
Fixes an issue whereby a write might have partially been successful
but failed due to insufficient space in the storage device by
re-attempting the write again with the offset, and if it still
fails, return an error

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-04-15 17:16:25 -04:00
Jan Kowalewski
e69cafdbb4 mgmt: hawkbit: add missing CONFIG_ prefix
Adds missing CONFIG_ prefix to HAWKBIT_USE_STATIC_CERT_TAG ifdef.

Signed-off-by: Jan Kowalewski <jkowalewski@cthings.co>
2026-03-23 15:00:10 -05:00
Tony Han
587c212277 subsys/mgmt: declare PROCESSOR_NAME for arm926ej-s
Add the declaration of PROCESSOR_NAME for arm926ej-s CPU.

Signed-off-by: Tony Han <tony.han@microchip.com>
2026-03-23 12:27:55 -05:00
Joel Holdsworth
a737213c98 tests: Add basic test-set for OpenRISC architecture port
The OpenRISC 1000 architecture can be tested through the qemu_or1k emulated
SoC and board. Because this emulated device has minimal external hardware
by default, this patch enables a minimal suite of tests covering core
kernel features for the CPU architecture.

When running the test suite, OpenRISC was found to require additional stack
space to prevent an overflow. Therefore, a minimal additional amount of
storage: 128-bytes, was added that was found in practice to allow tests to
complete.

Note that Qemu version 9.2.0 or newer is required so as to include the
following commit:

    commit 3eb43aeb164f1f83c97ff693c7d464b49755110c
    Author: Joel Holdsworth <jholdsworth@nvidia.com>
    Date:   Fri Jun 7 15:29:33 2024 -0700

        hw/openrisc: Fixed undercounting of TTCR in continuous mode

This fixes a bug in the implementation of the emulated OpenRISC Tick Timer
which prevents the Zephyr OpenRISC port from task-scheduling properly.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
2026-03-21 07:50:57 -05:00
Jamie McCrae
f22592cbc5 tree: Replace FIXED_PARTITION_* macro usage with PARTITION_*
Replaces usage of these deprecated macros with ones that support
fixed and mapped partition compatibles. Also includes an update to
hal_espressif which also (rightly or wrongly) has zephyr specific
code in it

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-03-17 18:24:52 -04:00
Jamie McCrae
872905f2f3 mgmt: mcumgr: grp: img_mgmt: Add support for zephyr,mapped-partition
Prevents checking if the flash offset Kconfig is defined

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-03-17 18:24:52 -04:00
Fin Maaß
f4e724a56a mgmt: hawkbit: remove CONFIG_HAWKBIT_DDI_NO_SECURITY
remove the deprecated option
CONFIG_HAWKBIT_DDI_NO_SECURITY.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-03-17 18:23:41 -04:00
Jordan Yates
cc53c73263 mgmt: mcumgr: img_mgmt: typo fix
Fix `Faled` -> `Failed`.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2026-03-10 12:39:23 +01:00
Martin Stumpf
2ef7ee567e mcumgr: Fix 'stat' group error codes
Error codes of group 'stat' were incorrectly labeled as group 'zbasic'.

Signed-off-by: Martin Stumpf <finomnis@gmail.com>
2026-03-03 18:00:54 +01:00
Alberto Escolar Piedras
61e6c0b2a1 mgmt: updatehub: Use renamed network APIs
In
d45cd6716b
f27a26f9ec
the mayority of this code was changed to use the new native networking
API naming, but one macro was forgotten.

Let's change it now so this code builds also without
CONFIG_NET_NAMESPACE_COMPAT_MODE

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-02-27 13:56:24 +01:00
Jamie McCrae
861079f1fe storage: flash_map: Fix macros for offset/address
Fixes macros that broke after changes were merged which started
using the unit address of partition nodes. This also fixes the
test to ensure devices not starting at 0x0 are properly checked
which previously would silently be unknown

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-02-04 13:51:57 +01:00
Jamie McCrae
bcc5529eae mgmt: mcumgr: transport: Add raw dummy transport
Adds a raw dummy UART transport which can be used for testing
MCUmgr without a real transport

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-01-27 10:23:45 -06:00
Jamie McCrae
d5df08a1cc mgmt: mcumgr: transport: uart: Add support for non-console raw mode
Adds support for using MCUmgr over UART (not via shell) in a raw
mode which does not include base64 and other SMP over console
encoding

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-01-27 10:23:45 -06:00
Gaetan Perrot
654dfddc7d mgmt: mcumgr: transport: smp_bt: reduce ret variable scope
The return value variable was initialized but immediately
overwritten before.

Remove the redundant initialization and limit the variable scope to
where it is actually used.

No functional change.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2026-01-25 17:07:05 +01:00
Ibrahim Abdalkader
0c5e7a6a95 sensing: sensor_mgmt: Use kernel heap for allocations
Use the kernel heap instead of the libc heap, improving
security and consistency.

Signed-off-by: Ibrahim Abdalkader <i.abdalkader@gmail.com>
2026-01-22 08:38:34 +00:00
Ibrahim Abdalkader
afa47a2765 mgmt: mcumgr: grp: Use kernel heap for allocations
Use the kernel heap instead of the libc heap, improving
security and consistency.

Signed-off-by: Ibrahim Abdalkader <i.abdalkader@gmail.com>
2026-01-22 08:38:34 +00:00
Jamie McCrae
917404f5d7 mgmt: mcumgr: transport: uart: Change Kconfig to depends on
Changes CONFIG_MCUMGR_TRANSPORT_UART from selecting
CONFIG_UART_MCUMGR to instead of depending upon it, as it should
never have selected a driver Kconfig and instead always depended
upon it, and is needed for supporting different UART transports

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-01-21 11:21:46 +00:00
Jamie McCrae
e3371aaf24 mgmt: mcumgr: Add name to CMake libraries
Adds names to these libraries to prevent using auto-generated
names of the paths, which can be longer than the maximum supported
length on the current version of gcc for windows

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-01-20 15:31:50 +00:00
Jamie McCrae
42ee9832b4 mgmt: mcumgr: kconfig: Fix various issues
Fixes various issues in the Kconfigs including not properly having
abbreviations in the correct case, line lengths, duplicating other
Kconfigs, etc.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-01-20 15:31:50 +00:00
Samuel Kleiser
0fbbba2dc0 mcumgr: fs_mgmt: forward return values from fs_close
A new error code FS_MGMT_ERR_FILE_CLOSE_FAILED is returned when
closing a file fails. This is done on write or close operations - read
operations remain unchecked.

Signed-off-by: Samuel Kleiser <s.kleiser@vega.com>
2026-01-14 09:18:10 -06:00
Jaagup Averin
f430cdef60 subsys/mgmt: Declare PROCESSOR_NAME for native_sim
In case of native build, the CONFIG_architecture
cannot currently be resolved with Kconfig, so we
must fall back to resolving it during compilation
using compiler definitions.

Signed-off-by: Jaagup Averin <jaagup.averin@gmail.com>
2026-01-01 21:27:23 +01:00
Alberto Escolar Piedras
fe1607844c mgmt: mcumgr: Fix remaining net API use
In d45cd6716b the mayority of the
Zephyr codebased was changed to use the Zephyr native net_ prefixed
types, but some were forgotten.
Without this fix/change the code still builds as we are by now setting
CONFIG_NET_NAMESPACE_COMPAT_MODE. But when this is not set, things
fail to build.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-12-18 18:52:06 +00:00
Sylvio Alves
f8d2e00a0e includes: remove duplicated entries in zephyr-tree
Remove duplicated #include directives within the same
preprocessor scope across the Zephyr tree.

Duplicates inside different #ifdef branches are preserved
as they may be intentional.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2025-12-17 13:57:38 -05:00
Tomasz Chyrowicz
26128ab73d mcumgr: Prevent FW loader from self-destruction
The FW loader reports and manages exactly two slots:
 - slot 0: this is the slot for the application code to update
 - slot 1: this is the slot, in which the FW loader is placed

The slot 1 is reported, so tools can fetch metadata about the
FW loader installed on the device.
Unfortunately, currently SMP-based FW loader allows to issue slot erase
command for the slot 1, effectively erasing the FW loader code that is
being executed.

This change correctly identifies the slot 1 as an active one, marking it
as used and blocking erase operation on that slot.

Signed-off-by: Tomasz Chyrowicz <tomasz.chyrowicz@nordicsemi.no>
2025-12-11 16:34:55 -05:00
Martin Stumpf
ffb046b797 MCUmgr: OS: fix set datetime millisecond handling
According to the docs the millis were in the format `.SSSSSS`. In
reality though, it only accepted exactly `.SSS`, not `.SS` or `.SSSS`
and specifically also not `.SSSSSS`, contrary to the docs. Further, it did
not fail with an error message but simply produced the wrong value.

With this change it accepts everything from `.` to `.SSSSSS` and
produces the correct result. This is compatible with the previous
behavior, with the documentation and with everything in between.

Signed-off-by: Martin Stumpf <finomnis@gmail.com>
2025-12-11 16:59:35 +01:00
Tomasz Chyrowicz
764f0d183b img_mgmt: Use absolute address in active partition
Use absolute addresses while determining a running application
partition.

Signed-off-by: Tomasz Chyrowicz <tomasz.chyrowicz@nordicsemi.no>
2025-12-09 09:51:07 -05:00
Ayush Singh
4f98eede4b mcumgr: client: Allow specifying server address
- Currently, it is not possible to use mcumgr client with smp server
  since there is no way to specify smp server address for requests.
- This patch series adds support for creating smp_client_object
  containing information regarding the host server. This design allows
  multiple smp_client_object to exist for the same underlying smp_udp
  transport, making it much easier to use the same udp socket for multiple
  OTAs.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-12-08 11:41:30 -05:00
Mathieu Choplain
aaee496010 mgmt: ec_host_cmd: backends/stm32_spi: configure proper DMA burst length
The burst length unit is bytes, not number of transfers. This had not been
an issue since the DMA driver historically ignored the values, but has now
become one since they are used and (most importantly for us) validated.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2025-12-04 05:23:02 -05:00
Valerio Setti
3a6f0879c4 mgmt: osdp: remove unnecessary cipher selection in mbedtls-shim driver
Cipher support is already implied by default so there is no need to
select it explicitly.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2025-12-01 08:26:29 +01:00
Jamie McCrae
ae2b4a44dc mgmt: mcumgr: grp: img_mgmt: Fix detecting where a slot resides
Fixes an issue introduced in commit
32615695ad which wrongly did not
check what the residing device was on before determining if a
slot was part of a partition area

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-11-25 16:06:23 +00:00
Jukka Rissanen
8046a24104 net: Fix network API calls that were not namespaced
Some of the networking calls were not namespaced so fix it.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-11-21 12:01:31 +01:00
Jamie McCrae
1995b669a1 mgmt: mcumgr: grp: settings_mgmt: Allow saving single setting
Adds functionality that allows saving a single setting to NVM using
the newly added function in the settings subsystem. This also
replaces calling the subtree save function if it the underlying
Kconfig is enabled to reduce code paths in settings mgmt

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-11-19 15:56:49 -05:00
Jamie McCrae
d9c2bdf51a mgmt: mcumgr: grp: os_mgmt: Add memory pool statistics command support
Adds support for the memory pool statistics (mpstat) command, which
will list details on various memory heaps on the device

Signed-off-by: Jamie McCrae <spam@helper3000.net>
2025-11-19 06:54:40 -05:00
Jamie McCrae
2f42addef7 mgmt: mcumgr: grp: img_mgmt: Use common reset function
Replaces the img_mgmt specific function with the common SMP
function for resetting the zcbor buffer and allowing a new response
to be sent

Signed-off-by: Jamie McCrae <spam@helper3000.net>
2025-11-19 06:54:40 -05:00
Jamie McCrae
89b01d5c93 mgmt: mcumgr: transport: Add zcbor buffer reset function
Adds a common zcbor reset buffer function, this allows for the
buffer to be reset after data has been added already to add a
different response, e.g. an error response

Signed-off-by: Jamie McCrae <spam@helper3000.net>
2025-11-19 06:54:40 -05:00
Nicolas Pitre
051623c808 boards: arm: fvp: Add Cortex-A320 board variant support
Add Cortex-A320 support to the unified FVP board structure with ARMv9.2-A
specific configuration parameters.

New board target:
- fvp_base_revc_2xaem/a320

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2025-11-18 17:49:40 -05:00
Nicolas Pitre
2aef4fbe5b arch: arm64: Add ARMv9-A architecture and Cortex-A510 CPU support
Add ARMv9-A architecture support with Cortex-A510 CPU as the default
processor for generic ARMv9-A targets.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2025-11-18 17:49:40 -05:00
Jamie McCrae
2e54630612 mgmt: mcumgr: grp: img_mgmt: Add support for up to 8 images
Adds slot/image information for using up to 8 images on a device

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-11-18 10:46:40 -05:00
Jukka Rissanen
d45cd6716b net: Convert network codebase to use renamed network APIs
Rename network symbols in network stack to use the renamed network APIs.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-11-17 14:01:32 -05:00
Josuah Demangeon
9bd94fab14 style: subsys: apply coding style on CMakeLists.txt files
Apply the CMake style guidelines to CMakeList.txt files in subsys/.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2025-11-17 13:48:03 -05:00
Valerio Setti
f95e815a1a random: rename CSPRNG_AVAILABLE to ENTROPY_NODE_ENABLED
The initial goal of CONFIG_CSPRNG_AVAILABLE was to declare that there was
an entropy node declared in the DT so that if CONFIG_ENTROPY_GENERATOR
was enabled, then the corresponding driver could be enabled.
This works in most of the cases, but not all. A counter example is the
"entropy_bt_hci" driver which is only enabled if CONFIG_BT_HCI_HOST is also
enabled. This means that in a build where the BT stack is not enabled
that driver won't be enabled even if the DT node is still present.

An example of this are the nrf5340[dk|bsim] boards.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2025-11-13 23:12:29 +02:00
Tomasz Chyrowicz
6a4af2486d mcumgr: img_mgmt: Fix minor issues
Fix a few typos inside img_mgmt.c file.

Signed-off-by: Tomasz Chyrowicz <tomasz.chyrowicz@nordicsemi.no>
2025-11-07 19:22:29 +02:00
Stuart Alldritt
8af379516d mgmt: mcumgr: grp: img_mgmt: increment data_off after reading the SHA
Fix a bug where the image's SHA would be interpreted as TLV headers due
to missing a data_off increment.

Signed-off-by: Stuart Alldritt <s.k.alldritt@gmail.com>
2025-11-03 16:59:50 +02:00