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