1# Copyright Runtime.io 2018. All rights reserved. 2# Copyright Nordic Semiconductor ASA 2020-2023. All rights reserved. 3# SPDX-License-Identifier: Apache-2.0 4 5# The Kconfig file is dedicated to File System 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_FS_ -- 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_FS 16 bool "MCUmgr handlers for file management" 17 depends on FILE_SYSTEM 18 select MCUMGR_SMP_CBOR_MIN_DECODING_LEVEL_2 19 help 20 Enables MCUmgr handlers for file management 21 22 This option allows MCUmgr clients to access anything in the 23 file system, including application-stored secrets like 24 private keys. Use of this feature in production without adequate 25 protection mechanisms is strongly discouraged (applications can 26 enable MCUMGR_GRP_FS_FILE_ACCESS_HOOK and register to receive 27 callbacks when file access is attempted, which they can then filter, 28 allow, deny or rewrite paths). 29 30if MCUMGR_GRP_FS 31 32choice MCUMGR_GRP_FS_MAX_FILE_SIZE 33 prompt "Maximum file size that could be uploaded/downloaded" 34 default MCUMGR_GRP_FS_MAX_FILE_SIZE_64KB 35 help 36 Maximum file size that will be allowed to be downloaded from 37 device. 38 This option decides on number of bytes that are reserved in 39 CBOR frame for storage of offset/size of file downloaded. 40 41config MCUMGR_GRP_FS_MAX_FILE_SIZE_64KB 42 bool "<= 64KB" 43 help 44 Files that have size up to 64KB require 1 to 3 bytes to encode 45 size/offset within CBOR frame with file chunk. 46 47config MCUMGR_GRP_FS_MAX_FILE_SIZE_4GB 48 bool "<= 4GB" 49 help 50 Files that have size up to 4GB require 1 to 5 bytes to encode 51 size/offset within CBOR frame with file chunk. 52 53endchoice 54 55config MCUMGR_GRP_FS_MAX_OFFSET_LEN 56 int 57 default 3 if MCUMGR_GRP_FS_MAX_FILE_SIZE_64KB 58 default 5 if MCUMGR_GRP_FS_MAX_FILE_SIZE_4GB 59 help 60 Maximal byte length of encoded offset/size, within transferred 61 CBOR frame containing chunk of downloaded file. 62 This value affects how much of data will fit into download buffer, 63 as it selects sizes of fields within headers. 64 NOTE: This option is hidden intentionally as it is intended 65 to be assigned from limited set of allowed values, depending on 66 the selection made in MCUMGR_GRP_FS_MAX_FILE_SIZE menu. 67 68config MCUMGR_GRP_FS_DL_CHUNK_SIZE_LIMIT 69 bool "Setting custom size of download file chunk" 70 help 71 By default file chunk, that will be read off storage and fit into 72 MCUmgr frame, is automatically calculated to fit into buffer 73 of size MCUGMR_TRANSPORT_NETBUF_SIZE with all headers. 74 Enabling this option allows to set MAXIMUM value that will be 75 allowed for such chunk. 76 Look inside fs_mgmt_config.h for details. 77 78if MCUMGR_GRP_FS_DL_CHUNK_SIZE_LIMIT 79 80config MCUMGR_GRP_FS_DL_CHUNK_SIZE 81 int "Maximum chunk size for file downloads" 82 range 65 MCUMGR_TRANSPORT_NETBUF_SIZE 83 default MCUMGR_TRANSPORT_NETBUF_SIZE 84 help 85 Sets the MAXIMUM size of chunk which will be rounded down to 86 number of bytes that, with all the required headers, will fit 87 into MCUMGR_TRANSPORT_NETBUF_SIZE. This means that actual value 88 might be lower then selected, in which case compiler warning will 89 be issued. Look inside fs_mgmt_config.h for details. 90 Note that header sizes are affected by MCUMGR_GRP_FS_MAX_OFFSET_LEN. 91 92endif 93 94config MCUMGR_GRP_FS_FILE_STATUS 95 bool "File status command" 96 default y 97 help 98 This command allows a remote device to retrieve the status of a file, 99 at present only the size of the file is returned (if it exists). 100 101config MCUMGR_GRP_FS_CHECKSUM_HASH 102 bool "Checksum/hash MCUmgr functions" 103 help 104 Enable this to support the hash/checksum MCUmgr functionality, 105 individual checksum and hash types need to be enabled below. 106 Note that this requires enough stack space to buffer data 107 from the file being read and generate the output hash/checksum. 108 109if MCUMGR_GRP_FS_CHECKSUM_HASH 110 111config MCUMGR_GRP_FS_CHECKSUM_HASH_CHUNK_SIZE 112 int "Checksum calculation buffer size" 113 range 32 16384 114 default 128 115 help 116 Chunk size of buffer to use when calculating file checksum or hash 117 (uses stack). 118 119config MCUMGR_GRP_FS_CHECKSUM_IEEE_CRC32 120 bool "IEEE CRC32 checksum support" 121 default y 122 help 123 Enable IEEE CRC32 checksum support for MCUmgr. 124 125config MCUMGR_GRP_FS_HASH_SHA256 126 bool "SHA256 hash support" 127 depends on TINYCRYPT_SHA256 || MBEDTLS_MAC_SHA256_ENABLED 128 help 129 Enable SHA256 hash support for MCUmgr. 130 131config MCUMGR_GRP_FS_CHECKSUM_HASH_SUPPORTED_CMD 132 bool "Supported hash/checksum command" 133 select MCUMGR_SMP_CBOR_MIN_ENCODING_LEVEL_3 if ZCBOR_CANONICAL 134 help 135 Enable the supported hash/checksum command which will return details on 136 supported hash and checksum types that can be used. 137 138config MCUMGR_GRP_FS_CHECKSUM_HASH_SUPPORTED_MAX_TYPES 139 int "Predicted maximum number of types to return on supported list" 140 default 10 141 depends on MCUMGR_GRP_FS_CHECKSUM_HASH_SUPPORTED_CMD 142 help 143 This is used for defining CBOR map holding supported hash/checksum info. 144 The value does not affect memory allocation, it is used by zcbor to 145 figure out how to encode map depending on its predicted size. 146 147endif 148 149config MCUMGR_GRP_FS_PATH_LEN 150 int "Maximum file path length" 151 default 64 152 help 153 Limits the maximum path length for file operations, in bytes. A buffer 154 of this size gets allocated on the stack during handling of file upload 155 and download commands. 156 157config MCUMGR_GRP_FS_FILE_ACCESS_HOOK 158 bool "File access hooks" 159 depends on MCUMGR_MGMT_NOTIFICATION_HOOKS 160 help 161 Allows applications to control file access (e.g. for uploading and 162 downloading of files) by registering for a callback which is then 163 triggered whenever a files are accessed using the FS management group 164 function. This also, optionally, allows re-writing or changing of 165 supplied file paths. 166 Note that this may be called multiple times for each file read and 167 write due to MCUmgr's method of operation with a single file state. 168 169config MCUMGR_GRP_FS_FILE_SEMAPHORE_TAKE_TIME 170 int "File handle semaphore take time (ms)" 171 default 100 172 help 173 Maximum time (in ms) to acquire the file handle semaphore when a file 174 upload/download command is used. If unable to acquire the semaphore, 175 then MGMT_ERR_EBUSY will be returned. 176 177 Can specify 0 to not wait for the lock and return instantly if it 178 cannot be acquired. 179 180config MCUMGR_GRP_FS_FILE_AUTOMATIC_IDLE_CLOSE_TIME 181 int "Automatic file handle close time (ms)" 182 default 4000 183 range 1 99999999 184 help 185 Time (in ms) for a file upload/download to be declared aborted and 186 file handle cleaned up. Each access to the file will reset the idle 187 time to 0. 188 189module = MCUMGR_GRP_FS 190module-str = mcumgr_grp_fs 191source "subsys/logging/Kconfig.template.log_config" 192 193endif 194