blob: dd946963614f256d30105bd5ec75d1aac1b01744 [file] [log] [blame]
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +02001# Copyright (c) 2017 Linaro Limited
2#
3# SPDX-License-Identifier: Apache-2.0
4#
5
Marti Bolivar0e091c92018-04-12 11:23:16 -04006mainmenu "MCUboot configuration"
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +02007
Marti Bolivar0e091c92018-04-12 11:23:16 -04008comment "MCUboot-specific configuration options"
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +02009
Emanuele Di Santo865777d2018-11-08 11:28:15 +010010# Hidden option to mark a project as MCUboot
11config MCUBOOT
12 default y
13 bool
Rajavardhan Gundi07ba28f2018-12-10 15:44:48 +053014 select MPU_ALLOW_FLASH_WRITE if ARM_MPU
Andrzej Puzdrowski23d3c662019-03-18 14:12:22 +010015 select USE_CODE_PARTITION if HAS_FLASH_LOAD_OFFSET
Emanuele Di Santo865777d2018-11-08 11:28:15 +010016
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040017config BOOT_USE_MBEDTLS
18 bool
19 # Hidden option
20 default n
21 help
22 Use mbedTLS for crypto primitives.
23
24config BOOT_USE_TINYCRYPT
25 bool
26 # Hidden option
27 default n
Sebastian Bøe913a3852019-01-22 13:53:12 +010028 # When building for ECDSA, we use our own copy of mbedTLS, so the
29 # Zephyr one must not be enabled or the MBEDTLS_CONFIG_FILE macros
30 # will collide.
31 depends on ! MBEDTLS
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040032 help
33 Use TinyCrypt for crypto primitives.
34
Sigvart Hovlandebd05032019-03-21 10:47:32 +010035config BOOT_USE_CC310
36 bool
37 # Hidden option
38 default n
39 # When building for ECDSA, we use our own copy of mbedTLS, so the
40 # Zephyr one must not be enabled or the MBEDTLS_CONFIG_FILE macros
41 # will collide.
42 depends on ! MBEDTLS
43 help
44 Use cc310 for crypto primitives.
45
46config BOOT_USE_NRF_CC310_BL
47 bool
48 default n
49
50config NRFXLIB_CRYPTO
51 bool
52 default n
53
54config NRF_CC310_BL
55 bool
56 default n
57
Andrzej Puzdrowski97543282018-04-12 15:16:56 +020058menu "MCUBoot settings"
59
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040060choice
61 prompt "Signature type"
62 default BOOT_SIGNATURE_TYPE_RSA
63
64config BOOT_SIGNATURE_TYPE_RSA
65 bool "RSA signatures"
66 select BOOT_USE_MBEDTLS
Marti Bolivara4818a52018-04-12 13:02:38 -040067 select MBEDTLS
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040068
Fabio Utzig105b59a2019-05-13 15:08:12 -070069if BOOT_SIGNATURE_TYPE_RSA
70config BOOT_SIGNATURE_TYPE_RSA_LEN
71 int "RSA signature length"
72 range 2048 3072
73 default 2048
74endif
75
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040076config BOOT_SIGNATURE_TYPE_ECDSA_P256
77 bool "Elliptic curve digital signatures with curve P-256"
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040078
Fabio Utzig1171df92019-05-10 19:26:38 -030079config BOOT_SIGNATURE_TYPE_ED25519
80 bool "Edwards curve digital signatures using ed25519"
81 select BOOT_USE_MBEDTLS
82 select MBEDTLS
83
Sigvart Hovlandebd05032019-03-21 10:47:32 +010084if BOOT_SIGNATURE_TYPE_ECDSA_P256
85choice
86 prompt "Ecdsa implementation"
87 default BOOT_TINYCRYPT
88config BOOT_TINYCRYPT
89 bool "Use tinycrypt"
90 select BOOT_USE_TINYCRYPT
91config BOOT_CC310
92 bool "Use CC310"
93 select BOOT_USE_NRF_CC310_BL if HAS_HW_NRF_CC310
94 select NRF_CC310_BL if HAS_HW_NRF_CC310
95 select NRFXLIB_CRYPTO if SOC_FAMILY_NRF
96 select BOOT_USE_CC310
97endchoice
98endif
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040099endchoice
100
Fabio Utzigc690c762018-04-26 10:51:09 -0300101config BOOT_SIGNATURE_KEY_FILE
102 string "PEM key file"
103 default ""
104 help
105 The key file will be parsed by imgtool's getpub command and a .c source
106 with the public key information will be written in a format expected by
107 MCUboot.
108
Marti Bolivara4818a52018-04-12 13:02:38 -0400109config MBEDTLS_CFG_FILE
110 default "mcuboot-mbedtls-cfg.h"
111
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400112config BOOT_VALIDATE_SLOT0
David Vincze2d736ad2019-02-18 11:50:22 +0100113 bool "Validate image in the primary slot on every boot"
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400114 default y
115 help
David Vincze2d736ad2019-02-18 11:50:22 +0100116 If y, the bootloader attempts to validate the signature of the
117 primary slot every boot. This adds the signature check time to
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400118 every boot, but can mitigate against some changes that are
119 able to modify the flash image itself.
120
121config BOOT_UPGRADE_ONLY
122 bool "Overwrite image updates instead of swapping"
123 default n
124 help
David Vincze2d736ad2019-02-18 11:50:22 +0100125 If y, overwrite the primary slot with the upgrade image instead
126 of swapping them. This prevents the fallback recovery, but
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400127 uses a much simpler code path.
128
Fabio Utzigc58842e2019-11-28 10:30:01 -0300129config BOOT_SWAP_USING_MOVE
130 bool "Swap mode that can run without a scratch partition [EXPERIMENTAL]"
131 default n
132 help
133 If y, the swap upgrade is done in two steps, where first every
134 sector of the primary slot is moved up one sector, then for
135 each sector X in the secondary slot, it is moved to index X in
136 the primary slot, then the sector at X+1 in the primary is
137 moved to index X in the secondary.
138 This allows a swap upgrade without using a scratch partition,
139 but is currently limited to all sectors in both slots being of
140 the same size.
141
Fabio Utzigd0533ed2018-12-19 07:56:33 -0200142config BOOT_BOOTSTRAP
Sam Bristowd0ca0ff2019-10-30 20:51:35 +1300143 bool "Bootstrap erased the primary slot from the secondary slot"
Fabio Utzigd0533ed2018-12-19 07:56:33 -0200144 default n
145 help
146 If y, enables bootstraping support. Bootstrapping allows an erased
David Vincze2d736ad2019-02-18 11:50:22 +0100147 primary slot to be initialized from a valid image in the secondary slot.
Fabio Utzigd0533ed2018-12-19 07:56:33 -0200148 If unsure, leave at the default value.
149
Fabio Utzigca8ead22019-12-20 07:06:04 -0300150config BOOT_SWAP_SAVE_ENCTLV
151 bool "Save encrypted key TLVs instead of plaintext keys in swap metadata"
152 default n
153 help
154 If y, instead of saving the encrypted image keys in plaintext in the
155 swap resume metadata, save the encrypted image TLVs. This should be used
156 when there is no security mechanism protecting the data in the primary
157 slot from being dumped. If n is selected (default), the keys are written
158 after being decrypted from the image TLVs and could be read by an
159 attacker who has access to the flash contents of the primary slot (eg
160 JTAG/SWD or primary slot in external flash).
161 If unsure, leave at the default value.
162
Fabio Utzig5fe874c2018-08-31 07:41:50 -0300163config BOOT_ENCRYPT_RSA
Fabio Utzig42cc29a2019-11-05 07:54:41 -0300164 bool "Support for encrypted upgrade images using RSA"
Fabio Utzig5fe874c2018-08-31 07:41:50 -0300165 default n
166 help
David Vincze2d736ad2019-02-18 11:50:22 +0100167 If y, images in the secondary slot can be encrypted and are decrypted
168 on the fly when upgrading to the primary slot, as well as encrypted
Fabio Utzig42cc29a2019-11-05 07:54:41 -0300169 back when swapping from the primary slot to the secondary slot. The
170 encryption mechanism used in this case is RSA-OAEP (2048 bits).
171
172config BOOT_ENCRYPT_EC256
173 bool "Support for encrypted upgrade images using ECIES-P256"
174 default n
175 help
176 If y, images in the secondary slot can be encrypted and are decrypted
177 on the fly when upgrading to the primary slot, as well as encrypted
178 back when swapping from the primary slot to the secondary slot. The
179 encryption mechanism used in this case is ECIES using primitives
180 described under "ECIES-P256 encryption" in docs/encrypted_images.md.
Fabio Utzig5fe874c2018-08-31 07:41:50 -0300181
Marti Bolivar0e091c92018-04-12 11:23:16 -0400182config BOOT_MAX_IMG_SECTORS
183 int "Maximum number of sectors per image slot"
184 default 128
185 help
186 This option controls the maximum number of sectors that each of
187 the two image areas can contain. Smaller values reduce MCUboot's
188 memory usage; larger values allow it to support larger images.
189 If unsure, leave at the default value.
190
Emanuele Di Santo205c8c62018-07-20 11:42:31 +0200191config BOOT_ERASE_PROGRESSIVELY
192 bool "Erase flash progressively when receiving new firmware"
193 default y if SOC_NRF52840
194 help
195 If enabled, flash is erased as necessary when receiving new firmware,
196 instead of erasing the whole image slot at once. This is necessary
197 on some hardware that has long erase times, to prevent long wait
198 times at the beginning of the DFU process.
199
Rajavardhan Gundi51c9d702019-02-20 14:08:52 +0530200config BOOT_WAIT_FOR_USB_DFU
201 bool "Wait for a prescribed duration to see if USB DFU is invoked"
202 default n
203 select USB
204 select USB_DFU_CLASS
205 select IMG_MANAGER
206 help
207 If y, MCUboot waits for a prescribed duration of time to allow
208 for USB DFU to be invoked. Please note DFU always updates the
209 slot1 image.
210
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400211config ZEPHYR_TRY_MASS_ERASE
212 bool "Try to mass erase flash when flashing MCUboot image"
213 default y
214 help
215 If y, attempt to configure the Zephyr build system's "flash"
216 target to mass-erase the flash device before flashing the
217 MCUboot image. This ensures the scratch and other partitions
218 are in a consistent state.
219
220 This is not available for all targets.
221
David Brownf6d14c22019-12-10 15:36:36 -0700222config BOOT_USE_BENCH
223 bool "Enable benchmark code"
224 default n
225 help
226 If y, adds support for simple benchmarking that can record
227 time intervals between two calls. The time printed depends
228 on the particular Zephyr target, and is generally ticks of a
229 specific board-specific timer.
230
Michael Scott74ceae52019-02-01 14:01:09 -0800231module = MCUBOOT
Piotr Mienkowski15aa6ef2019-04-08 22:48:15 +0200232module-str = MCUBoot bootloader
Michael Scott74ceae52019-02-01 14:01:09 -0800233source "subsys/logging/Kconfig.template.log_config"
Michael Scott74ceae52019-02-01 14:01:09 -0800234
Marti Bolivar0e091c92018-04-12 11:23:16 -0400235menuconfig MCUBOOT_SERIAL
236 bool "MCUboot serial recovery"
237 default n
238 select REBOOT
Emanuele Di Santo30a92652019-01-16 14:01:08 +0100239 select GPIO
Marti Bolivar0e091c92018-04-12 11:23:16 -0400240 select SERIAL
Emanuele Di Santo30a92652019-01-16 14:01:08 +0100241 select UART_INTERRUPT_DRIVEN
Marti Bolivar0e091c92018-04-12 11:23:16 -0400242 select BASE64
243 select TINYCBOR
244 help
245 If y, enables a serial-port based update mode. This allows
246 MCUboot itself to load update images into flash over a UART.
247 If unsure, leave at the default value.
248
249if MCUBOOT_SERIAL
250
Emanuele Di Santoc4bf7802018-07-20 11:39:57 +0200251choice
252 prompt "Serial device"
253 default BOOT_SERIAL_UART if !BOARD_NRF52840_PCA10059
254 default BOOT_SERIAL_CDC_ACM if BOARD_NRF52840_PCA10059
255
256config BOOT_SERIAL_UART
257 bool "UART"
258 # SERIAL and UART_INTERRUPT_DRIVEN already selected
259
260config BOOT_SERIAL_CDC_ACM
261 bool "CDC ACM"
262 select USB
263 select USB_DEVICE_STACK
264 select USB_CDC_ACM
265
266endchoice
267
Marti Bolivar0e091c92018-04-12 11:23:16 -0400268config BOOT_MAX_LINE_INPUT_LEN
269 int "Maximum command line length"
270 default 512
271 help
272 Maximum length of commands transported over the serial port.
273
274config BOOT_SERIAL_DETECT_PORT
275 string "GPIO device to trigger serial recovery mode"
276 default GPIO_0 if SOC_FAMILY_NRF
277 help
278 Zephyr GPIO device which contains the pin used to trigger
279 serial recovery mode.
280
281config BOOT_SERIAL_DETECT_PIN
282 int "Pin to trigger serial recovery mode"
Andreas Vibeto704b8ba2019-04-25 10:51:23 +0200283 default 6 if BOARD_NRF9160_PCA10090
Marti Bolivar0e091c92018-04-12 11:23:16 -0400284 default 11 if BOARD_NRF52840_PCA10056
285 default 13 if BOARD_NRF52_PCA10040
286 help
287 Pin on the serial detect port which triggers serial recovery mode.
288
289config BOOT_SERIAL_DETECT_PIN_VAL
290 int "Serial detect pin trigger value"
291 default 0
292 range 0 1
293 help
294 Logic value of the detect pin which triggers serial recovery
295 mode.
296
Andrzej Puzdrowskif0004802019-10-01 14:13:35 +0200297# Workaround for not being able to have commas in macro arguments
298DT_CHOSEN_Z_CONSOLE := zephyr,console
299
300config RECOVERY_UART_DEV_NAME
301 string "UART Device Name for Recovery UART"
302 default "$(dt_chosen_label,$(DT_CHOSEN_Z_CONSOLE))" if HAS_DTS
303 default "UART_0"
304 depends on BOOT_SERIAL_UART
305 help
306 This option specifies the name of UART device to be used for
307 serial recovery.
308
Marti Bolivar0e091c92018-04-12 11:23:16 -0400309endif # MCUBOOT_SERIAL
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200310
Andrzej Puzdrowski97543282018-04-12 15:16:56 +0200311endmenu
312
Carles Cufi84ede582018-01-29 15:12:00 +0100313config MCUBOOT_DEVICE_SETTINGS
314 # Hidden selector for device-specific settings
315 bool
316 default y
317 # CPU options
318 select MCUBOOT_DEVICE_CPU_CORTEX_M0 if CPU_CORTEX_M0
Carles Cufi67c792e2018-01-29 15:14:31 +0100319 # Enable flash page layout if available
320 select FLASH_PAGE_LAYOUT if FLASH_HAS_PAGE_LAYOUT
Andrzej Puzdrowskib788c712018-04-12 12:42:49 +0200321 # Enable flash_map module as flash I/O back-end
322 select FLASH_MAP
Carles Cufi84ede582018-01-29 15:12:00 +0100323
324config MCUBOOT_DEVICE_CPU_CORTEX_M0
325 # Hidden selector for Cortex-M0 settings
326 bool
327 default n
328 select SW_VECTOR_RELAY if !CPU_CORTEX_M0_HAS_VECTOR_TABLE_REMAP
329
Marti Bolivar0e091c92018-04-12 11:23:16 -0400330comment "Zephyr configuration options"
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200331
Marti Bolivarf84cc4b2019-08-20 16:06:56 -0700332# Disabling MULTITHREADING provides a code size advantage, but
333# it requires peripheral drivers (particularly a flash driver)
334# that works properly with the option enabled.
335#
336# If you know for sure that your hardware will work, you can default
337# it to n here. Otherwise, having it on by default makes the most
338# hardware work.
339config MULTITHREADING
340 default n if SOC_FAMILY_NRF
341 default y
342
Håkon Øye Amundsen954dd2b2019-09-23 09:24:13 +0000343config UPDATEABLE_IMAGE_NUMBER
344 int "Number of updateable images"
345 default 1
346 help
347 Enables support of multi image update.
348
Marti Bolivar0e091c92018-04-12 11:23:16 -0400349source "$ZEPHYR_BASE/Kconfig.zephyr"