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 |
| 3 | # Copyright (c) 2017-2022 Nordic Semiconductor ASA |
| 4 | # |
| 5 | # SPDX-License-Identifier: Apache-2.0 |
| 6 | |
| 7 | |
| 8 | menuconfig MCUBOOT_SERIAL |
| 9 | bool "MCUboot serial recovery" |
| 10 | default n |
| 11 | select REBOOT |
| 12 | select GPIO |
| 13 | select SERIAL |
| 14 | select UART_INTERRUPT_DRIVEN |
| 15 | select BASE64 |
Dominik Ermel | e009e19 | 2022-11-21 13:01:29 +0000 | [diff] [blame] | 16 | select CRC |
Jamie McCrae | dc8ef87 | 2023-03-10 11:45:32 +0000 | [diff] [blame^] | 17 | select ZCBOR |
Andrzej Puzdrowski | 35f61d3 | 2022-04-01 17:00:08 +0200 | [diff] [blame] | 18 | help |
| 19 | If y, enables a serial-port based update mode. This allows |
| 20 | MCUboot itself to load update images into flash over a UART. |
| 21 | If unsure, leave at the default value. |
| 22 | |
| 23 | if MCUBOOT_SERIAL |
| 24 | |
| 25 | choice BOOT_SERIAL_DEVICE |
| 26 | prompt "Serial device" |
| 27 | default BOOT_SERIAL_UART if !BOARD_NRF52840DONGLE_NRF52840 |
| 28 | default BOOT_SERIAL_CDC_ACM if BOARD_NRF52840DONGLE_NRF52840 |
| 29 | |
| 30 | config BOOT_SERIAL_UART |
| 31 | bool "UART" |
| 32 | # SERIAL and UART_INTERRUPT_DRIVEN already selected |
| 33 | |
| 34 | config BOOT_SERIAL_CDC_ACM |
| 35 | bool "CDC ACM" |
| 36 | select USB_DEVICE_STACK |
| 37 | |
| 38 | endchoice |
| 39 | |
| 40 | config MCUBOOT_SERIAL_DIRECT_IMAGE_UPLOAD |
| 41 | bool "Allow to select image number for DFU" |
| 42 | help |
| 43 | With the option enabled, the mcuboot serial recovery will |
| 44 | respect the "image" field in mcumgr image update frame |
| 45 | header. |
| 46 | The mapping of image number to partition is as follows: |
| 47 | 0 -> default behaviour, same as 1; |
| 48 | 1 -> image-0 (primary slot of the first image); |
| 49 | 2 -> image-1 (secondary slot of the first image); |
| 50 | 3 -> image-2; |
| 51 | 4 -> image-3. |
| 52 | Note that 0 is default upload target when no explicit |
| 53 | selection is done. |
| 54 | |
Jamie McCrae | 9d3fd7f | 2022-11-30 15:44:44 +0000 | [diff] [blame] | 55 | config BOOT_SERIAL_UNALIGNED_BUFFER_SIZE |
| 56 | int "Stack buffer for unaligned memory writes" |
| 57 | default 64 |
Jamie McCrae | b56a65f | 2023-02-17 08:47:12 +0000 | [diff] [blame] | 58 | range 0 128 |
Jamie McCrae | 9d3fd7f | 2022-11-30 15:44:44 +0000 | [diff] [blame] | 59 | help |
| 60 | Specifies the stack usage for a buffer which is used for unaligned |
| 61 | memory access when data is written to a device with memory alignment |
| 62 | requirements. Set to 0 to disable. |
| 63 | |
Andrzej Puzdrowski | 35f61d3 | 2022-04-01 17:00:08 +0200 | [diff] [blame] | 64 | config BOOT_MAX_LINE_INPUT_LEN |
Jamie McCrae | ad1fb3d | 2022-12-01 14:24:37 +0000 | [diff] [blame] | 65 | int "Maximum input line length" |
Jamie McCrae | aee388a | 2023-02-17 09:03:50 +0000 | [diff] [blame] | 66 | default 128 |
Andrzej Puzdrowski | 35f61d3 | 2022-04-01 17:00:08 +0200 | [diff] [blame] | 67 | help |
Jamie McCrae | aee388a | 2023-02-17 09:03:50 +0000 | [diff] [blame] | 68 | Maximum length of input serial port buffer (SMP serial transport uses |
| 69 | fragments of 128-bytes, this should not need to be changed unless a |
| 70 | different value is used for the transport). |
| 71 | |
| 72 | config BOOT_LINE_BUFS |
| 73 | int "Number of receive buffers" |
| 74 | range 2 128 |
| 75 | default 8 |
| 76 | help |
| 77 | Number of receive buffers for data received via the serial port. |
Jamie McCrae | ad1fb3d | 2022-12-01 14:24:37 +0000 | [diff] [blame] | 78 | |
| 79 | config BOOT_SERIAL_MAX_RECEIVE_SIZE |
| 80 | int "Maximum command line length" |
| 81 | default 1024 |
| 82 | help |
Jamie McCrae | aee388a | 2023-02-17 09:03:50 +0000 | [diff] [blame] | 83 | Maximum length of received commands via the serial port (this should |
| 84 | be equal to the maximum line length, BOOT_MAX_LINE_INPUT_LEN times |
| 85 | by the number of receive buffers, BOOT_LINE_BUFS to allow for |
| 86 | optimal data transfer speeds). |
Jamie McCrae | cde3639 | 2023-02-17 08:44:38 +0000 | [diff] [blame] | 87 | |
Andrzej Puzdrowski | 35f61d3 | 2022-04-01 17:00:08 +0200 | [diff] [blame] | 88 | config BOOT_SERIAL_DETECT_PORT |
Andrzej Puzdrowski | c5faf43 | 2022-04-09 13:34:23 +0200 | [diff] [blame] | 89 | string "GPIO device to trigger serial recovery mode (DEPRECATED)" |
Andrzej Puzdrowski | 35f61d3 | 2022-04-01 17:00:08 +0200 | [diff] [blame] | 90 | default GPIO_0 if SOC_FAMILY_NRF |
| 91 | help |
| 92 | Zephyr GPIO device that contains the pin used to trigger |
| 93 | serial recovery mode. |
| 94 | |
| 95 | config BOOT_SERIAL_DETECT_PIN |
Andrzej Puzdrowski | c5faf43 | 2022-04-09 13:34:23 +0200 | [diff] [blame] | 96 | int "Pin to trigger serial recovery mode (DEPRECATED)" |
Andrzej Puzdrowski | 35f61d3 | 2022-04-01 17:00:08 +0200 | [diff] [blame] | 97 | default 6 if BOARD_NRF9160DK_NRF9160 |
| 98 | default 11 if BOARD_NRF52840DK_NRF52840 |
| 99 | default 13 if BOARD_NRF52DK_NRF52832 || BOARD_NRF52833DK_NRF52833 |
| 100 | default 23 if BOARD_NRF5340PDK_NRF5340_CPUAPP || BOARD_NRF5340PDK_NRF5340_CPUAPP_NS || \ |
| 101 | BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF5340DK_NRF5340_CPUAPP_NS |
Marek Pieta | 2fa1190 | 2022-09-13 11:31:30 +0200 | [diff] [blame] | 102 | default -1 |
Andrzej Puzdrowski | 35f61d3 | 2022-04-01 17:00:08 +0200 | [diff] [blame] | 103 | help |
| 104 | Pin on the serial detect port that triggers serial recovery mode. |
| 105 | |
| 106 | config BOOT_SERIAL_DETECT_PIN_VAL |
Andrzej Puzdrowski | c5faf43 | 2022-04-09 13:34:23 +0200 | [diff] [blame] | 107 | int "Serial detect pin trigger value (DEPRECATED)" |
Andrzej Puzdrowski | 35f61d3 | 2022-04-01 17:00:08 +0200 | [diff] [blame] | 108 | default 0 |
| 109 | range 0 1 |
| 110 | help |
| 111 | Logic value of the detect pin that triggers serial recovery |
| 112 | mode. |
| 113 | |
| 114 | config BOOT_SERIAL_DETECT_DELAY |
| 115 | int "Serial detect pin detection delay time [ms]" |
| 116 | default 0 |
| 117 | help |
| 118 | Used to prevent the bootloader from loading on button press. |
| 119 | Useful for powering on when using the same button as |
| 120 | the one used to place the device in bootloader mode. |
| 121 | |
| 122 | config BOOT_ERASE_PROGRESSIVELY |
| 123 | bool "Erase flash progressively when receiving new firmware" |
| 124 | default y if SOC_FAMILY_NRF |
| 125 | help |
| 126 | If enabled, flash is erased as necessary when receiving new firmware, |
| 127 | instead of erasing the whole image slot at once. This is necessary |
| 128 | on some hardware that has long erase times, to prevent long wait |
| 129 | times at the beginning of the DFU process. |
| 130 | |
| 131 | config BOOT_MGMT_ECHO |
| 132 | bool "Enable echo command" |
| 133 | help |
| 134 | if enabled, support for the mcumgr echo command is being added. |
| 135 | |
| 136 | menuconfig ENABLE_MGMT_PERUSER |
| 137 | bool "Enable system specific mcumgr commands" |
| 138 | help |
| 139 | The option enables processing of system specific mcumgr commands; |
| 140 | system specific commands are within group MGMT_GROUP_ID_PERUSER (64) |
| 141 | and above, as defined within mcumgr library. |
| 142 | These are system specific command and system specific implementation |
| 143 | function is required to process these commands. |
| 144 | |
| 145 | if ENABLE_MGMT_PERUSER |
| 146 | config BOOT_MGMT_CUSTOM_STORAGE_ERASE |
| 147 | bool "Enable storage erase command" |
| 148 | help |
| 149 | The option enables mcumgr command that allows to erase storage |
| 150 | partition. |
| 151 | Note that the storage partition needs to be defined, in DTS, otherwise |
| 152 | enabling the option will cause a compilation to fail. |
| 153 | |
| 154 | config BOOT_MGMT_CUSTOM_IMG_LIST |
| 155 | bool "Enable custom image list command" |
| 156 | help |
| 157 | The option enables command which returns versions and installation |
| 158 | statuses (custom property) for all images. |
| 159 | |
| 160 | endif # ENABLE_MGMT_PERUSER |
| 161 | |
| 162 | config BOOT_SERIAL_ENCRYPT_EC256 |
| 163 | bool "Support for encrypted upgrade images using ECIES-P256 in serial recovery upload" |
| 164 | default n |
| 165 | help |
| 166 | If y, uploaded images via serial recovery can be decrypted |
| 167 | on the fly when upgrading to the primary slot. The |
| 168 | encryption mechanism used in this case is ECIES using primitives |
| 169 | described under "ECIES-P256 encryption" in docs/encrypted_images.md. |
| 170 | |
| 171 | config BOOT_SERIAL_WAIT_FOR_DFU |
| 172 | bool "Wait for 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] | 173 | depends on BOOT_SERIAL_UART || BOOT_SERIAL_CDC_ACM |
Andrzej Puzdrowski | 35f61d3 | 2022-04-01 17:00:08 +0200 | [diff] [blame] | 174 | help |
| 175 | If y, MCUboot waits for a prescribed duration of time to allow |
| 176 | for DFU to be invoked. The serial recovery can be entered by receiving any |
| 177 | mcumgr command. |
| 178 | |
| 179 | config BOOT_SERIAL_WAIT_FOR_DFU_TIMEOUT |
| 180 | int "Duration to wait for the serial DFU timeout in ms" |
| 181 | default 500 |
| 182 | depends on BOOT_SERIAL_WAIT_FOR_DFU |
| 183 | help |
| 184 | timeout in ms for MCUboot to wait to allow for DFU to be invoked. |
| 185 | |
| 186 | endif # MCUBOOT_SERIAL |