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