Linux Audio

Check our new training course

Loading...
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
# 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 TINYCBOR
	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'.

config MGMT_CBORATTR_MAX_SIZE
	int "The maximum size of a CBOR attribute during decoding"
        default 512
        help
          The maximum size of a CBOR attribute during decoding

config MGMT_CBORATTR_FLOAT_SUPPORT
	bool "Enable support for float"
	help
	  The option enables float processing within CBOR attributes.
	  If your code requires processing of float numbers by CBOR,
	  the option needs to be enabled.
	  Disabling the option slightly reduces code footprint.

menu "Command Handlers"
menuconfig MCUMGR_CMD_FS_MGMT
	bool "Enable mcumgr handlers for file management (insecure)"
	depends on FILE_SYSTEM
	help
	  Enables mcumgr handlers for file management

	  This option allows mcumgr clients to access anything in the
	  file system, including application-stored secrets like
	  private keys. Use of this feature in production is strongly
	  discouraged.

if MCUMGR_CMD_FS_MGMT

choice FS_MGMT_MAX_FILE_SIZE
	prompt "Maximum file size that could be uploaded/downloaded"
	default FS_MGMT_MAX_FILE_SIZE_64KB
	help
	  Maximum file size that will be allowed to be downloaded from
	  device.
	  This option decides on number of bytes that are reserved in
	  CBOR frame for storage of offset/size of file downloaded.

config FS_MGMT_MAX_FILE_SIZE_64KB
	bool "<= 64KB"
	help
	  Files that have size up to 64KB require 1 to 3 bytes to encode
	  size/offset within CBOR frame with file chunk.

config FS_MGMT_MAX_FILE_SIZE_4GB
	bool "<= 4GB"
	help
	  Files that have size up to 4GB require 1 to 5 bytes to encode
	  size/offset within CBOR frame with file chunk.

endchoice

config FS_MGMT_MAX_OFFSET_LEN
	int
	default	3 if FS_MGMT_MAX_FILE_SIZE_64KB
	default 5 if FS_MGMT_MAX_FILE_SIZE_4GB
	help
	  Maximal byte length of encoded offset/size, within transferred
	  CBOR frame containing chunk of downloaded file.
	  This value affects how much of data will fit into download buffer,
	  as it selects sizes of fields within headers.
	  NOTE: This option is hidden intentionally as it is intended
	  to be assigned from limited set of allowed values, depending on
	  the selection made in FS_MGMT_MAX_FILE_SIZE menu.

config FS_MGMT_UL_CHUNK_SIZE
	int "Maximum chunk size for file uploads"
	default 512
	help
	  Limits the maximum chunk size for file uploads, in bytes.  A buffer of
	  this size gets allocated on the stack during handling of a file upload command.

config FS_MGMT_DL_CHUNK_SIZE_LIMIT
	bool "Enable setting custom size of download file chunk"
	help
	  By default file chunk, that will be read off storage and fit into
	  mcumgr frame, is automatically calculated to fit into buffer
	  of size MCUGMR_BUF_SIZE with all headers.
	  Enabling this option allows to set MAXIMUM value that will be
	  allowed for such chunk.
	  Look inside fs_mgmt_config.h for details.

if FS_MGMT_DL_CHUNK_SIZE_LIMIT

config FS_MGMT_DL_CHUNK_SIZE
	int "Maximum chunk size for file downloads"
	range 65 MCUMGR_BUF_SIZE
	default MCUMGR_BUF_SIZE
	help
	  Sets the MAXIMUM size of chunk which will be rounded down to
	  number of bytes that, with all the required headers, will fit
	  into MCUMGR_BUF_SIZE. This means that actual value might be lower
	  then selected, in which case compiler warning will be issued.
	  Look inside fs_mgmt_config.h for details.
	  Note that header sizes are affected by FS_MGMT_MAX_OFFSET_LEN.

endif


config FS_MGMT_PATH_SIZE
	int "Maximum file path length"
	default 64
	help
	  Limits the maximum path length for file operations, in bytes.  A buffer
	  of this size gets allocated on the stack during handling of file upload
	  and download commands.
endif

config MCUMGR_CMD_SHELL_MGMT
	bool "Enable mcumgr handlers for shell management"
	depends on SHELL
	select SHELL_BACKEND_DUMMY
	help
	  Enables mcumgr handlers for shell management. The handler will utilize
	  the dummy backend to execute shell commands and capture the output to
	  an internal memory buffer. This way, there is no interaction with
	  physical interfaces outside of the scope of the user.
	  It is possible to use additional shell backends in coordination
	  with this handler and they will not interfere.
	  The SHELL_BACKEND_DUMMY_BUF_SIZE will affect how many characters
	  will be returned from command output, if your output gets cut, then
	  increase the value. Remember to set MCUMGR_BUF_SIZE accordingly.

menuconfig MCUMGR_CMD_IMG_MGMT
	bool "Enable mcumgr handlers for image management"
	select FLASH
	select MPU_ALLOW_FLASH_WRITE if ARM_MPU
	select IMG_MANAGER
	help
	  Enables mcumgr handlers for image management

if MCUMGR_CMD_IMG_MGMT
config IMG_MGMT_UL_CHUNK_SIZE
	int "Maximum chunk size for image uploads"
	default 512
	depends on MCUMGR_CMD_IMG_MGMT
	help
	  Limits the maximum chunk size for image uploads, in bytes.  A buffer of
	  this size gets allocated on the stack during handling of a image upload
	  command.

config IMG_MGMT_UPDATABLE_IMAGE_NUMBER
	int "Number of supported images"
	default UPDATEABLE_IMAGE_NUMBER
	range 1 2
	help
	  Sets how many application images are supported (pairs of secondary and primary slots).
	  Setting this to 2 requires MCUMGR_BUF_SIZE to be at least 512b.
	  NOTE: The UPDATEABLE_IMAGE_NUMBER of MCUBOOT configuration, even for Zephyr build,
	  needs to be set to the same value; this is due to the fact that the mcumgr uses
	  boot_util and the UPDATEABLE_IMAGE_NUMBER controls number of images supported
	  by that library.

config IMG_MGMT_VERBOSE_ERR
	bool "Verbose logging when uploading a new image"
	help
	  Enable verbose logging during a firmware upgrade.

config IMG_MGMT_DUMMY_HDR
	bool "Return dummy image header data for imgr functions"
	help
	  Returns dummy image header data for imgr functions,
	  useful when there are no images present, Eg: unit tests.

config IMG_MGMT_DIRECT_IMAGE_UPLOAD
	bool "Allow direct image upload"
	help
	  Enables directly uploading image to selected image partition.
	  This changes how "image" is understood by mcumgr: normally the mcumgr allows to upload
	  to first slot of the only image it knows, where image is understood as two slots
	  (two DTS images for Zephyr); this allows to treat every DTS defined image as direct
	  target for upload, and more than two may be used (4 at this time).
	  NOTE: When direct upload is used the image numbers are shifted by + 1, and the default
	  behaviour is, when image is not selected, to upload to image that represents secndary
	  slot in normal operation.

config IMG_MGMT_REJECT_DIRECT_XIP_MISMATCHED_SLOT
	bool "Reject Direct-XIP applications with mismatched address"
	help
	  When enabled, the mcumgr will compare base address of application,
	  encoded into .bin file header with use of imgtool, on upload and will
	  reject binaries that would not be able to start from available
	  Direct-XIP address.
	  The base address can be set, to an image binary header, with imgtool,
	  using the --rom-fixed command line option.

config IMG_MGMT_FRUGAL_LIST
	bool "Omit zero, empty or false values from status list"
	help
	  The status list send back from the device will only be filled with data that is non-zero,
	  non-empty or true.  This option slightly reduces number of bytes transferred back from
	  a device but requires support in client software, which has to default omitted values.
	  Works correctly with mcumgr-cli.

endif


menuconfig MCUMGR_CMD_OS_MGMT
	bool "Enable mcumgr handlers for OS management"
	select REBOOT
	help
	  Enables mcumgr handlers for OS management

if MCUMGR_CMD_OS_MGMT
config OS_MGMT_RESET_MS
	int "Delay before executing reset command (ms)"
	default 250
	help
	  When a reset command is received, the system waits this many milliseconds
	  before performing the reset.  This delay allows time for the mcumgr
	  response to be delivered.

config OS_MGMT_TASKSTAT
	bool "Support for taskstat command"
	depends on THREAD_MONITOR

if OS_MGMT_TASKSTAT

config OS_MGMT_TASKSTAT_ONLY_SUPPORTED_STATS
	bool "Send only data gathered by Zephyr"
	default y
	help
	  Response will not include fields the Zephyr does not collect statistic for.
	  Enable this if your client software is able to process "taskstat" response
	  that would be missing "runtime", "cswcnt", "last_checkin" and "next_checkin"
	  map entries for each listed task.
	  Enabling this option will slightly reduce code size.

choice OS_MGMT_TASKSTAT_THREAD_NAME_CHOICE
	prompt "Characteristic used as thread name in taskstat"
	default OS_MGMT_TASKSTAT_USE_THREAD_NAME_FOR_NAME if THREAD_NAME
	default OS_MGMT_TASKSTAT_USE_THREAD_PRIO_FOR_NAME
	help
	  Select what will serve as thread name in "taskstat" response.
	  By default taskstat responses use thread priority, when THREAD_NAME is disabled,

	config OS_MGMT_TASKSTAT_USE_THREAD_NAME_FOR_NAME
		bool "Thread name"
		depends on THREAD_NAME

	config OS_MGMT_TASKSTAT_USE_THREAD_IDX_FOR_NAME
		bool "Thread index"

	config OS_MGMT_TASKSTAT_USE_THREAD_PRIO_FOR_NAME
		bool "Thread priority"

endchoice

config OS_MGMT_TASKSTAT_THREAD_NAME_LEN
	int "Length of thread name to return in response"
	default THREAD_MAX_NAME_LEN if THREAD_NAME
	default 5 if !THREAD_NAME
	range 3 THREAD_MAX_NAME_LEN if THREAD_NAME
	range 3 6 if !THREAD_NAME
	help
	  The length, including terminating 0, of the string that is sent in response
	  to taskstat command, as a thread name.
	  When THREAD_NAME is enabled then this defaults to THREAD_MAX_NAME_LEN.
	  When THREAD_NAME is disabled the name is generated from thread priority,
	  signed integer, and this number regulates how many digits will be used;
	  in such case this value should also take into account possible '-'
	  sign.

config OS_MGMT_TASKSTAT_SIGNED_PRIORITY
	bool "Enable signed priorities"
	help
	  Zephyr uses int8_t as thread priorities, but in taskstat response it encodes
	  them as unsigned.  Enabling this option will use signed int for priorities in
	  responses, which is more natural for Zephyr.
	  Enable this option only if your client software is able to properly decode
	  and accept signed integers as priorities.

config OS_MGMT_TASKSTAT_STACK_INFO
	bool "Include stack info in taskstat responses"
	depends on THREAD_STACK_INFO
	help
	  Enabling this option adds stack information into "taskstat" command
	  responses, this is default when THREAD_STACK_INFO is selected.
	  Disable this option only when your client application is able to
	  process "taskstat" response without the "stksiz" and "stkuse" fields.
	  It is worth disabling this option when THREAD_STACK_INFO is disabled,
	  as it will prevent sending zeroed stack information just to fill
	  all the fields in "taskstat" responses, and it will slightly reduce code size.

endif

config OS_MGMT_ECHO
	bool "Support for echo command"
	default y
endif


menuconfig MCUMGR_CMD_STAT_MGMT
	bool "Enable mcumgr handlers for statistics management"
	depends on STATS
	help
	  Enables mcumgr handlers for statistics management.

config STAT_MGMT_MAX_NAME_LEN
	int "Maximum stat group name length"
	default 32
	depends on MCUMGR_CMD_STAT_MGMT
	help
	  Limits the maximum stat group name length in mcumgr requests, in bytes.
	  A buffer of this size gets allocated on the stack during handling of all
	  stat read commands.  If a stat group's name exceeds this limit, it will
	  be impossible to retrieve its values with a stat show command.


menuconfig MCUMGR_GRP_ZEPHYR_BASIC
	bool "Enable Zephyr specific basic group of commands"
	help
	  Enables mcumgr to processing of Zephyr specific groups.

if MCUMGR_GRP_ZEPHYR_BASIC
config MCUMGR_GRP_BASIC_CMD_STORAGE_ERASE
	bool "Enables storage erase command"
	help
	  Enables command that allows to erase storage partition.

module=MGMT_SETTINGS
module-dep=LOG
module-str=SETTINGS
source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config"

endif

endmenu

config 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_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_LATENCY_CONTROL
	bool "Request low latency connection when handling SMP commands"
	depends on SYSTEM_WORKQUEUE_PRIORITY < 0
	help
	  Enables support for requesting low latency connection parameter 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.

config MCUMGR_SMP_BT_LATENCY_CONTROL_DEFAULT_LATENCY
	int "Default value for connection latency"
	depends on MCUMGR_SMP_BT_LATENCY_CONTROL
	default BT_PERIPHERAL_PREF_LATENCY if BT_GAP_PERIPHERAL_PREF_PARAMS
	default 99
	range 0 499
	help
	  The value is a default connection latency that is used when restoring
	  from low latency mode.

config MCUMGR_SMP_BT_LATENCY_CONTROL_RESTORE_TIME
	int "Connection latency restore time in milliseconds"
	depends on MCUMGR_SMP_BT_LATENCY_CONTROL
	default 5000
	range 1 65535
	help
	  The value is a time after which connection latency is restored
	  to default value
	  (:kconfig:`MCUMGR_SMP_BT_LATENCY_CONTROL_DEFAULT_LATENCY`). Latency
	  restoration time could take up to twice as long as specified time.
	  This is because of limiting CPU time needed to support this feature.
	  The implementation periodically checks if the low latency is still
	  needed every :kconfig:`MCUMGR_SMP_BT_LATENCY_CONTROL_RESTORE_TIME`.
	  The default latency is restored during check only if there was no SMP
	  command exchanged in period before the check

config MCUMGR_SMP_BT_LATENCY_CONTROL_RESTORE_RETRY_TIME
	int "Connection latency restore retry time in milliseconds"
	depends on MCUMGR_SMP_BT_LATENCY_CONTROL
	default 1000
	range 1 5000
	help
	  In case connection latency restoration fails due to an error, this
	  option specifies the time after retry to set the default latency
	  (:kconfig:`MCUMGR_SMP_BT_LATENCY_CONTROL_DEFAULT_LATENCY`) would be
	  executed.

endif # MCUMGR_SMP_BT

config 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

config 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


config 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

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.
endif # MCUMGR