1# Copyright (c) 2017-2020 Linaro Limited 2# Copyright (c) 2020 Arm Limited 3# Copyright (c) 2017-2023 Nordic Semiconductor ASA 4# 5# SPDX-License-Identifier: Apache-2.0 6 7menuconfig MCUBOOT_SERIAL 8 bool "MCUboot serial recovery" 9 default n 10 select REBOOT 11 select SERIAL 12 select UART_INTERRUPT_DRIVEN 13 select BASE64 14 select CRC 15 select ZCBOR 16 help 17 If y, enables a serial-port based update mode. This allows 18 MCUboot itself to load update images into flash over a UART. 19 If unsure, leave at the default value. 20 21if MCUBOOT_SERIAL 22 23choice BOOT_SERIAL_DEVICE 24 prompt "Serial device" 25 default BOOT_SERIAL_UART if !BOARD_NRF52840DONGLE_NRF52840 26 default BOOT_SERIAL_CDC_ACM if BOARD_NRF52840DONGLE_NRF52840 27 28config BOOT_SERIAL_UART 29 bool "UART" 30 # SERIAL and UART_INTERRUPT_DRIVEN already selected 31 help 32 The serial device to use will be fist selected via chosen 33 node "zephyr,uart-mcumgr", when such node does not exist 34 the "zephyr,console" is used. In case when 35 the "zephyr,uart-mcumgr" points to the same device as 36 the "zephyr,console" compilation error will be triggered. 37 38config BOOT_SERIAL_CDC_ACM 39 bool "CDC ACM" 40 select USB_DEVICE_STACK 41 help 42 This setting will choose CDC ACM for serial recovery unless chosen 43 "zephyr,uart-mcumgr" is present, in which case the chosen takes 44 precedence and redirects serial recovery to uart pointed by 45 the chosen, leaving console on CDC ACM. 46 47endchoice 48 49config MCUBOOT_SERIAL_DIRECT_IMAGE_UPLOAD 50 bool "Allow to select image number for DFU" 51 help 52 With the option enabled, the mcuboot serial recovery will 53 respect the "image" field in mcumgr image update frame 54 header. 55 The mapping of image number to partition is as follows: 56 0 -> default behaviour, same as 1; 57 1 -> image-0 (primary slot of the first image); 58 2 -> image-1 (secondary slot of the first image); 59 3 -> image-2; 60 4 -> image-3. 61 Note that 0 is default upload target when no explicit 62 selection is done. 63 64config BOOT_SERIAL_UNALIGNED_BUFFER_SIZE 65 int "Stack buffer for unaligned memory writes" 66 default 64 67 range 0 128 68 help 69 Specifies the stack usage for a buffer which is used for unaligned 70 memory access when data is written to a device with memory alignment 71 requirements. Set to 0 to disable. 72 73config BOOT_MAX_LINE_INPUT_LEN 74 int "Maximum input line length" 75 default 128 76 help 77 Maximum length of input serial port buffer (SMP serial transport uses 78 fragments of 128-bytes, this should not need to be changed unless a 79 different value is used for the transport). 80 81config BOOT_LINE_BUFS 82 int "Number of receive buffers" 83 range 2 128 84 default 8 85 help 86 Number of receive buffers for data received via the serial port. 87 88config BOOT_SERIAL_MAX_RECEIVE_SIZE 89 int "Maximum command line length" 90 default 1024 91 help 92 Maximum length of received commands via the serial port (this should 93 be equal to the maximum line length, BOOT_MAX_LINE_INPUT_LEN times 94 by the number of receive buffers, BOOT_LINE_BUFS to allow for 95 optimal data transfer speeds). 96 97config BOOT_ERASE_PROGRESSIVELY 98 bool "Erase flash progressively when receiving new firmware" 99 default y if SOC_FAMILY_NRF 100 help 101 If enabled, flash is erased as necessary when receiving new firmware, 102 instead of erasing the whole image slot at once. This is necessary 103 on some hardware that has long erase times, to prevent long wait 104 times at the beginning of the DFU process. 105 106config BOOT_MGMT_ECHO 107 bool "Enable echo command" 108 help 109 if enabled, support for the mcumgr echo command is being added. 110 111menuconfig ENABLE_MGMT_PERUSER 112 bool "Enable system specific mcumgr commands" 113 help 114 The option enables processing of system specific mcumgr commands; 115 system specific commands are within group MGMT_GROUP_ID_PERUSER (64) 116 and above, as defined within mcumgr library. 117 These are system specific command and system specific implementation 118 function is required to process these commands. 119 120if ENABLE_MGMT_PERUSER 121 122config BOOT_MGMT_CUSTOM_STORAGE_ERASE 123 bool "Enable storage erase command" 124 help 125 The option enables mcumgr command that allows to erase storage 126 partition. 127 Note that the storage partition needs to be defined, in DTS, otherwise 128 enabling the option will cause a compilation to fail. 129 130config BOOT_MGMT_CUSTOM_IMG_LIST 131 bool "Enable custom image list command" 132 help 133 The option enables command which returns versions and installation 134 statuses (custom property) for all images. 135 136endif # ENABLE_MGMT_PERUSER 137 138config BOOT_SERIAL_ENCRYPT_EC256 139 bool "Support for encrypted upgrade images using ECIES-P256 in serial recovery upload" 140 default n 141 help 142 If y, uploaded images via serial recovery can be decrypted 143 on the fly when upgrading to the primary slot. The 144 encryption mechanism used in this case is ECIES using primitives 145 described under "ECIES-P256 encryption" in docs/encrypted_images.md. 146 147menu "Entrance methods" 148 149menuconfig BOOT_SERIAL_ENTRANCE_GPIO 150 bool "GPIO" 151 default y 152 depends on GPIO 153 help 154 Use a GPIO to enter serial recovery mode. 155 156config BOOT_SERIAL_DETECT_DELAY 157 int "Serial detect pin detection delay time [ms]" 158 default 0 159 depends on BOOT_SERIAL_ENTRANCE_GPIO 160 help 161 Used to prevent the bootloader from loading on button press. 162 Useful for powering on when using the same button as 163 the one used to place the device in bootloader mode. 164 165menuconfig BOOT_SERIAL_WAIT_FOR_DFU 166 bool "Wait a prescribed duration to see if DFU is invoked by receiving a MCUmgr comand" 167 depends on BOOT_SERIAL_UART || BOOT_SERIAL_CDC_ACM 168 help 169 If y, MCUboot waits for a prescribed duration of time to allow 170 for DFU to be invoked. The serial recovery can be entered by receiving any 171 mcumgr command. 172 173config BOOT_SERIAL_WAIT_FOR_DFU_TIMEOUT 174 int "Duration to wait for the serial DFU timeout in ms" 175 default 500 176 depends on BOOT_SERIAL_WAIT_FOR_DFU 177 help 178 Timeout in ms for MCUboot to wait to allow for DFU to be invoked. 179 180config BOOT_SERIAL_BOOT_MODE 181 bool "Check boot mode via retention subsystem" 182 depends on RETENTION_BOOT_MODE 183 help 184 Allows for entering serial recovery mode by using Zephyr's boot mode 185 retention system (i.e. an application must set the boot mode to stay 186 in serial recovery mode and reboot the module). 187 188config BOOT_SERIAL_NO_APPLICATION 189 bool "Stay in bootloader if no application" 190 help 191 Allows for entering serial recovery mode if there is no bootable 192 application that the bootloader can jump to. 193 194config BOOT_SERIAL_PIN_RESET 195 bool "Check for device reset by pin" 196 select HWINFO 197 help 198 Checks if the module reset was caused by the reset pin and will 199 remain in bootloader serial recovery mode if it was. 200 201endmenu 202 203config BOOT_SERIAL_IMG_GRP_HASH 204 bool "Image list hash support" 205 default y 206 help 207 If y, image list responses will include the image hash (adds ~100 208 bytes of flash). 209 210config BOOT_SERIAL_IMG_GRP_IMAGE_STATE 211 bool "Image state support" 212 depends on !SINGLE_APPLICATION_SLOT 213 select BOOT_SERIAL_IMG_GRP_HASH if UPDATEABLE_IMAGE_NUMBER > 1 214 help 215 If y, image states will be included with image lists and the set 216 state command can be used to mark an image as test/confirmed. 217 218endif # MCUBOOT_SERIAL 219