1# Copyright Runtime.io 2018. All rights reserved.
2# Copyright Nordic Semiconductor ASA 2020-2022. All rights reserved.
3# SPDX-License-Identifier: Apache-2.0
4
5# The Kconfig file is dedicated to OS management group of
6# of MCUmgr subsystem and provides Kconfig options to configure
7# group commands behaviour and other aspects.
8#
9# Options defined in this file should be prefixed:
10#  MCUMGR_GRP_OS_ -- general group options;
11#
12# When adding Kconfig options, that control the same feature,
13# try to group them together by the same stem after prefix.
14
15menuconfig MCUMGR_GRP_OS
16	bool "Mcumgr handlers for OS management"
17	imply REBOOT
18	help
19	  Enables MCUmgr handlers for OS management
20
21if MCUMGR_GRP_OS
22
23if REBOOT
24
25config MCUMGR_GRP_OS_RESET_MS
26	int "Delay before executing reset command (ms)"
27	default 250
28	depends on REBOOT
29	help
30	  When a reset command is received, the system waits this many milliseconds
31	  before performing the reset.  This delay allows time for the MCUmgr
32	  response to be delivered.
33
34config MCUMGR_GRP_OS_RESET_HOOK
35	bool "Reset hook"
36	depends on REBOOT
37	depends on MCUMGR_MGMT_NOTIFICATION_HOOKS
38	help
39	  Allows applications to control and get notifications of when a reset
40	  command has been issued via an MCUmgr command. With this option
41	  disabled, modules will reboot when the command is received without
42	  notification, when this is enabled and a handler is registered, the
43	  application will be notified that a reset command has been received
44	  and will allow the application to perform any required operations
45	  before accepting or declining the reset request.
46
47endif
48
49config MCUMGR_GRP_OS_TASKSTAT
50	bool "Support for taskstat command"
51	select MCUMGR_SMP_CBOR_MIN_ENCODING_LEVEL_3 if ZCBOR_CANONICAL
52	depends on THREAD_MONITOR
53
54if MCUMGR_GRP_OS_TASKSTAT
55
56config MCUMGR_GRP_OS_TASKSTAT_ONLY_SUPPORTED_STATS
57	bool "Send only data gathered by Zephyr"
58	default y
59	help
60	  Response will not include fields the Zephyr does not collect statistic for.
61	  Enable this if your client software is able to process "taskstat" response
62	  that would be missing "runtime", "cswcnt", "last_checkin" and "next_checkin"
63	  map entries for each listed task.
64	  Enabling this option will slightly reduce code size.
65
66choice MCUMGR_GRP_OS_TASKSTAT_THREAD_NAME_CHOICE
67	prompt "Characteristic used as thread name in taskstat"
68	default MCUMGR_GRP_OS_TASKSTAT_USE_THREAD_NAME_FOR_NAME if THREAD_NAME
69	default MCUMGR_GRP_OS_TASKSTAT_USE_THREAD_PRIO_FOR_NAME
70	help
71	  Select what will serve as thread name in "taskstat" response.
72	  By default taskstat responses use thread priority, when THREAD_NAME is disabled,
73
74	config MCUMGR_GRP_OS_TASKSTAT_USE_THREAD_NAME_FOR_NAME
75		bool "Thread name"
76		depends on THREAD_NAME
77
78	config MCUMGR_GRP_OS_TASKSTAT_USE_THREAD_IDX_FOR_NAME
79		bool "Thread index"
80
81	config MCUMGR_GRP_OS_TASKSTAT_USE_THREAD_PRIO_FOR_NAME
82		bool "Thread priority"
83
84endchoice
85
86config MCUMGR_GRP_OS_TASKSTAT_MAX_NUM_THREADS
87	int "Predicted maximum number of threads to return on taskstat list"
88	default 50
89	help
90	  This is used for defining CBOR map holding thread info.
91	  The value does not affect memory allocation, it is used by zcbor
92	  to figure out how to encode map depending on its predicted size.
93
94config MCUMGR_GRP_OS_TASKSTAT_THREAD_NAME_LEN
95	int "Length of thread name to return in response"
96	default THREAD_MAX_NAME_LEN if THREAD_NAME
97	default 5 if !THREAD_NAME
98	range 3 THREAD_MAX_NAME_LEN if THREAD_NAME
99	range 3 6 if !THREAD_NAME
100	help
101	  The length of the string that is sent in response to taskstat command,
102	  as a thread name.
103	  When THREAD_NAME is enabled then this defaults to THREAD_MAX_NAME_LEN.
104	  When THREAD_NAME is disabled the name is generated from thread priority,
105	  signed integer, and this number regulates how many digits will be used;
106	  in such case this value should also take into account possible '-'
107	  sign.
108
109config MCUMGR_GRP_OS_TASKSTAT_SIGNED_PRIORITY
110	bool "Signed priorities"
111	default y
112	help
113	  Zephyr uses int8_t as thread priorities, but in taskstat response it encodes
114	  them as unsigned.  Enabling this option will use signed int for priorities in
115	  responses, which is more natural for Zephyr.
116	  Disable this option if your client software is unable to properly decode and
117	  accept signed integers as priorities.
118
119config MCUMGR_GRP_OS_TASKSTAT_STACK_INFO
120	bool "Include stack info in taskstat responses"
121	depends on THREAD_STACK_INFO
122	help
123	  Enabling this option adds stack information into "taskstat" command
124	  responses, this is default when THREAD_STACK_INFO is selected.
125	  Disable this option only when your client application is able to
126	  process "taskstat" response without the "stksiz" and "stkuse" fields.
127	  It is worth disabling this option when THREAD_STACK_INFO is disabled,
128	  as it will prevent sending zeroed stack information just to fill
129	  all the fields in "taskstat" responses, and it will slightly reduce code size.
130
131endif
132
133config MCUMGR_GRP_OS_ECHO
134	bool "Support for echo command"
135	default y
136	select MCUMGR_SMP_CBOR_MIN_DECODING_LEVEL_2
137
138config MCUMGR_GRP_OS_MCUMGR_PARAMS
139	bool "MCUMGR Parameters retrieval command"
140
141config MCUMGR_GRP_OS_INFO
142	bool "Support for info command"
143	help
144	  Can be used similarly to the unix/linux uname command for retrieving system information
145	  including kernel version, processor architecture and board name.
146
147if MCUMGR_GRP_OS_INFO
148
149config MCUMGR_GRP_OS_INFO_MAX_RESPONSE_SIZE
150	int "Maximum response size for info command"
151	default 256
152	range 32 512
153	help
154	  The maximum size of the response to the info command, will use a stack buffer of this
155	  size to store the data in. If the output response is too big then the output will not be
156	  present in the response, which will just contain the result code (rc) of memory error.
157
158config MCUMGR_GRP_OS_INFO_CUSTOM_HOOKS
159	bool "Custom info hooks"
160	depends on MCUMGR_MGMT_NOTIFICATION_HOOKS
161	help
162	  Supports adding custom command/character processing to the info command by using
163	  registered callbacks. Data can be appended to the struct provided in the callback.
164
165config MCUMGR_GRP_OS_INFO_BUILD_DATE_TIME
166	bool "Show build date and time"
167	help
168	  Will allow returning the build date and time of the firmware by using the info with
169	  format option 'b' (will also be returned with all responses by using 'a').
170
171	  Note: This will invalidate reproducible builds of the firmware as it will embed the
172	  build date/time in the output firmware image.
173
174endif
175
176if BOOTLOADER_MCUBOOT
177
178config MCUMGR_GRP_OS_BOOTLOADER_INFO
179	bool "Bootloader information"
180	help
181	  Allows to query MCUmgr about bootloader used by device and various bootloader
182	  parameters.
183
184endif # BOOTLOADER_MCUBOOT
185
186module = MCUMGR_GRP_OS
187module-str = mcumgr_grp_os
188source "subsys/logging/Kconfig.template.log_config"
189
190endif
191