blob: 5671247671929ccd0c6fc5c39ca7e267216d17f7 [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
Andrzej Puzdrowski35f61d32022-04-01 17:00:08 +020017 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
22if MCUBOOT_SERIAL
23
24choice 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
29config BOOT_SERIAL_UART
30 bool "UART"
31 # SERIAL and UART_INTERRUPT_DRIVEN already selected
32
33config BOOT_SERIAL_CDC_ACM
34 bool "CDC ACM"
35 select USB_DEVICE_STACK
36
37endchoice
38
39config MCUBOOT_SERIAL_DIRECT_IMAGE_UPLOAD
40 bool "Allow to select image number for DFU"
41 help
42 With the option enabled, the mcuboot serial recovery will
43 respect the "image" field in mcumgr image update frame
44 header.
45 The mapping of image number to partition is as follows:
46 0 -> default behaviour, same as 1;
47 1 -> image-0 (primary slot of the first image);
48 2 -> image-1 (secondary slot of the first image);
49 3 -> image-2;
50 4 -> image-3.
51 Note that 0 is default upload target when no explicit
52 selection is done.
53
Jamie McCrae9d3fd7f2022-11-30 15:44:44 +000054config BOOT_SERIAL_UNALIGNED_BUFFER_SIZE
55 int "Stack buffer for unaligned memory writes"
56 default 64
57 help
58 Specifies the stack usage for a buffer which is used for unaligned
59 memory access when data is written to a device with memory alignment
60 requirements. Set to 0 to disable.
61
Andrzej Puzdrowski35f61d32022-04-01 17:00:08 +020062config BOOT_MAX_LINE_INPUT_LEN
Jamie McCraead1fb3d2022-12-01 14:24:37 +000063 int "Maximum input line length"
Andrzej Puzdrowski35f61d32022-04-01 17:00:08 +020064 default 512
65 help
Jamie McCraead1fb3d2022-12-01 14:24:37 +000066 Maximum length of input serial port buffer.
67
68config BOOT_SERIAL_MAX_RECEIVE_SIZE
69 int "Maximum command line length"
70 default 1024
71 help
72 Maximum length of received commands via the serial port.
Andrzej Puzdrowski35f61d32022-04-01 17:00:08 +020073
74config BOOT_SERIAL_DETECT_PORT
Andrzej Puzdrowskic5faf432022-04-09 13:34:23 +020075 string "GPIO device to trigger serial recovery mode (DEPRECATED)"
Andrzej Puzdrowski35f61d32022-04-01 17:00:08 +020076 default GPIO_0 if SOC_FAMILY_NRF
77 help
78 Zephyr GPIO device that contains the pin used to trigger
79 serial recovery mode.
80
81config BOOT_SERIAL_DETECT_PIN
Andrzej Puzdrowskic5faf432022-04-09 13:34:23 +020082 int "Pin to trigger serial recovery mode (DEPRECATED)"
Andrzej Puzdrowski35f61d32022-04-01 17:00:08 +020083 default 6 if BOARD_NRF9160DK_NRF9160
84 default 11 if BOARD_NRF52840DK_NRF52840
85 default 13 if BOARD_NRF52DK_NRF52832 || BOARD_NRF52833DK_NRF52833
86 default 23 if BOARD_NRF5340PDK_NRF5340_CPUAPP || BOARD_NRF5340PDK_NRF5340_CPUAPP_NS || \
87 BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF5340DK_NRF5340_CPUAPP_NS
Marek Pieta2fa11902022-09-13 11:31:30 +020088 default -1
Andrzej Puzdrowski35f61d32022-04-01 17:00:08 +020089 help
90 Pin on the serial detect port that triggers serial recovery mode.
91
92config BOOT_SERIAL_DETECT_PIN_VAL
Andrzej Puzdrowskic5faf432022-04-09 13:34:23 +020093 int "Serial detect pin trigger value (DEPRECATED)"
Andrzej Puzdrowski35f61d32022-04-01 17:00:08 +020094 default 0
95 range 0 1
96 help
97 Logic value of the detect pin that triggers serial recovery
98 mode.
99
100config BOOT_SERIAL_DETECT_DELAY
101 int "Serial detect pin detection delay time [ms]"
102 default 0
103 help
104 Used to prevent the bootloader from loading on button press.
105 Useful for powering on when using the same button as
106 the one used to place the device in bootloader mode.
107
108config BOOT_ERASE_PROGRESSIVELY
109 bool "Erase flash progressively when receiving new firmware"
110 default y if SOC_FAMILY_NRF
111 help
112 If enabled, flash is erased as necessary when receiving new firmware,
113 instead of erasing the whole image slot at once. This is necessary
114 on some hardware that has long erase times, to prevent long wait
115 times at the beginning of the DFU process.
116
117config BOOT_MGMT_ECHO
118 bool "Enable echo command"
119 help
120 if enabled, support for the mcumgr echo command is being added.
121
122menuconfig ENABLE_MGMT_PERUSER
123 bool "Enable system specific mcumgr commands"
124 help
125 The option enables processing of system specific mcumgr commands;
126 system specific commands are within group MGMT_GROUP_ID_PERUSER (64)
127 and above, as defined within mcumgr library.
128 These are system specific command and system specific implementation
129 function is required to process these commands.
130
131if ENABLE_MGMT_PERUSER
132config BOOT_MGMT_CUSTOM_STORAGE_ERASE
133 bool "Enable storage erase command"
134 help
135 The option enables mcumgr command that allows to erase storage
136 partition.
137 Note that the storage partition needs to be defined, in DTS, otherwise
138 enabling the option will cause a compilation to fail.
139
140config BOOT_MGMT_CUSTOM_IMG_LIST
141 bool "Enable custom image list command"
142 help
143 The option enables command which returns versions and installation
144 statuses (custom property) for all images.
145
146endif # ENABLE_MGMT_PERUSER
147
148config BOOT_SERIAL_ENCRYPT_EC256
149 bool "Support for encrypted upgrade images using ECIES-P256 in serial recovery upload"
150 default n
151 help
152 If y, uploaded images via serial recovery can be decrypted
153 on the fly when upgrading to the primary slot. The
154 encryption mechanism used in this case is ECIES using primitives
155 described under "ECIES-P256 encryption" in docs/encrypted_images.md.
156
157config BOOT_SERIAL_WAIT_FOR_DFU
158 bool "Wait for a prescribed duration to see if DFU is invoked by receiving a mcumgr comand"
Piotr Dymacz4427e4c2022-09-14 16:44:22 +0200159 depends on BOOT_SERIAL_UART || BOOT_SERIAL_CDC_ACM
Andrzej Puzdrowski35f61d32022-04-01 17:00:08 +0200160 help
161 If y, MCUboot waits for a prescribed duration of time to allow
162 for DFU to be invoked. The serial recovery can be entered by receiving any
163 mcumgr command.
164
165config BOOT_SERIAL_WAIT_FOR_DFU_TIMEOUT
166 int "Duration to wait for the serial DFU timeout in ms"
167 default 500
168 depends on BOOT_SERIAL_WAIT_FOR_DFU
169 help
170 timeout in ms for MCUboot to wait to allow for DFU to be invoked.
171
172endif # MCUBOOT_SERIAL