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 Application Image 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_IMG_ -- 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_IMG 16 bool "Mcumgr handlers for image management" 17 depends on FLASH 18 depends on IMG_MANAGER 19 depends on !MCUBOOT_BOOTLOADER_MODE_SINGLE_APP 20 select MPU_ALLOW_FLASH_WRITE if ARM_MPU 21 select MCUMGR_SMP_CBOR_MIN_DECODING_LEVEL_2 22 select MCUMGR_SMP_CBOR_MIN_ENCODING_LEVEL_3 if ZCBOR_CANONICAL 23 help 24 Enables MCUmgr handlers for image management 25 26if MCUMGR_GRP_IMG 27 28if HEAP_MEM_POOL_SIZE > 0 29 30config MCUMGR_GRP_IMG_USE_HEAP_FOR_FLASH_IMG_CONTEXT 31 bool "Use heap mem pool for flash image DFU context" 32 help 33 Use heap to allocate flash image upload context, otherwise a static variable will 34 be used. The context object is used by MCUMGR_GRP_IMG_MANAGER to buffer image writes 35 and has significant size, mainly affected by image write buffer of 36 the CONFIG_IMG_BLOCK_BUF_SIZE size and additional fields that hold the state information 37 (struct flash_img_context). 38 When the option is not enabled it increases static RAM use. 39 Make sure with testing, when enabling the option, that the heap has enough size 40 to allocate this context or it will not be possible to perform DFU; it may also not be 41 possible to allocate such context when heap is under pressure, due to application 42 operation, an issue that should also be addressed within application. 43 44endif 45 46config MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER 47 int "Number of supported images" 48 default UPDATEABLE_IMAGE_NUMBER 49 range 1 3 50 help 51 Sets how many application images are supported (pairs of secondary and primary slots). 52 Setting this to 2 requires MCUMGR_TRANSPORT_NETBUF_SIZE to be at least 512b. 53 NOTE: The UPDATEABLE_IMAGE_NUMBER of MCUBOOT configuration, even for Zephyr build, 54 needs to be set to the same value; this is due to the fact that the MCUmgr uses 55 boot_util and the UPDATEABLE_IMAGE_NUMBER controls number of images supported 56 by that library. 57 58config MCUMGR_GRP_IMG_VERBOSE_ERR 59 bool "Verbose error responses when uploading application image" 60 select MCUMGR_SMP_VERBOSE_ERR_RESPONSE 61 help 62 Add additional "rsn" key to SMP responses, where provided, explaining 63 non-0 "rc" codes. 64 65config MCUMGR_GRP_IMG_ALLOW_CONFIRM_NON_ACTIVE_IMAGE_SECONDARY 66 bool "Allow to confirm secondary slot of non-active image" 67 default y 68 help 69 Allows to confirm secondary (non-active) slot of non-active image. 70 Normally it should not be allowed to confirm any slots of non-active 71 image, via MCUmgr commands, to prevent confirming something that is 72 broken and may not boot in other slot; instead application should 73 have means to test and confirm the image. 74 75config MCUMGR_GRP_IMG_ALLOW_CONFIRM_NON_ACTIVE_IMAGE_ANY 76 bool "Allow to confirm slots of non-active image" 77 select MCUMGR_GRP_IMG_ALLOW_CONFIRM_NON_ACTIVE_IMAGE_SECONDARY 78 help 79 Allows to confirm any slot of non-active image. 80 Normally it should not be allowed to confirm any slots of non-active 81 image, via MCUmgr commands, to prevent confirming something that is 82 broken and may not boot in other slot; instead application should 83 have means to test and confirm the image. 84 85if !MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP 86config MCUMGR_GRP_IMG_ALLOW_ERASE_PENDING 87 bool "Allow to erase pending slot" 88 help 89 Allows erasing secondary slot which is marked for test or confirmed; this allows 90 erasing slots that have been set for next boot but the device has not 91 reset yet, so has not yet been swapped. 92endif 93 94config MCUMGR_GRP_IMG_DIRECT_UPLOAD 95 bool "Allow direct image upload" 96 help 97 Enables directly uploading image to selected image partition. 98 This changes how "image" is understood by MCUmgr: normally MCUmgr allows uploading to 99 the first slot of the only image it knows, where image is understood as two slots 100 (two DTS images for Zephyr); this allows to treat every DTS defined image as direct 101 target for upload, and more than two may be used (4 at this time). 102 NOTE: When direct upload is used the image numbers are shifted by + 1, and the default 103 behaviour is, when image is not selected, to upload to image that represents secondary 104 slot in normal operation. 105 106config MCUMGR_GRP_IMG_REJECT_DIRECT_XIP_MISMATCHED_SLOT 107 bool "Reject Direct-XIP applications with mismatched address" 108 help 109 When enabled, the MCUmgr will compare base address of application, 110 encoded into .bin file header with use of imgtool, on upload and will 111 reject binaries that would not be able to start from available 112 Direct-XIP address. 113 The base address can be set, to an image binary header, with imgtool, 114 using the --rom-fixed command line option. 115 116config MCUMGR_GRP_IMG_FRUGAL_LIST 117 bool "Omit zero, empty or false values from status list" 118 help 119 The status list send back from the device will only be filled with data that is non-zero, 120 non-empty or true. This option slightly reduces number of bytes transferred back from 121 a device but requires support in client software, which has to default omitted values. 122 Works correctly with the go mcumgr-cli application. 123 124config MCUMGR_GRP_IMG_VERSION_CMP_USE_BUILD_NUMBER 125 bool "Use build number while comparing image version" 126 help 127 By default, the image version comparison relies only on version major, 128 minor and revision. Enable this option to take into account the build 129 number as well. 130 131config MCUMGR_GRP_IMG_UPLOAD_CHECK_HOOK 132 bool "Upload check hook" 133 depends on MCUMGR_MGMT_NOTIFICATION_HOOKS 134 help 135 This will enable the upload check hook which will send image upload requests to 136 registered callbacks to check with the user application if an upload should be accepted 137 or rejected. 138 139config MCUMGR_GRP_IMG_STATUS_HOOKS 140 bool "Status hooks" 141 depends on MCUMGR_MGMT_NOTIFICATION_HOOKS 142 help 143 This will enable DFU status hooks which can be checked by the application to monitor DFU 144 uploads. Note that these are status checking only, to allow inspecting of a file upload 145 or prevent it, CONFIG_MCUMGR_GRP_IMG_UPLOAD_CHECK_HOOK must be used. 146 147config MCUMGR_GRP_IMG_MUTEX 148 bool "Mutex locking" 149 help 150 This will enable use of a mutex to lock the image group object access, preventing issues 151 of concurrent thread (i.e. multiple transport) access. This option also makes the 152 ``img_mgmt_reset_upload()`` function visible in the image management group header, which 153 can be used by applications to reset the image management state (useful if there are 154 multiple ways that firmware updates can be loaded). 155 156module = MCUMGR_GRP_IMG 157module-str = mcumgr_grp_img 158source "subsys/logging/Kconfig.template.log_config" 159 160endif 161