blob: d5c0101efe9b5b667a0ce58f1d36c6d09a35155a [file] [log] [blame]
Andrzej Puzdrowski35f61d32022-04-01 17:00:08 +02001# 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
8menuconfig 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 Ermele009e192022-11-21 13:01:29 +000016 select CRC
Jamie McCraedc8ef872023-03-10 11:45:32 +000017 select ZCBOR
Andrzej Puzdrowski35f61d32022-04-01 17:00:08 +020018 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
23if MCUBOOT_SERIAL
24
25choice 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
30config BOOT_SERIAL_UART
31 bool "UART"
32 # SERIAL and UART_INTERRUPT_DRIVEN already selected
Dominik Ermel1090d8f2021-09-22 08:37:28 +000033 help
34 The serial device to use will be fist selected via chosen
35 node "zephyr,uart-mcumgr", when such node does not exist
36 the "zephyr,console" is used. In case when
37 the "zephyr,uart-mcumgr" points to the same device as
38 the "zephyr,console" compilation error will be triggered.
Andrzej Puzdrowski35f61d32022-04-01 17:00:08 +020039
40config BOOT_SERIAL_CDC_ACM
41 bool "CDC ACM"
42 select USB_DEVICE_STACK
Dominik Ermel1090d8f2021-09-22 08:37:28 +000043 help
44 This setting will choose CDC ACM for serial recovery unless chosen
45 "zephyr,uart-mcumgr" is present, in which case the chosen takes
46 precedence and redirects serial recovery to uart pointed by
47 the chosen, leaving console on CDC ACM.
Andrzej Puzdrowski35f61d32022-04-01 17:00:08 +020048
49endchoice
50
51config MCUBOOT_SERIAL_DIRECT_IMAGE_UPLOAD
52 bool "Allow to select image number for DFU"
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 McCrae9d3fd7f2022-11-30 15:44:44 +000066config BOOT_SERIAL_UNALIGNED_BUFFER_SIZE
67 int "Stack buffer for unaligned memory writes"
68 default 64
Jamie McCraeb56a65f2023-02-17 08:47:12 +000069 range 0 128
Jamie McCrae9d3fd7f2022-11-30 15:44:44 +000070 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 Puzdrowski35f61d32022-04-01 17:00:08 +020075config BOOT_MAX_LINE_INPUT_LEN
Jamie McCraead1fb3d2022-12-01 14:24:37 +000076 int "Maximum input line length"
Jamie McCraeaee388a2023-02-17 09:03:50 +000077 default 128
Andrzej Puzdrowski35f61d32022-04-01 17:00:08 +020078 help
Jamie McCraeaee388a2023-02-17 09:03:50 +000079 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
83config 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 McCraead1fb3d2022-12-01 14:24:37 +000089
90config BOOT_SERIAL_MAX_RECEIVE_SIZE
91 int "Maximum command line length"
92 default 1024
93 help
Jamie McCraeaee388a2023-02-17 09:03:50 +000094 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 McCraecde36392023-02-17 08:44:38 +000098
Andrzej Puzdrowski35f61d32022-04-01 17:00:08 +020099config BOOT_SERIAL_DETECT_DELAY
100 int "Serial detect pin detection delay time [ms]"
101 default 0
102 help
103 Used to prevent the bootloader from loading on button press.
104 Useful for powering on when using the same button as
105 the one used to place the device in bootloader mode.
106
107config BOOT_ERASE_PROGRESSIVELY
108 bool "Erase flash progressively when receiving new firmware"
109 default y if SOC_FAMILY_NRF
110 help
111 If enabled, flash is erased as necessary when receiving new firmware,
112 instead of erasing the whole image slot at once. This is necessary
113 on some hardware that has long erase times, to prevent long wait
114 times at the beginning of the DFU process.
115
116config BOOT_MGMT_ECHO
117 bool "Enable echo command"
118 help
119 if enabled, support for the mcumgr echo command is being added.
120
121menuconfig ENABLE_MGMT_PERUSER
122 bool "Enable system specific mcumgr commands"
123 help
124 The option enables processing of system specific mcumgr commands;
125 system specific commands are within group MGMT_GROUP_ID_PERUSER (64)
126 and above, as defined within mcumgr library.
127 These are system specific command and system specific implementation
128 function is required to process these commands.
129
130if ENABLE_MGMT_PERUSER
131config BOOT_MGMT_CUSTOM_STORAGE_ERASE
132 bool "Enable storage erase command"
133 help
134 The option enables mcumgr command that allows to erase storage
135 partition.
136 Note that the storage partition needs to be defined, in DTS, otherwise
137 enabling the option will cause a compilation to fail.
138
139config BOOT_MGMT_CUSTOM_IMG_LIST
140 bool "Enable custom image list command"
141 help
142 The option enables command which returns versions and installation
143 statuses (custom property) for all images.
144
145endif # ENABLE_MGMT_PERUSER
146
147config BOOT_SERIAL_ENCRYPT_EC256
148 bool "Support for encrypted upgrade images using ECIES-P256 in serial recovery upload"
149 default n
150 help
151 If y, uploaded images via serial recovery can be decrypted
152 on the fly when upgrading to the primary slot. The
153 encryption mechanism used in this case is ECIES using primitives
154 described under "ECIES-P256 encryption" in docs/encrypted_images.md.
155
156config BOOT_SERIAL_WAIT_FOR_DFU
157 bool "Wait for a prescribed duration to see if DFU is invoked by receiving a mcumgr comand"
Piotr Dymacz4427e4c2022-09-14 16:44:22 +0200158 depends on BOOT_SERIAL_UART || BOOT_SERIAL_CDC_ACM
Andrzej Puzdrowski35f61d32022-04-01 17:00:08 +0200159 help
160 If y, MCUboot waits for a prescribed duration of time to allow
161 for DFU to be invoked. The serial recovery can be entered by receiving any
162 mcumgr command.
163
164config BOOT_SERIAL_WAIT_FOR_DFU_TIMEOUT
165 int "Duration to wait for the serial DFU timeout in ms"
166 default 500
167 depends on BOOT_SERIAL_WAIT_FOR_DFU
168 help
169 timeout in ms for MCUboot to wait to allow for DFU to be invoked.
170
Jamie McCrae827118f2023-03-10 13:24:57 +0000171config BOOT_SERIAL_IMG_GRP_HASH
172 bool "Image list hash support"
173 default y
174 help
175 If y, image list responses will include the image hash (adds ~100
176 bytes of flash).
177
Andrzej Puzdrowski35f61d32022-04-01 17:00:08 +0200178endif # MCUBOOT_SERIAL