Commit graph

808 commits

Author SHA1 Message Date
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
Dawid Niedzwiecki
7e5b0d7c3f mgmt: ec_host_cmd: stm32_spi: fix clang-format
Use clang-format for the ec_host_cmd_backend_spi_stm32.c file.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2024-12-04 16:11:54 +01:00
Jamie McCrae
5437ded36c mgmt: mcumgr: grp: img_mgmt: Fix misplaced #endif
Fixes a misplaced endif which wrongly excluded functions

Signed-off-by: Jamie McCrae <spam@helper3000.net>
2024-11-28 09:38:49 +01:00
Andy Ross
7cdf40541b kernel/sched: Eliminate PRESTART thread state
Traditionally threads have been initialized with a PRESTART flag set,
which gets cleared when the thread runs for the first time via either
its timeout or the k_thread_start() API.

But if you think about it, this is no different, semantically, than
SUSPENDED: the thread is prevented from running until the flag is
cleared.

So unify the two.  Start threads in the SUSPENDED state, point
everyone looking at the PRESTART bit to the SUSPENDED flag, and make
k_thread_start() be a synonym for k_thread_resume().

There is some mild code size savings from the eliminated duplication,
but the real win here is that we make space in the thread flags byte,
which had run out.

Signed-off-by: Andy Ross <andyross@google.com>
2024-11-27 10:38:05 -05:00
Dino Li
40c95e34b8 it8xxx2/shi: wrap pm policy state get/put
When CONFIG_ASSERT is enabled, assertion for unbalanced state lock
get/put is triggered. This commit leverages shi drivers from other
SoCs to resolve the assertion.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2024-11-25 10:07:20 +01:00
Fin Maaß
ef9cc18fcf mgmt: hawkbit: don't require HWINFO
don't require HWINFO, when HAWKBIT_CUSTOM_DEVICE_ID.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-11-22 13:02:29 -06:00
Jamie McCrae
a6cca606db mgmt: mcumgr: transport: smp_lorawan: Update downlink function
Updates the function to account for a change in the arguments

Signed-off-by: Jamie McCrae <spam@helper3000.net>
2024-11-17 17:15:10 -05:00
Zak Portnoy
32b1140066 mgmt: smp: shell: Respond on uart shell device when changed at runtime
Responses are currently set to the shell device that was configured
in the device tree.

The shell_uart driver allows for changing it's device during runtime
which leads to a situation where we recieve packets on one device
and respond on another.

This patch causes smp_shell_tx_raw to use the shell_uart device

Signed-off-by: Zak Portnoy <zakportnoy@gmail.com>
2024-11-08 13:57:09 -06:00
Jun Lin
69e85b25fe board: npcx: remove CONFIG_PINCTRL from defconfig of npcx boards
The CONFIG_PINCTRL is removed from the board's defconfig files.
Drivers which use pin control function should add "select PINCTRL"
in their Kconfig files.

Fixes #78619

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2024-11-07 08:59:14 -08:00
Gerson Fernando Budke
b46e176704 mgmt: mcumgr: stat: Fix stat_mgmt_list behavior
The MCUmgr statistics only work correctly when selecting
MCUMGR_SMP_LEGACY_RC_BEHAVIOUR option. Checks the option
flag on the stat_mgmt_list and fix the behavior.

Fixes: 80476

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2024-10-30 08:55:23 -05:00
Jamie McCrae
973ba91487 mgmt: mcumgr: transport: Add LoRaWAN MCUmgr SMP transport
Adds a transport that uses LoRaWAN for receiving and responding
to messages

Signed-off-by: Jamie McCrae <spam@helper3000.net>
2024-10-25 14:00:48 +02:00
Jamie McCrae
7609a17dc3 mgmt: mcumgr: grp: zephyr_basic: Add missing FLASH_MAP dependency
Adds a missing dependency, this command requires it to erase the
storage area

Signed-off-by: Jamie McCrae <spam@helper3000.net>
2024-10-24 05:43:42 +01:00
Tim Lin
7fa962589f ITE: it8xxx2: Remove CONFIG_PINCTRL from soc defconfig file
The driver Kconfig determines whether pinctrl is enabled
instead of soc defconfig.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2024-10-15 13:52:55 +02:00
Jamie McCrae
646f116cca mcuboot: Add support for RAM load mode
Adds supporting code that allows the RAM load mode of MCUboot to
be used and for applications to build successfully with it.
Sysbuild can be used to build images for this mode

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-10-11 13:19:39 -04:00
Fin Maaß
d28c0cf08c mgmt: hawkbit: move HAWKBIT_JSON_URL
move HAWKBIT_JSON_URL out of the header.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-10-09 18:10:30 +01:00
Fin Maaß
94bad9d9ac mgmt: hawkbit: seperate header files
seperate the hawkbit header files, to make
it clearer.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-10-09 18:10:30 +01:00
Fin Maaß
dce3d2de66 mgmt: hawkbit: seperate autohandler
seperate the autohandler from the main
hawkbit source. This way the autohandler can
be disabled if it is not needed.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-10-09 18:10:30 +01:00
Fin Maaß
621cf5baec mgmt: hawkbit: get poll interval
Add function to get the poll interval.
This is needed to seperate the autohandler
from the main hawkbit code.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-10-09 18:10:30 +01:00
Fin Maaß
421ab502e4 mgmt: hawkbit: delay autohandler
Be able to delay the next run of
the hawkbit autohandler.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-10-09 18:10:30 +01:00
Fin Maaß
f5a3d7dd8f mgmt: hawkbit: log start of autohandler from shell
If the run of the autohandler is started from shell,
it will be logged.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-10-09 18:10:30 +01:00
Fin Maaß
4655ef317e mgmt: hawkbit: also use workqueue for shell run
Also use a workqueue, when execution of
hawkBit is requested via shell.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-10-09 18:10:30 +01:00
Fin Maaß
6cc2bb53b4 mgmt: hawkbit: add hawkbit_autohandler_wait
Add hawkbit_autohandler_wait() to be able
to wait for the autohandler to finish.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-10-09 18:10:30 +01:00
Fin Maaß
cf5f6aad23 mgmt: hawkbit: add option for autohandler
add option for autohandler to only run once.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-10-09 18:10:30 +01:00
Fin Maaß
35d05b7198 mgmt: hawkbit: use K_WORK_DELAYABLE_DEFINE
staticly init hawkbit_work_handle

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-10-09 18:10:30 +01:00
Krzysztof Sychla
5d76b563ea arch: Add Cortex-R8 support
Enable Cortex R8 support, similar to Cortex-R5.

Signed-off-by: Krzysztof Sychla <ksychla@antmicro.com>
Signed-off-by: Marek Slowinski <mslowinski@antmicro.com>
Signed-off-by: Piotr Zierhoffer <pzierhoffer@antmicro.com>
Signed-off-by: Mateusz Hołenko <mholenko@antmicro.com>
2024-10-01 09:58:22 +02:00
Jamie McCrae
9c821eb999 mgmt: mcumgr: grp: img_mgmt: Add slot info command
Adds a new command that will return information on slots
themselves, listing the slot sizes, without any internal
information about the slot data. Will also return the maximum size
of an image for a set of slots if built using sysbuild.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-09-26 17:48:05 -04:00
Jamie McCrae
770482a45a mgmt: mcumgr: grp: os_mgmt: Fix issues raised in comments
Fixes an issue with structure which was previously raised in a
comment, and adds a new bool to the structure to enable this
restructure to work

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-09-26 17:42:01 -04:00
Mateusz Kapala
77555898de mgmt: mcumgr: Add SMP SVC and CHR UUIDs to header
Added the SMP service and characteristic UUIDs to the smp_bt module
header and used those definitions.

Signed-off-by: Mateusz Kapala <mateusz.kapala@nordicsemi.no>
2024-09-23 18:10:49 -04:00
Jamie McCrae
ddad1e6fb0 mgmt: mcumgr: grp: os_mgmt: Fix invalid return
Fixes wrongly returning an SMP version 2 error code as an SMP
version 1 error code instead of adding it as an error

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-09-23 14:08:03 +01:00
Jamie McCrae
c6c00e13b8 mgmt: mcumgr: grp: os_mgmt: Allow bootloader info without MCUboot
Allows enabling the bootloader info functionality without MCUboot
being enabled, so that other bootloaders can add hooks with their
own responses

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-09-23 14:08:03 +01:00
Pisit Sawangvonganan
af4527e131 style: subsys: adjust return usage in void functions
For code clarity, this commit adjusts the use of `return` statements
in functions with a void return type as follows:
- Transform `return foo();` into separate statements:
  `foo();`
  `return;`
- Remove unnecessary `return` statements when
  they don't affect control flow.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-09-20 11:06:55 +02:00
Kamil Piszczek
8c0bc54ab0 mgmt: mcumgr: transport: bluetooth: add all gatt permission levels
Added new Kconfigs for defining permission level of GATT
characteristics that are part of the Bluetooth SMP service in the
MCUmgr subsys.

Removed the CONFIG_MCUMGR_TRANSPORT_BT_AUTHEN as the new Kconfig
options are mutually exclusive and need to be groupa as the Kconfig
choice option.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2024-09-19 15:13:19 +02:00
Jamie McCrae
87a18400dd mgmt: mcumgr: grp: os_mgmt: Add optional bootloader info hook
Adds an optional hook that allows for appending additional
responses to the bootloader info command

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-09-17 17:45:04 +01:00
Tom Chang
0726198776 mgmt: ec_host_cmd: npcx: workaround for backend SHI
There is an issue on the SHI hardware peripheral to detect CS
rising/failing with bits CSnFE/CSnRE in the EVSTAT2 register in
npcx9m7fb chip. This commit workarounds it by using MIWU to detect the
CS rising and failing.

Signed-off-by: Tom Chang <CHChang19@nuvoton.com>
Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2024-09-13 09:17:23 +02:00
Henrik Brix Andersen
159f7dbbb1 lib: net_buf: rename header file from zephyr/net/buf.h to zephyr/net_buf.h
Move the network buffer header file from zephyr/net/buf.h to
zephyr/net_buf.h as the implementation now lives outside of the networking
subsystem.

Add (deprecated) zephyr/net/buf.h header to maintain compatibility with old
file path.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2024-09-07 11:19:05 -05:00
Jordan Yates
652839aee0 mgmt: mcumgr: os_mgmt: fix millisecond return
Ensure that leading zeros are present in the milliseconds field,
otherwise a milliseconds count of 35 will appear as x.35, i.e. 350
milliseconds. With this fix, it will appear as x.035.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-09-04 07:22:05 -04:00
Erwan Gouriou
d13f9d9b9b drivers: stm32: Select PINCTRL when required
Select PINCTRL subsystem by drivers which require it.
Prevent the need from enabling this symbol at board or soc level.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2024-09-03 14:40:55 +01:00
Jamie McCrae
e577b140c3 mgmt: mcumgr: grp: Add names to groups when Kconfig is enabled
Adds string names to the groups in MCUmgr when the enum mgmt
Kconfig is enabled to support listing names of groups

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-08-26 17:05:27 +02:00
Jamie McCrae
fc40e836d1 mgmt: mcumgr: grp: Add enumeration management group
Adds a new MCUmgr group which allows for listing which groups are
supported by the MCUmgr server by remote devices.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-08-26 17:05:27 +02:00