mgmt: Move mcumgr into its own folder

In order to be able to add more entries under 'subsys/mgmt', move the
current contents of it, which relate exclusively to MCUMgr, to its own
folder.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This commit is contained in:
Carles Cufi 2020-07-30 18:01:18 +02:00 committed by Maureen Helm
parent 209084e745
commit c200b1c5e6
25 changed files with 206 additions and 194 deletions

View file

@ -461,8 +461,8 @@
/subsys/fs/nvs/ @Laczen
/subsys/logging/ @nordic-krch
/subsys/logging/log_backend_net.c @nordic-krch @jukkar
/subsys/mgmt/ @carlescufi @nvlsianpu
/subsys/mgmt/smp_udp.c @aunsbjerg
/subsys/mgmt/mcumgr/ @carlescufi @nvlsianpu
/subsys/mgmt/mcumgr/smp_udp.c @aunsbjerg
/subsys/net/buf.c @jukkar @jhedberg @tbursztyka @pfalcon
/subsys/net/ip/ @jukkar @tbursztyka @pfalcon
/subsys/net/lib/ @jukkar @tbursztyka @pfalcon

View file

@ -841,9 +841,9 @@ MCU Manager:
maintainers:
- de-nordic
files:
- subsys/mgmt/
- include/mgmt/
- samples/subsys/mgmt/
- subsys/mgmt/mcumgr/
- include/mgmt/mcumgr/
- samples/subsys/mgmt/mcumgr/
labels:
- "area: mcumgr"

View file

@ -13,7 +13,7 @@
#include <string.h>
#include <kernel.h>
#include <drivers/uart.h>
#include <mgmt/serial.h>
#include <mgmt/mcumgr/serial.h>
#include <drivers/console/uart_mcumgr.h>
static struct device *uart_mcumgr_dev;

View file

@ -11,7 +11,7 @@
#include <sys/ring_buffer.h>
#include <sys/atomic.h>
#ifdef CONFIG_MCUMGR_SMP_SHELL
#include "mgmt/smp_shell.h"
#include "mgmt/mcumgr/smp_shell.h"
#endif
#ifdef __cplusplus

View file

@ -8,7 +8,7 @@
#include <bluetooth/bluetooth.h>
#include <bluetooth/conn.h>
#include <bluetooth/gatt.h>
#include <mgmt/smp_bt.h>
#include <mgmt/mcumgr/smp_bt.h>
#define LOG_LEVEL LOG_LEVEL_DBG
#include <logging/log.h>

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
#include <mgmt/smp_udp.h>
#include <mgmt/mcumgr/smp_udp.h>
#include <net/net_mgmt.h>
#include <net/net_event.h>
#include <net/net_conn_mgr.h>

View file

@ -8,7 +8,7 @@ add_subdirectory_ifdef(CONFIG_SHELL shell)
add_subdirectory_ifdef(CONFIG_CPLUSPLUS cpp)
add_subdirectory_ifdef(CONFIG_DISK_ACCESS disk)
add_subdirectory(fs)
add_subdirectory_ifdef(CONFIG_MCUMGR mgmt)
add_subdirectory(mgmt)
add_subdirectory_ifdef(CONFIG_MCUBOOT_IMG_MANAGER dfu)
add_subdirectory_ifdef(CONFIG_NET_BUF net)
add_subdirectory_ifdef(CONFIG_USB usb)

View file

@ -1,14 +1,3 @@
# SPDX-License-Identifier: Apache-2.0
zephyr_library()
zephyr_library_sources(buf.c)
zephyr_library_sources(smp.c)
zephyr_library_sources_ifdef(CONFIG_MCUMGR_SMP_BT smp_bt.c)
zephyr_library_sources_ifdef(CONFIG_MCUMGR_SMP_SHELL smp_shell.c)
zephyr_library_sources_ifdef(CONFIG_MCUMGR_SMP_UART smp_uart.c)
zephyr_library_sources_ifdef(CONFIG_MCUMGR_SMP_UDP smp_udp.c)
zephyr_library_link_libraries(MCUMGR)
if (CONFIG_MCUMGR_SMP_SHELL OR CONFIG_MCUMGR_SMP_UART)
zephyr_library_sources(serial_util.c)
endif ()
add_subdirectory_ifdef(CONFIG_MCUMGR mcumgr)

View file

@ -1,160 +1,9 @@
# mcumgr configuration options
# Management configuration options
# Copyright Runtime.io 2018. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
menu "Management"
menu "Management subsystems"
config MCUMGR_SMP_BT
bool "Bluetooth mcumgr SMP transport"
select MCUMGR
select BT
select BT_PERIPHERAL
select BT_GATT_DYNAMIC_DB
help
Enables handling of SMP commands received over Bluetooth.
source "subsys/mgmt/mcumgr/Kconfig"
config MCUMGR_SMP_BT_AUTHEN
bool "Authenticated requirement for Bluetooth mcumgr SMP transport"
depends on MCUMGR_SMP_BT
select BT_SMP
default y
help
Enables encrypted and authenticated connection requirement to
Bluetooth SMP transport.
config MCUMGR_SMP_SHELL
bool "Shell mcumgr SMP transport"
select MCUMGR
select SHELL
select SHELL_BACKEND_SERIAL
select BASE64
help
Enables handling of SMP commands received over shell. This allows
the shell to be use for both mcumgr commands and shell commands.
config MCUMGR_SMP_SHELL_MTU
int "Shell SMP MTU"
default 256
depends on MCUMGR_SMP_SHELL
help
Maximum size of SMP frames sent and received over shell. This value
must satisfy the following relation:
MCUMGR_SMP_SHELL_MTU <= MCUMGR_BUF_SIZE + 2
config MCUMGR_SMP_UART
bool "UART mcumgr SMP transport"
select MCUMGR
select UART_MCUMGR
select BASE64
help
Enables handling of SMP commands received over UART. This is a
lightweight alternative to MCUMGR_SMP_SHELL. It allows mcumgr
commands to be received over UART without requiring an additional
thread.
config MCUMGR_SMP_UART_MTU
int "UART SMP MTU"
default 256
depends on MCUMGR_SMP_UART
help
Maximum size of SMP frames sent and received over UART, in bytes.
This value must satisfy the following relation:
MCUMGR_SMP_UART_MTU <= MCUMGR_BUF_SIZE + 2
source "subsys/mgmt/Kconfig.mcumgr"
config MCUMGR_SMP_UDP
bool "UDP mcumgr SMP transport"
select MCUMGR
select NETWORKING
select NET_UDP
select NET_SOCKETS
select NET_SOCKETS_POSIX_NAMES
help
Enables handling of SMP commands received over UDP.
Will start a thread for listening on the configured UDP port.
config MCUMGR_SMP_UDP_IPV4
bool "UDP SMP using IPv4"
depends on MCUMGR_SMP_UDP
depends on NET_IPV4
default y
help
Enable SMP UDP using IPv4 addressing.
Can be enabled alongside IPv6 addressing.
config MCUMGR_SMP_UDP_IPV6
bool "UDP SMP using IPv6"
depends on MCUMGR_SMP_UDP
depends on NET_IPV6
help
Enable SMP UDP using IPv6 addressing.
Can be enabled alongside IPv4 addressing.
config MCUMGR_SMP_UDP_PORT
int "UDP SMP port"
depends on MCUMGR_SMP_UDP
default 1337
help
UDP port that SMP server will listen for SMP commands on.
config MCUMGR_SMP_UDP_STACK_SIZE
int "UDP SMP stack size"
depends on MCUMGR_SMP_UDP
default 512
help
Stack size of the SMP UDP listening thread
config MCUMGR_SMP_UDP_THREAD_PRIO
int "UDP SMP thread priority"
depends on MCUMGR_SMP_UDP
default 0
help
Scheduling priority of the SMP UDP listening thread.
config MCUMGR_SMP_UDP_MTU
int "UDP SMP MTU"
depends on MCUMGR_SMP_UDP
default 1500
help
Maximum size of SMP frames sent and received over UDP, in bytes.
This value must satisfy the following relation:
MCUMGR_SMP_UDP_MTU <= MCUMGR_BUF_SIZE + SMP msg overhead - address size
where address size is determined by IPv4/IPv6 selection.
if MCUMGR
config MCUMGR_BUF_COUNT
int "Number of mcumgr buffers"
default 2 if MCUMGR_SMP_UDP
default 4
help
The number of net_bufs to allocate for mcumgr. These buffers are
used for both requests and responses.
config MCUMGR_BUF_SIZE
int "Size of each mcumgr buffer"
default 2048 if MCUMGR_SMP_UDP
default 384
help
The size, in bytes, of each mcumgr buffer. This value must satisfy
the following relation:
MCUMGR_BUF_SIZE >= transport-specific-MTU + transport-overhead
config MCUMGR_BUF_USER_DATA_SIZE
int "Size of mcumgr buffer user data"
default 24 if MCUMGR_SMP_UDP && MCUMGR_SMP_UDP_IPV6
default 8 if MCUMGR_SMP_UDP && MCUMGR_SMP_UDP_IPV4
default 4
help
The size, in bytes, of user data to allocate for each mcumgr buffer.
Different mcumgr transports impose different requirements for this
setting. A value of 4 is sufficient for UART, shell, and bluetooth.
For UDP, the userdata must be large enough to hold a IPv4/IPv6 address.
Note that CONFIG_NET_BUF_USER_DATA_SIZE must be at least as big as
MCUMGR_BUF_USER_DATA_SIZE.
endif # MCUMGR
endmenu

View file

@ -0,0 +1,14 @@
# SPDX-License-Identifier: Apache-2.0
zephyr_library()
zephyr_library_sources(buf.c)
zephyr_library_sources(smp.c)
zephyr_library_sources_ifdef(CONFIG_MCUMGR_SMP_BT smp_bt.c)
zephyr_library_sources_ifdef(CONFIG_MCUMGR_SMP_SHELL smp_shell.c)
zephyr_library_sources_ifdef(CONFIG_MCUMGR_SMP_UART smp_uart.c)
zephyr_library_sources_ifdef(CONFIG_MCUMGR_SMP_UDP smp_udp.c)
zephyr_library_link_libraries(MCUMGR)
if (CONFIG_MCUMGR_SMP_SHELL OR CONFIG_MCUMGR_SMP_UART)
zephyr_library_sources(serial_util.c)
endif ()

160
subsys/mgmt/mcumgr/Kconfig Normal file
View file

@ -0,0 +1,160 @@
# mcumgr configuration options
# Copyright Runtime.io 2018. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
menu "MCUMgr"
config MCUMGR_SMP_BT
bool "Bluetooth mcumgr SMP transport"
select MCUMGR
select BT
select BT_PERIPHERAL
select BT_GATT_DYNAMIC_DB
help
Enables handling of SMP commands received over Bluetooth.
config MCUMGR_SMP_BT_AUTHEN
bool "Authenticated requirement for Bluetooth mcumgr SMP transport"
depends on MCUMGR_SMP_BT
select BT_SMP
default y
help
Enables encrypted and authenticated connection requirement to
Bluetooth SMP transport.
config MCUMGR_SMP_SHELL
bool "Shell mcumgr SMP transport"
select MCUMGR
select SHELL
select SHELL_BACKEND_SERIAL
select BASE64
help
Enables handling of SMP commands received over shell. This allows
the shell to be use for both mcumgr commands and shell commands.
config MCUMGR_SMP_SHELL_MTU
int "Shell SMP MTU"
default 256
depends on MCUMGR_SMP_SHELL
help
Maximum size of SMP frames sent and received over shell. This value
must satisfy the following relation:
MCUMGR_SMP_SHELL_MTU <= MCUMGR_BUF_SIZE + 2
config MCUMGR_SMP_UART
bool "UART mcumgr SMP transport"
select MCUMGR
select UART_MCUMGR
select BASE64
help
Enables handling of SMP commands received over UART. This is a
lightweight alternative to MCUMGR_SMP_SHELL. It allows mcumgr
commands to be received over UART without requiring an additional
thread.
config MCUMGR_SMP_UART_MTU
int "UART SMP MTU"
default 256
depends on MCUMGR_SMP_UART
help
Maximum size of SMP frames sent and received over UART, in bytes.
This value must satisfy the following relation:
MCUMGR_SMP_UART_MTU <= MCUMGR_BUF_SIZE + 2
source "subsys/mgmt/mcumgr/Kconfig.mcumgr"
config MCUMGR_SMP_UDP
bool "UDP mcumgr SMP transport"
select MCUMGR
select NETWORKING
select NET_UDP
select NET_SOCKETS
select NET_SOCKETS_POSIX_NAMES
help
Enables handling of SMP commands received over UDP.
Will start a thread for listening on the configured UDP port.
config MCUMGR_SMP_UDP_IPV4
bool "UDP SMP using IPv4"
depends on MCUMGR_SMP_UDP
depends on NET_IPV4
default y
help
Enable SMP UDP using IPv4 addressing.
Can be enabled alongside IPv6 addressing.
config MCUMGR_SMP_UDP_IPV6
bool "UDP SMP using IPv6"
depends on MCUMGR_SMP_UDP
depends on NET_IPV6
help
Enable SMP UDP using IPv6 addressing.
Can be enabled alongside IPv4 addressing.
config MCUMGR_SMP_UDP_PORT
int "UDP SMP port"
depends on MCUMGR_SMP_UDP
default 1337
help
UDP port that SMP server will listen for SMP commands on.
config MCUMGR_SMP_UDP_STACK_SIZE
int "UDP SMP stack size"
depends on MCUMGR_SMP_UDP
default 512
help
Stack size of the SMP UDP listening thread
config MCUMGR_SMP_UDP_THREAD_PRIO
int "UDP SMP thread priority"
depends on MCUMGR_SMP_UDP
default 0
help
Scheduling priority of the SMP UDP listening thread.
config MCUMGR_SMP_UDP_MTU
int "UDP SMP MTU"
depends on MCUMGR_SMP_UDP
default 1500
help
Maximum size of SMP frames sent and received over UDP, in bytes.
This value must satisfy the following relation:
MCUMGR_SMP_UDP_MTU <= MCUMGR_BUF_SIZE + SMP msg overhead - address size
where address size is determined by IPv4/IPv6 selection.
if MCUMGR
config MCUMGR_BUF_COUNT
int "Number of mcumgr buffers"
default 2 if MCUMGR_SMP_UDP
default 4
help
The number of net_bufs to allocate for mcumgr. These buffers are
used for both requests and responses.
config MCUMGR_BUF_SIZE
int "Size of each mcumgr buffer"
default 2048 if MCUMGR_SMP_UDP
default 384
help
The size, in bytes, of each mcumgr buffer. This value must satisfy
the following relation:
MCUMGR_BUF_SIZE >= transport-specific-MTU + transport-overhead
config MCUMGR_BUF_USER_DATA_SIZE
int "Size of mcumgr buffer user data"
default 24 if MCUMGR_SMP_UDP && MCUMGR_SMP_UDP_IPV6
default 8 if MCUMGR_SMP_UDP && MCUMGR_SMP_UDP_IPV4
default 4
help
The size, in bytes, of user data to allocate for each mcumgr buffer.
Different mcumgr transports impose different requirements for this
setting. A value of 4 is sufficient for UART, shell, and bluetooth.
For UDP, the userdata must be large enough to hold a IPv4/IPv6 address.
Note that CONFIG_NET_BUF_USER_DATA_SIZE must be at least as big as
MCUMGR_BUF_USER_DATA_SIZE.
endif # MCUMGR
endmenu

View file

@ -7,7 +7,7 @@
#include <assert.h>
#include <string.h>
#include "net/buf.h"
#include "mgmt/buf.h"
#include "mgmt/mcumgr/buf.h"
#include <tinycbor/compilersupport_p.h>
NET_BUF_POOL_DEFINE(pkt_pool, CONFIG_MCUMGR_BUF_COUNT, CONFIG_MCUMGR_BUF_SIZE,

View file

@ -12,8 +12,8 @@
#include <sys/byteorder.h>
#include <net/buf.h>
#include <sys/base64.h>
#include <mgmt/buf.h>
#include <mgmt/serial.h>
#include <mgmt/mcumgr/buf.h>
#include <mgmt/mcumgr/serial.h>
static void mcumgr_serial_free_rx_ctxt(struct mcumgr_serial_rx_ctxt *rx_ctxt)
{

View file

@ -7,9 +7,9 @@
#include <zephyr.h>
#include "net/buf.h"
#include "mgmt/mgmt.h"
#include "mgmt/buf.h"
#include "mgmt/mcumgr/buf.h"
#include "smp/smp.h"
#include "mgmt/smp.h"
#include "mgmt/mcumgr/smp.h"
static mgmt_alloc_rsp_fn zephyr_smp_alloc_rsp;
static mgmt_trim_front_fn zephyr_smp_trim_front;

View file

@ -16,10 +16,10 @@
#include <bluetooth/uuid.h>
#include <bluetooth/gatt.h>
#include <mgmt/smp_bt.h>
#include <mgmt/buf.h>
#include <mgmt/mcumgr/smp_bt.h>
#include <mgmt/mcumgr/buf.h>
#include <mgmt/smp.h>
#include <mgmt/mcumgr/smp.h>
struct device;

View file

@ -13,10 +13,10 @@
#include <init.h>
#include "net/buf.h"
#include "mgmt/mgmt.h"
#include "mgmt/serial.h"
#include "mgmt/buf.h"
#include "mgmt/smp.h"
#include "mgmt/smp_shell.h"
#include "mgmt/mcumgr/serial.h"
#include "mgmt/mcumgr/buf.h"
#include "mgmt/mcumgr/smp.h"
#include "mgmt/mcumgr/smp_shell.h"
static struct zephyr_smp_transport smp_shell_transport;

View file

@ -14,9 +14,9 @@
#include "net/buf.h"
#include <drivers/console/uart_mcumgr.h>
#include "mgmt/mgmt.h"
#include <mgmt/serial.h>
#include "mgmt/buf.h"
#include "mgmt/smp.h"
#include <mgmt/mcumgr/serial.h>
#include "mgmt/mcumgr/buf.h"
#include "mgmt/mcumgr/smp.h"
struct device;

View file

@ -14,9 +14,9 @@
#include <net/socket.h>
#include <errno.h>
#include <mgmt/mgmt.h>
#include <mgmt/smp_udp.h>
#include <mgmt/buf.h>
#include <mgmt/smp.h>
#include <mgmt/mcumgr/smp_udp.h>
#include <mgmt/mcumgr/buf.h>
#include <mgmt/mcumgr/smp.h>
#define LOG_LEVEL CONFIG_MCUMGR_LOG_LEVEL
#include <logging/log.h>