Commit graph

846 commits

Author SHA1 Message Date
Robert Lubos
3572c9f825 net: http: client: Allow to abort download from response callback
Update the response callback function signature to allow the callback to
return an error code, which in turn will cause the HTTP client to abort
the download.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-05-23 17:20:24 +02:00
Tom Chang
797779d4c2 mgmt: ec_host_cmd: npcx: remove the SHI enable in the init
This commit removes the SHI enable in the initialization. It can be
enabled by the application explicitly calling it when needed. The SHI
backend relies on the application layer to provide a data buffer for EC
Host Commands. If SHI is enabled before this buffer is initialized,
there is a risk that the driver may access a NULL buffer, leading to a
system panic.

Signed-off-by: Tom Chang <CHChang19@nuvoton.com>
2025-05-22 11:31:47 +02:00
Jamie McCrae
7619592bdd mgmt: mcumgr: grp: img_mgmt: Fix wrong alignment
Fixes a line that was wrongly aligned

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-05-15 14:09:55 +02:00
Jamie McCrae
e249596faf mgmt: mcumgr: grp: img_mgmt: Add support for firmware loader mode
Adds support for using img mgmt in firmware loader mode, to allow
for loading an update image to a device

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-05-15 14:09:55 +02:00
Fin Maaß
a7ee49667d mgmt: hawkbit: add event for confirmed current image during init
add event for confirmed current image during initialization

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-05-09 14:01:08 +02:00
Fin Maaß
c4ff1dbc25 mgmt: hawkbit: Fix cancelAction string handling
Fix off-by-one error in cancelAction string handling.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-05-08 15:55:48 +02:00
Jamie McCrae
a7a3f06f0a mgmt: mcumgr: grp: os_mgmt: Fix Kconfig alignment
Fixes some elements that were indented twice

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-05-07 13:39:20 +02:00
Jamie McCrae
f39091376f mgmt: mcumgr: grp: os_mgmt: Support reboot without multithreading
Adds support for the OS mgmt reboot command when multithreading
is disabled

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-05-07 13:39:20 +02:00
Fin Maaß
029abb4165 mgmt: hawkbit: don't require DNS_RESOLVER
When the supplied server address is already an
ip address, CONFIG_DNS_RESOLVER is not required,
as zsock_getaddrinfo() can resolve literal addresses
without it.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-05-07 13:32:39 +02:00
Fin Maaß
e59451a758 mgmt: hawkbit: also clear in the call of hawkbit_autohandler()
the k_event_clear in the work might be to late sometimes, when
hawkbit_autohandler_wait() is executed directly after
hawkbit_autohandler(). This leads to getting the events
of the former execution and also not waiting until the
current autohandler run is finished.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-05-07 11:44:59 +02:00
Nicolas Goualard
27bfeea162 mcumgr: fs_mgmt: Add a hook on download/upload complete.
Added a hook on the FS group that notify applications when a
 file download/upload has completed.

Signed-off-by: Nicolas Goualard <nicolas.goualard@sfr.fr>
2025-04-24 16:53:35 +02:00
Fin Maaß
89ad446b27 mgmt: hawkbit: deprecate HAWKBIT_DDI_NO_SECURITY
anonymous/no authentication mode had been removed
from the last hawkBit server release, so mention it and
deprecate the option.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-04-23 15:00:05 +02:00
Fin Maaß
1db528fc45 mgmt: hawkbit: add more infos for authentication modes
add more infos for security token authentication modes

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-04-23 15:00:05 +02:00
Julien Racki
6d1cb00627 arch: arm: Add Cortex-A7 support
Pass the correct -mfpu and -mcpu flags to the compiler when building
for the Cortex-A7.

Signed-off-by: Julien Racki <julien.racki@st.com>
2025-04-04 09:35:03 +02:00
Andrzej Puzdrowski
eab304f0db mcumgr/img_mgmt: Allow erase pending image by default
Allows erasing secondary slot which is marked for test or confirmed.
This is safe as bootloader doesn't make any action on boot-setup yet.

Erase of such pending image might considered like the case when it
was never downloaded as well.

This allow user to not stuck with pending irremovable image.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2025-04-01 22:13:20 +02:00
Daniel Mangum
36661dc9d4 mgmt: mcumgr: transport: remove dup LoRaWAN smp_reassembly_init
The LoRaWAN SMP transport uses MCUMGR_TRANSPORT_LORAWAN_REASSEMBLY to
enable reassembly. It selects MCUMGR_TRANSPORT_REASSEMBLY, which causes
smp_transport_init to call smp_reassembly_init on the passed transport.
This makes the subsequent call to smp_reassembly_init in the LoRaWAN
transport initialization redundant.

Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
2025-03-27 09:51:08 +01:00
Kiara Navarro
737133a6df mgmt: ec_host_cmd: remove response leftovers
Remove `res` variable since it was not used in any part of `rx_timeout`
function.

Signed-off-by: Kiara Navarro <knavarro@paltatech.com>
2025-03-07 20:21:02 +01:00
Jordan Yates
2824a28871 mgmt: hawkbit: remove imply HWINFO
`imply` should only be used if the code can still operate without the
symbol, which is not the case. Move the ID source to a choice symbol,
which depends on `HWINFO` when required.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-02-26 10:10:42 +00:00
Nick Brook
d0d3dd476b mgmt/mcumgr: Add error logs for all error cases
Errors were logged for some cases in zephyr_img_mgmt.c, but not all.
This commit adds error logs for all error cases.

Signed-off-by: Nick Brook <nrbrook@gmail.com>
2025-02-19 14:49:37 +00:00
Jamie McCrae
13ac8fe1f5 mgmt: mcumgr: smp: Fix custom payload size
Fixes an issue when using custom payloads where the size was still
using the zcbor buffer instead of the size of the network buffer

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-02-13 16:44:06 +01:00
Jamie McCrae
0e8cc3e52d dfu: Add support for new MCUboot swap using offset mode
Allows using this newly introduced MCUboot algorithm

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-02-10 19:05:25 +01:00
Jamie McCrae
6d35cc5e85 kconfig: Add new Kconfig for MCUboot swap using move
Adds a new Kconfig for selecting swap using move in MCUboot which
aligns with the proper MCUboot symbol and allows for adding
additional mode Kconfigs

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-02-10 19:05:25 +01:00
Jamie McCrae
f3e2e7dc06 mgmt: mcumgr: grp: img_mgmt: Add image number to confirmed callback
Adds the image number to the confirmed callback

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-02-04 11:56:31 +01:00
Marcin Niestroj
a984187c96 mgmt: mcumgr: rework create_socket() to use single sockaddr storage
Allocate only one 'struct sockaddr_storage', instead of two separate
'struct sockaddr_in' and 'struct sockaddr_in6'. This saves some space in
case both IPv4 and IPv6 are used. Additionally it reduced preprocessor
ifdef statements, resulting in more readable code.

This also solves '-Warray-bounds=' GCC warning (reproducible with
'native_sim' and GCC version 14.2.1 on Arch Linux):

  In function ‘create_socket’,
      inlined from ‘smp_udp_receive_thread’ at \
          subsys/mgmt/mcumgr/transport/src/smp_udp.c:242:7:
  subsys/mgmt/mcumgr/transport/src/smp_udp.c:205:37: warning: \
      array subscript ‘struct sockaddr[0]’ is partly outside array \
      bounds of ‘struct sockaddr_in[1]’ [-Warray-bounds=]
    205 |         tmp_sock = zsock_socket(addr->sa_family, SOCK_DGRAM, \
        |                                 ~~~~^~~~~~~~~~~
                                                        IPPROTO_UDP);
  subsys/mgmt/mcumgr/transport/src/smp_udp.c: In function \
      ‘smp_udp_receive_thread’:
  subsys/mgmt/mcumgr/transport/src/smp_udp.c:170:28: note: \
      object ‘addr4’ of size 8
    170 |         struct sockaddr_in addr4;
        |                            ^~~~~

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2025-02-03 19:53:13 +01:00
Jamie McCrae
98d5aa3792 mgmt: mcumgr: grp: img_mgmt: Fix calling confirm
Fixes calling the registered callbacks for image being confirmed
if the confirmation was not successful

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-02-03 11:18:25 +01:00
Jamie McCrae
c562cbc284 mgmt: mcumgr: grp: img_mgmt: Fix unused label warning
Fixes an issue with a warning when compiling for direct xip mode
without revert

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-01-21 11:11:51 +01:00
Andrzej Głąbek
6d9513ef35 mgmt: mcumgr: grp: os_mgmt: Fix compilation warning
This is a follow up to commit 770482a45a.

Add initialization of the `ok` variable to prevent the "may be
uninitialized" warning when `CONFIG_BOOTLOADER_MCUBOOT` is not
defined.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2025-01-20 20:56:52 +01:00
Dawid Niedzwiecki
6f6f8bc931 mgmt: ec_host_cmd: uart: improve error handling
Add an array with the states names and use it while logging an error
messages.

Additionally unify the error message format. Do not add
"UART HOST CMD ERROR", because the LOG_ERR macro already informs that
it is an error message.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2025-01-20 11:27:06 +01:00
Fin Maaß
ca43888f54 mgmt: hawkbit: use flash_img_get_upload_slot()
don't assume, that the slot to upload is the second.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-01-17 09:07:45 +01:00
Dawid Niedzwiecki
4f772ebee9 mgmt: ec_host_cmd: uart: add timeout config
Use a config, instead of hardcode, to set timeout value.

It says how much time UART backend should wait for entire message sent
in chunks.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2025-01-16 22:41:09 +01:00
Fin Maaß
3c88970cec mgmt: hawkbit: add CONFIG_HAWKBIT_SAVE_PROGRESS_INTERVAL
add CONFIG_HAWKBIT_SAVE_PROGRESS_INTERVAL, to
be able to set a interval, how often the progress is saved.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-01-09 14:13:42 +01:00
Fin Maaß
4cd44e7da2 mgmt: hawkbit: resume firmware downloads
save download progress, to resume failed
firmware downloads.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-01-09 14:13:42 +01:00
Jamie McCrae
5871037426 mgmt: mcumgr: grp: os_mgmt: Add error code for invalid responses
Adds a new error code that can be used to signify that a query was
valid but the response was not valid

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-01-03 10:02:23 +01:00
Fin Maaß
b500f4c557 mgmt: hawkbit: use settings_save_subtree()
use settings_save_subtree() instead of settings_save() to
only save the hawkbit settings

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-12-25 03:37:14 +01:00
Fin Maaß
6dce233265 mgmt: hawkbit: use flash_area from flash_ctx
don't assume, that the slot to upload is the second.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-12-23 09:17:14 +01:00
Fin Maaß
49f5bc9698 mgmt: hawkbit: add callbacks for events
add callbacks for events.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-12-23 09:17:14 +01:00
Fin Maaß
a3acb67f62 mgmt: hawkbit: rename close to cancel
rename close to cancel, as it is more fitting.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-12-23 09:17:14 +01:00
Fin Maaß
fb573f5d64 mgmt: hawkbit: allow different tenants
allow the use of other tenants.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-12-23 09:17:14 +01:00
Fin Maaß
41f7ae9488 mgmt: hawkbit: use SMF
use smf for hawkbit.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-12-23 09:17:14 +01:00
Valerio Setti
39068cc70e mbedtls: select ENTROPY_GENERATOR when a driver is available
This is based on the introduction of a helper Kconfig symbol in
"subsys/random/Kconfig" which is named CSPRNG_AVAILABLE. When this is
enabled it means that there is a "zephyr,entropy" property defined in the
device-tree, therefore Mbed TLS can select ENTROPY_GENERATOR to allow
the platform specific driver to be included into the build.

This commit also changes other locations where CSPRNG_ENABLED was used
moving it to CSPRNG_AVAILABLE in order to solve dependency loop
build failures.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-12-19 17:53:37 +01:00
Hongquan Li
bda1e7677e Subsys: mgmt: mcumgr: Fix mcumgr assertion error
In the case of IPV6 not enabled, when NET_SOCKETS_PACKET is enabled,
the sizeof(struct sockarr) will change to 20, the value of
MCUMGR_TRANSPORT_NETBUF_MIN_USER_DATA_SIZE is 8, which is not able
to pass the compilation, so I change its default value to 20.

Fixes #82757

Signed-off-by: Hongquan Li <hongquan.prog@gmail.com>
2024-12-16 13:09:28 +01:00
Bas van Loon
44d855391b mgmt: mcumgr: transport: smp: Fix smp_transport_clients list init.
Make sure smp_transport_clients list is only initialized once and
before any transports will try to register and add entries to this
list.

The smp_init() routine was called after smp_init_uart(), causing
the list to be emptied again after registration of the uart client
transport.

Signed-off-by: Bas van Loon <bas@arch-embedded.com>
2024-12-07 11:02:38 +01:00
Jamie McCrae
d68b54752c mgmt: mcumgr: transport: smp_udp: Use k_thread_join
Replaces code that peeked directly into the thread by instead
calling k_thread_join() to check the state of threads

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-12-06 22:22:32 +01:00
Seppo Takalo
9fa82f0d8d mgmt: smp: Fix race condition by using same work queue
Fix possible race condition where SMP client might
release the network buffer before system worker queue
has processed it.

In smp_client uses shared resources like worker queue
linked list and network buffers without maintaining any
thread safety.

For unknown reasons, retry timeout handling is pushed
into system worker queue while the actual transmission
is handled from SMP work queue.

Fix the issue by using the same SMP work queue
for both delayable timeout handling as well as
transmission handling.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-12-06 18:20:10 +01:00
Dawid Niedzwiecki
e9163992cf mgmt: ec_host_cmd: add support for nocache buffers
Some backends use DMA. Usually, DMA doesn't work correctly, when memory
to transfer is cached. Add a config to place the common buffers in the
nocache section.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2024-12-04 16:11:54 +01:00
Dawid Niedzwiecki
d7df7cdba6 mgmt: ec_host_cmd: stm32_spi: fix rx reload for STM32H7 chips
Disable and enable SPI module before every transaction for STM32H7
chips. It is a recommended way in the STM32 RM. In another case, a first
byte of a transaction is always 0x00.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2024-12-04 16:11:54 +01:00
Dawid Niedzwiecki
6294c389ca mgmt: ec_host_cmd: stm32_spi: handle underrun for stm32h7 chips
STM32H7 chips have additional configuration regarding underrun event.
Configure the underrun behaviour correctly to use the underrun pattern
and clear the underrun bit before sending new data.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2024-12-04 16:11:54 +01:00
Dawid Niedzwiecki
21c12786ec mgmt: ec_host_cmd: stm32_spi: fix cs interrupt configuration
Move enabling CS interrupt at the end of the backend configuration,
when everything is ready.

It prevents handling the interrupt, when something is not prepared e.g.
DMA is not configured.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2024-12-04 16:11:54 +01:00
Dawid Niedzwiecki
c7bebc669f mgmt: ec_host_cmd: stm32_spi: fix clock domain support
Fix support for clock domains. Create define that identify if
clock domain was selected in any of the st_stm32_spi_host_cmd nodes.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2024-12-04 16:11:54 +01:00
Dawid Niedzwiecki
5d5c4c1d2f mgmt: ec_host_cmd: add support for all dma versions
Update macro used to get fifo threshold from DTS, to support all
STM32 DMA versions.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2024-12-04 16:11:54 +01:00