Linux Audio

Check our new training course

Embedded Linux Audio

Check our new training course
with Creative Commons CC-BY-SA
lecture materials

Bootlin logo

Elixir Cross Referencer

Loading...
# Copyright Runtime.io 2018. All rights reserved.
# Copyright Nordic Semiconductor ASA 2020. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

menuconfig MCUMGR
	bool "mcumgr Support"
	select NET_BUF
	select ZCBOR
	help
	  This option enables the mcumgr management library.

if MCUMGR

module = MCUMGR
module-str = mcumgr
source "subsys/logging/Kconfig.template.log_config"


config APP_LINK_WITH_MCUMGR
	bool "Link 'app' with MCUMGR"
	default y
	help
	  Add MCUMGR header files to the 'app' include path. It may be
	  disabled if the include paths for MCUMGR are causing aliasing
	  issues for 'app'.

rsource "lib/Kconfig"

config MGMT_MAX_MAIN_MAP_ENTRIES
	int "Number of predicted maximum entries to main response map"
	default 15
	help
	  This is number of predicted entries in main response map,
	  the one that encapsulates everything within response.
	  This value is used by zcbor to predict needed map encoding,
	  and does not affect memory allocation or usage.
	  Builtin command processors rarely add large amounts of
	  data directly to main map, creating sub-maps instead so
	  the default value works fine with them.
	  If your app directly adds fields to main map, without
	  encapsulating them, you may want to increase this value
	  in case when encoding starts to fail.

config MGMT_MIN_DECODING_LEVELS
	int
	help
	  Minimal decoding levels, map/list encapsulation, required
	  to be supported by zcbor decoding of SMP responses
	  is auto genereated from MGMT_MIN_DECODING_LEVEL_? options.
	  A group or command that adds additional maps/lists above the
	  base map, which is already taken into account, should
	  select one of the MGMT_MIN_DECODING_LEVEL_?.
	default 5 if MGMT_MIN_DECODING_LEVEL_5
	default 4 if MGMT_MIN_DECODING_LEVEL_4
	default 3 if MGMT_MIN_DECODING_LEVEL_3
	default 2 if MGMT_MIN_DECODING_LEVEL_2
	default 1 if MGMT_MIN_DECODING_LEVEL_1
	default 0


config MGMT_MIN_DECODING_LEVEL_1
	bool

config MGMT_MIN_DECODING_LEVEL_2
	bool

config MGMT_MIN_DECODING_LEVEL_3
	bool

config MGMT_MIN_DECODING_LEVEL_4
	bool

config MGMT_MIN_DECODING_LEVEL_5
	bool

config MGMT_MAX_DECODING_LEVELS
	int "Number of map/list encapsulations allowed by SMP encoding"
	range MGMT_MIN_DECODING_LEVELS 15
	default MGMT_MIN_DECODING_LEVELS
	help
	  This is a maximum number of levels of maps/lists that will
	  be expected to be decoded within different command groups.
	  SMP commands/groups that provide no CBOR encoded payload
	  have no requirements.
	  Commands that provide CBOR payload require at least 1 level,
	  and additional levels for each map/list encapsulation.
	  For example if command accepts payload of map of parameters
	  it will need 2 levels.
	  This number translates to zcbor backup states, it increases
	  size of cbor_nb_reader structure by zcbor_state_t size per
	  one unit selected here.

menu "Command Handlers"

rsource "lib/cmd/Kconfig"

rsource "zephyr_grp/Kconfig"

endmenu

menu "Transports and Transport Related Configuration Options"

config MCUMGR_SMP_REASSEMBLY
	bool
	help
	  Enable structures and functions needed for packet reassembly by SMP backend.

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
	  In case when MCUMGR_SMP_SHELL is enabled this value should be set to
	  at least SHELL_BACKEND_DUMMY_BUF_SIZE + 32.

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.


menuconfig MCUMGR_SMP_BT
	bool "Bluetooth mcumgr SMP transport"
	select BT
	select BT_PERIPHERAL
	select BT_GATT_DYNAMIC_DB
	help
	  Enables handling of SMP commands received over Bluetooth.

if MCUMGR_SMP_BT

config MCUMGR_SMP_REASSEMBLY_BT
	bool "Reassemble packets in Bluetooth SMP transport"
	select MCUMGR_SMP_REASSEMBLY
	help
	  When enabled, the SMP BT transport will buffer and reassemble received
	  packet fragments before passing it for further processing.


config MCUMGR_SMP_BT_AUTHEN
	bool "Authenticated requirement for Bluetooth mcumgr SMP transport"
	select BT_SMP
	default y
	help
	  Enables encrypted and authenticated connection requirement to
	  Bluetooth SMP transport.

config MCUMGR_SMP_BT_CONN_PARAM_CONTROL
	bool "Request specific connection parameters for SMP packet exchange"
	depends on SYSTEM_WORKQUEUE_PRIORITY < 0
	depends on BT_GAP_PERIPHERAL_PREF_PARAMS
	help
	  Enables support for requesting specific connection parameters when
	  SMP commands are handled. This option allows to speed up the command
	  exchange process.
	  Its recommended to enable this if SMP is used for DFU.

if MCUMGR_SMP_BT_CONN_PARAM_CONTROL

config MCUMGR_SMP_BT_CONN_PARAM_CONTROL_MIN_INT
	int "Minimum connection interval for SMP packet exchange"
	default 6
	range 6 3200
	help
	  Minimum connection interval in 1.25ms units used during the exchange of SMP packets.

config MCUMGR_SMP_BT_CONN_PARAM_CONTROL_MAX_INT
	int "Maximum connection interval for SMP packet exchange"
	default 9
	range MCUMGR_SMP_BT_CONN_PARAM_CONTROL_MIN_INT 3200
	help
	  Maximum connection interval in 1.25ms units used during the exchange of SMP packets.

config MCUMGR_SMP_BT_CONN_PARAM_CONTROL_LATENCY
	int "Peripheral latency for SMP packet exchange"
	default 0
	range 0 499
	help
	  Peripheral latency in Connection Intervals used during the exchange of SMP packets.

config MCUMGR_SMP_BT_CONN_PARAM_CONTROL_TIMEOUT
	int "Supervision timeout for SMP packet exchange"
	default 42
	range 10 3200
	help
	  Supervision timeout in 10ms used during the exchange of SMP packets.

config MCUMGR_SMP_BT_CONN_PARAM_CONTROL_RESTORE_TIME
	int "Connection parameters restore time in milliseconds"
	default 5000
	range 1000 65535
	help
	  The value is a time of inactivity on the SMP characteristic after which
	  connection parameters are restored to peripheral preferred values
	  (BT_GAP_PERIPHERAL_PREF_PARAMS).

config MCUMGR_SMP_BT_CONN_PARAM_CONTROL_RETRY_TIME
	int "Connection parameters update retry time in milliseconds"
	default 1000
	range 1 5000
	help
	  In case connection parameters update fails due to an error, this
	  option specifies the time of the next update attempt.

endif # MCUMGR_SMP_BT_CONN_PARAM_CONTROL

endif # MCUMGR_SMP_BT

menuconfig MCUMGR_SMP_SHELL
	bool "Shell mcumgr SMP transport"
	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.

if MCUMGR_SMP_SHELL

config MCUMGR_SMP_SHELL_MTU
	int "Shell SMP MTU"
	default 256
	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_SHELL_RX_BUF_COUNT
	int "Shell SMP RX buffer count"
	default 2
	help
	  Number of buffers used for receiving SMP fragments over shell.

endif # MCUMGR_SMP_SHELL

menuconfig MCUMGR_SMP_UART
	bool "UART mcumgr SMP transport"
	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.

if UART_ASYNC_API && MCUMGR_SMP_UART

menuconfig MCUMGR_SMP_UART_ASYNC
	bool "Use async UART API when available"
	help
	  The option enables use of UART async API when available for selected mcumgr uart port.

if MCUMGR_SMP_UART_ASYNC
config MCUMGR_SMP_UART_ASYNC_BUFS
	int "Number of async RX UART buffers"
	range 2 8
	default 2
	help
	  The asynchronous UART API requires registering RX buffers for received data; when the RX
	  reaches the end of a buffer, it will send event requesting next buffer, to be able to
	  receive data without stopping due to running out of buffer space.  At least two buffers
	  area required for smooth RX operation.

config MCUMGR_SMP_UART_ASYNC_BUF_SIZE
	int "Size of single async RX UART buffer"
	default 64
	help
	  The size of single buffer for asynchronous RX.

endif # MCUMGR_SMP_UART_ASYNC
endif # UART_ASYNC_API

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


menuconfig MCUMGR_SMP_UDP
	bool "UDP mcumgr SMP transport"
	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.

if MCUMGR_SMP_UDP
config MCUMGR_SMP_UDP_IPV4
	bool "UDP SMP using IPv4"
	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 NET_IPV6
	help
	  Enable SMP UDP using IPv6 addressing.
	  Can be enabled alongside IPv4 addressing.

config MCUMGR_SMP_UDP_PORT
	int "UDP SMP port"
	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"
	default 512
	help
	  Stack size of the SMP UDP listening thread

config MCUMGR_SMP_UDP_THREAD_PRIO
	int "UDP SMP thread priority"
	default 0
	help
	  Scheduling priority of the SMP UDP listening thread.

config MCUMGR_SMP_UDP_MTU
	int "UDP SMP MTU"
	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.

endif # MCUMGR_SMP_UDP

endmenu

module = MCUMGR_SMP
module-str = mcumgr_smp
source "subsys/logging/Kconfig.template.log_config"

endif # MCUMGR