No longer needed, since smp_streamer has smpt pointer to
zephyr_smp_transport, it can directly call smpt->zst_output.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
There are no more functions directly using the type, so it
has been removed and its contents have been moved to
smp_streamer.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit removes declaration of functions
mgmt_streamer_trim_front and mgmt_streamer_init_reader
as they no longer have definitions.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit drops empty parameter from img_mgmt_flash_check_empty
and img_mgmt_flash_check_empty_inner and uses the return code
instead.
Both functions now use negative errno codes instead of MGMT_ERR_
type codes.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
This adds a hash check when the CONFIG_IMG_ENABLE_IMAGE_CHECK Kconfig
option is enabled that will check the underlying image hash to see if
it is the same as the one provided by the mcumgr client, and if so,
will prevent erasure/uploading the same image data.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
This adds the dummy shell buffer size to the shell_mgmt
configuration to allow ease of changing it.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
The img_mgmt_erase could return MGMT_ERR_EOK even when
img_mgmt_impl_erase_slot failed.
Fixes#50522
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Fixes an issue with img_mgmt whereby the if check for a slot3
partition is using the wrong case for the partition name.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Moves a .h file added outside of the zephyr include folder to be
within the zephyr include folder.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
This header provides original BOOT_MAX_ALIGN definition.
This definition is used indirectly by the code this
patch modifies.
Let's use it instead of copy from mcuboot.h
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
The options should enable verbose responses in error responses
to SMP command processing, but has been broen when the code
has been ported to zcbor.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
If the is no update from the server, the _links will be NULL.
Check if it is NULL before trying to LOG these strings.
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
There are warnings when building fs_mgmt with hash/checksum
functionality enabled due to array access and a wrong variable type
being used.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
zcbor supports native zcbor_size_ functions for some time now,
so there is no need to have local zcbor_size_ definitions.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Fixes an issue with outgoing mcumgr frames that are larger than the
transport MTU size whereby they would wrongly be split up into multiple
frames with multiple start frame headers, which affected SMP over
console transports.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
The lib/transport directory has been moved up, directly under the
subsys/mgmt/mcumgr, and all transport files have been moved to
that directory.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Fixes an issue introduced when the mcumgr code was simplified whereby
the newer compressed free function call wrongly passes a pointer to a
pointer instead of the pointer itself.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Fixes an issue with the connection reference not being decremented
at the end of the outgoing notification function resulting in an
ever-increasing connection count.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
The static function img_mgmt_flash_check_empty is only used if
CONFIG_IMG_ERASE_PROGRESSIVELY isn't set.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
This adds a dummy SMP backend which can be used for unit testing or
virtual interface purposes.
Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
Adds the runtime tick count of threads to mcumgr's taskstat response,
if CONFIG_SCHED_THREAD_USAGE is enabled, which reports the number of
execution cycles that each thread has been running for.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Fixes an issue with Bluetooth notification sending whereby it does
not wait for buffers to become available and can error out if
unable to get a buffer once.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Fixes an issues where the system work queue can become a source of
contention and cause a deadlock by moving MCUMGR SMP processing to its
own dedicated work queue.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
The Kconfig for MCUMgr management source code (service registration,
group registration, and so on) has been moved to the sub-dir with
the code.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
By default, thread priorities in mcumgr task stat responses are
unsigned, whilst in zephyr, thread priorities are signed. This means
that clients get obscenely large numbers for priorities that make no
sense. The fork of mcumgr has been in zephyr long enough now that
this should be changed to use signed thread priorities by default
instead of sticking with the old mcumgr default.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
The commit removes declarations of:
zephyr_smp_rx_req, zephyr_smp_alloc_rsp, zephyr_smp_free_buf
from include/zephyr/mgmt/mcumgr/smp.h, as these are MCUMgr internal
functions used in SMP processing and should be not exposed
from header file that provides interface for SMP transports.
The declarations have been moved to smp_internal.h, which is
visible within MCUMgr.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Use c99 format specifier macros to remove build warnings when building
for `native_posix[_64]`.
Signed-off-by: Marc Lasch <marc.lasch@husqvarnagroup.com>
The commit switches flash area access from FLASH_AREA_ macros
to FIXED_PARTITION_ macros and to usage of DTS node labels,
to identify partitions, instead of label property.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit switches flash area access from FLASH_AREA_ macros
to FIXED_PARTITION_ macros and to usage of DTS node labels,
to identify partitions, instead of label property.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The conditional block linking mbedTLS for checksum calculation
in FS commands have been moved to CMakeLists.txt responsible
for compiling these commands.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>.
This patch proposes to then include <zephyr/kernel.h> instead of
<zephyr/zephyr.h> since it is more clear that you are including the
Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a
catch-all header that may be confusing. Most applications need to
include a bunch of other things to compile, e.g. driver headers or
subsystem headers like BT, logging, etc.
The idea of a catch-all header in Zephyr is probably not feasible
anyway. Reason is that Zephyr is not a library, like it could be for
example `libpython`. Zephyr provides many utilities nowadays: a kernel,
drivers, subsystems, etc and things will likely grow. A catch-all header
would be massive, difficult to keep up-to-date. It is also likely that
an application will only build a small subset. Note that subsystem-level
headers may use a catch-all approach to make things easier, though.
NOTE: This patch is **NOT** removing the header, just removing its usage
in-tree. I'd advocate for its deprecation (add a #warning on it), but I
understand many people will have concerns.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Fix include order to avoid redefinition of `ARRAY_SIZE`, because
`sys/util.h` and `zcbor_common.h` both define it, but `sys/util.h` does
not protect against redefinition.
Signed-off-by: Fabio Utzig <utzig@tumenibits.com>
Allows selecting which slot will be erased, will default back to
slot 1 as it would do in previous versions if the optional parameter
is not provided
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
This prevents the shell command response code conflicting with the
mcumgr response code, which are 2 distinct variable types
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Fixes a race condition when listing task status using mcumgr whereby
if a thread status changes, it could cause unpredictable output for
the command.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Reduces the level of indirection for functions by calling the zephyr
functions directly as support for multiple operating systems is no
longer required with mcumgr being forked and placed into the zephyr
tree. Saves 60 bytes flash when compiling smp_svr on an ARM Cortex
M4 board.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Switches to using Zephyr's single linked list implementation for
group management objects instead of duplicating functionality for
mcumgr only.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Resolves an issue with processors that do not support unaligned memory
access when using img_mgmt functions, e.g. ARM Cortex M0, by marking
structures as packed.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Many device pointers are initialized at compile and never changed. This
means that the device pointer can be constified (immutable).
Automated using:
```
perl -i -pe 's/const struct device \*(?!const)(.*)= DEVICE/const struct
device *const $1= DEVICE/g' **/*.c
```
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>