Commit graph

87 commits

Author SHA1 Message Date
Jamie McCrae
d6758557f5 tests: mgmt: mcumgr: os_mgmt_info: Check grouped events
Changes one of the callback register/unregister functions to use
2 events OR'd together instead of 2 events registered separately,
this is to help test that grouped events are working.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-01-09 17:36:04 -08:00
Dominik Ermel
db34adf9c3 mgmt/mcumgr: Standardise MCUmgr Kconfig names
Standardise Kconfig options for MCUmgr.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-12-22 12:36:34 +01:00
Jamie McCrae
d7557102c0 mgmt: mcumgr: Add iterable section to register MCUmgr handlers
This replaces the requirement for applications to manually
register MCUmgr handlers by having an iterable section which
then automatically registers the handlers at boot time.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2022-12-22 11:03:04 +01:00
Dominik Ermel
fc7b5a551f tests/mgmt/mcumgr/zcbor_bulk: Use ZCBOR_MAP_DECODE_KEY_DECODER
Replaces ZCBOR_MAP_DECODE_KEY_VAL with ZCBOR_MAP_DECODE_KEY_DECODER
in test and adds equivalency test between
ZCBOR_MAP_DECODE_KEY_VAL and ZCBOR_MAP_DECODE_KEY_DECODER.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-12-13 11:42:02 +01:00
Dominik Ermel
6effadd773 tests/mcumgr/zcbor_bulk: Add additional test platforms
ARM plaftorms added.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-12-12 15:01:11 +01:00
Dominik Ermel
0fdae69f25 tests/mcumgr/zcbor_bulk: Add test for map in map decoding
The zcbor_map_decode_bulk is able to decode embedded CBOR types
like maps in maps, but this has been missing proper tests.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-12-12 15:01:11 +01:00
Jamie McCrae
43b4350744 tests: mgmt: mcumgr: os_mgmt_info: Add tests
Adds tests for the os_mgmt info command.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2022-12-07 13:53:02 +00:00
Dominik Ermel
424185e715 tests/mgmt/mcumgr/smp_reassembly: Correct zassert messages
Two simple fixes in zassert messages where one message has
been printing incorrect variable and other has been using
formatting to just print literal 0.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-12-05 17:24:08 +01:00
Jamie McCrae
36b179c43b tests: subsys: mgmt: mcumgr: Add all options test
Adds a test which enables all Kconfig options for MCUmgr (that are
not deprecated and can be supported on the nrf52840dk board) to
ensure that if a breaking change is introduced in CI then it can
be caught.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2022-11-23 12:24:59 +01:00
Michał Barnaś
b91849c4bd ec_host_cmd: add missing fields and improve compatibility
Add missing fields in structure containing the arguments used by
the host commands handlers and change the order of parameters
in macro used for defining the handlers.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-11-18 10:11:40 +01:00
Michał Barnaś
369596dc95 ec_host_cmd: increase stack size, change thread priority and alignment
This commit increases the stack size for thread handling the host
commands requests. It was required due to the stack being
corrupted using earlier default size. The thread priority is now
configurable using the Kconfig.
It also adds alignment to the tx_buffer since the npcx MCU requires it
to work correctly and removes clearing the buffer before use due to
the hard time requirements. Tests checking if buffers are cleared
are also removed.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-11-18 10:11:40 +01:00
Dominik Ermel
b3833cf2bc tests/mgmt/mcumgr: Apply rework in MCUMgr subsystem
Code changes required by rework in MCUMgr souce code structure.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-11-17 15:31:17 +01:00
Dominik Ermel
4328f165a8 mgmt/mcumgr: Reworking source code tree and API interface
The commit reworks mgmt/mcumgr subsystem source code to remove
lib subdirectory and make it a little bit more flat.
It also moves all API interface files, which are supposed to be
visible by applications using MCUMgr, to interface sub-directories,
and exposes them with full paths; for example to include general
MCUMgr support, group registration and so on, user would now include:
 <mgmt/mcumgr/mgmt/mgmt.h>
to additionally have control on File System group management
registration user would need:
 <mgmt/mcumgr/mgmt/grp/fs_mgmt.h>

All internal headers have been removed from interface.

CMAkeLists.txt get significant rework and various MCUMgr subsystems
have been divided into separate sub-libraries.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-11-17 15:31:17 +01:00
Dominik Ermel
7c2924f4bc mgmt/mcumgr: Move transport headers to transport subdir
The MCUmgr transport headers have been moved to
zephyr/mgmt/mcumgr/transport/

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-11-17 15:31:17 +01:00
Anas Nashif
61b56cae44 tests: mgmt: fix tags and identifiers
Fix tags and identifiers for all mgmt subsys tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-11-15 05:32:28 -05:00
Jamie McCrae
379d23001f tests: mgmt: mcumgr: Add fs_mgmt_hash_supported test
Adds a test which checks that the fs_mgmt supported hash/checksum
functionality is working and returns the expected response.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2022-11-10 11:10:03 +01:00
Dominik Ermel
542b1f86ba tests/mgmt/mcumgr/smp_reassembly: Rename mgmt_hdr to smp_hdr
SMP reassembly is the only non-protocol code in MCUmgr that
directly accesses SMP header; this tests has been accessing
mgmt_hdr structure and now it is named smp_hdr and visible
via smp_internal.h.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-11-03 13:04:45 +01:00
Dominik Ermel
9331591ab1 mgmt/mcumgr: Remove buf.c
buf.c have been providing net_buf pool allocator and dealocator
for SMP packets: mcumgr_buf_alloc and mcumgr_buf_free.
The functions have been moved to smp.c and renamed
smp_packet_alloc and smp_packet_free, respectively.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-10-26 12:42:40 +02:00
Dominik Ermel
12b1528df9 mgmt/mcumgr: Remove mgmt/mcumgr/buf.h
SMP buffer allocation functions have been moved to smp/smp.h,
and buf.h has been removed.
Definitions of cbor_nb_reader and cbor_nb_writer have also been moved.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-10-26 12:42:40 +02:00
Dominik Ermel
77fc3563ae tests/mgmt/mcumgr/smp_reassembly: Drop zephyr_ prefix
The mcumgr transport API drops zephyr_ prefixes.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-10-18 12:05:42 +02:00
Jamie McCrae
50738819f4 mgmt: mcumgr: Move wrongly placed header file
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>
2022-09-20 15:01:47 +02:00
Dominik Ermel
c45dbb01eb tests/subsys/mgmt/mcumgr: Move tests
Move smp_reassembly and zcbor_bulk tests under
tests/subsys/mgmt/mcumgr.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-09-12 14:15:06 +00:00
Jamie McCrae
d834768da7 tests: mgmt: mcumgr: os_mgmt_echo: Add mcumgr echo test
Adds a simple mcumgr test which checks that the os_mgmt echo commmand
works and responds with the correct data.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2022-09-08 15:29:21 +00:00
Fabio Baltieri
def230187b test: fix more legacy #include paths
Add a bunch of missing "zephyr/" prefixes to #include statements in
various test and test framework files.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-02 16:41:41 +01:00
Tomislav Milkovic
0fe2c1fe90 everywhere: Fix legacy include paths
Any project with Kconfig option CONFIG_LEGACY_INCLUDE_PATH set to n
couldn't be built because some files were missing zephyr/ prefix in
includes
Re-run the migrate_includes.py script to fix all legacy include paths

Signed-off-by: Tomislav Milkovic <milkovic@byte-lab.com>
2022-07-18 16:16:47 +00:00
Keith Packard
fb1d092955 tests: ec_host_cmd: Make sure expected_dut_to_host fits in buffer
If struct tx_structure is too large than the buffer that
expected_dut_to_host references, leading the compiler to generate a warning
about the possibility of buffer overflow.

Leave out the 'struct ec_response_too_big' so that 'struct tx_structure'
fits within the 256 byte buffer.

This was caught when using GCC 11.3.0 building the test for native_posix.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-07-04 16:11:51 +02:00
Øyvind Rønningstad
c1a9866c86 west.yml: Update zcbor to v. 0.5.1
lwm2m: Regenerate lwm2m_senml code from the CDDL description.
Reapply manual changes.
Create a sh script to perform the regeneration.

tests: zcbor_bulk: Adapt to zcbor 0.5.1
zcbor_new_decode_state() now has no return value.

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2022-07-04 15:13:42 +02:00
Yinfang Wang
aa9c466d70 tests: subsys: mgmt: move zcbor_bulk to new ztest API
Move test zcbor_bulk to use new ztest API.

Signed-off-by: Yinfang Wang <yinfang.wang@intel.com>
2022-07-01 11:37:41 +02:00
Yinfang Wang
9c088a814f tests: subsys: mgmt: move smp_reassembly to new ztest API
Move test smp_reassembly to use new ztest API.

Signed-off-by: Yinfang Wang <yinfang.wang@intel.com>
2022-07-01 11:37:41 +02:00
Yinfang Wang
08dadc3c30 tests: subsys: mgmt: move ec_host_cmd to new ztest API
Move test ec_host_cmd to use new ztest API.

Signed-off-by: Yinfang Wang <yinfang.wang@intel.com>
2022-07-01 11:37:41 +02:00
Dominik Ermel
40b8041dd5 tests/subsys/mgmt/mcumgr: Add unit tests for zcbor_bulk
The commit adds unit tests for zcbor_bulk utility function,
which has been provided to internally support zcbor in decoding
maps with command parameters.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-06-21 11:46:45 +02:00
Gerard Marull-Paretas
ade7ccb918 tests: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all tests to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 20:02:14 +02:00
Dominik Ermel
da6a5590e8 tests/mgmt/mcumgr/smp_reassembly: Remove dependency on TINYCBOR
Removed dependency from prj.conf.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-04-11 12:09:28 +02:00
Dominik Ermel
a99118d140 tests/mgmt/mcumgr/smp_reassembly: Unit tests for re-assembly
The commit adds unit tests for SMP packet re-assembly.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-03-21 18:03:18 +01:00
Torsten Rasmussen
1cccc8a8fe cmake: increase minimal required version to 3.20.0
Move to CMake 3.20.0.

At the Toolchain WG it was decided to move to CMake 3.20.0.

The main reason for increasing CMake version is better toolchain
support.

Better toolchain support is added in the following CMake versions:
- armclang, CMake 3.15
- Intel oneAPI, CMake 3.20
- IAR, CMake 3.15 and 3.20

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-08-20 09:47:34 +02:00
Kumar Gala
043891e1ea include: Move ec_host_cmd.h to mgmt/ec_host_cmd.h
Move ec_host_cmd.h out of the top level include/ dir into
include/mgmt/ec_host_cmd.h and deprecated the old location.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-04-22 12:51:16 -04:00
Jett Rink
1972f0b7f4 ec_host_cmd: add ec host command handler framework
Add a generic host command handler framework that allows users to
declare new host command handlers with the HOST_COMMAND_HANDLER macro
at build time. The framework will handle incoming messages from the
host command peripheral device and forwards the incoming data to the
appropriate host command handler, which is looked up by id.

The framework will also send the response from the handler back to the
host command peripheral device. The device handles sending the data on
the physical bus.

This type of host command communication is typically done on an embedded
controller for a notebook or computer. The host would be the main
application processor (aka AP, CPU, SoC).

Signed-off-by: Jett Rink <jettrink@google.com>
2020-09-04 14:50:45 -04:00