blob: 1d16b0348994c65c4e7d98e8361fb048e6d00224 [file] [log] [blame]
David Vincze03368b82020-04-01 12:53:53 +02001# Copyright (c) 2017-2020 Linaro Limited
David Vinczec3084132020-02-18 14:50:47 +01002# Copyright (c) 2020 Arm Limited
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +02003#
4# SPDX-License-Identifier: Apache-2.0
5#
6
Marti Bolivar0e091c92018-04-12 11:23:16 -04007mainmenu "MCUboot configuration"
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +02008
Marti Bolivar0e091c92018-04-12 11:23:16 -04009comment "MCUboot-specific configuration options"
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +020010
Emanuele Di Santo865777d2018-11-08 11:28:15 +010011# Hidden option to mark a project as MCUboot
12config MCUBOOT
13 default y
14 bool
Rajavardhan Gundi07ba28f2018-12-10 15:44:48 +053015 select MPU_ALLOW_FLASH_WRITE if ARM_MPU
Marcin Niestrojc6be76a2020-03-22 14:39:35 +010016 select USE_DT_CODE_PARTITION if HAS_FLASH_LOAD_OFFSET
Andrzej Puzdrowskif573b392020-11-10 14:35:15 +010017 select MCUBOOT_BOOTUTIL_LIB
Emanuele Di Santo865777d2018-11-08 11:28:15 +010018
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040019config BOOT_USE_MBEDTLS
20 bool
21 # Hidden option
22 default n
23 help
24 Use mbedTLS for crypto primitives.
25
26config BOOT_USE_TINYCRYPT
27 bool
28 # Hidden option
29 default n
Sebastian Bøe913a3852019-01-22 13:53:12 +010030 # When building for ECDSA, we use our own copy of mbedTLS, so the
31 # Zephyr one must not be enabled or the MBEDTLS_CONFIG_FILE macros
32 # will collide.
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040033 help
34 Use TinyCrypt for crypto primitives.
35
Sigvart Hovlandebd05032019-03-21 10:47:32 +010036config BOOT_USE_CC310
37 bool
38 # Hidden option
39 default n
40 # When building for ECDSA, we use our own copy of mbedTLS, so the
41 # Zephyr one must not be enabled or the MBEDTLS_CONFIG_FILE macros
42 # will collide.
Sigvart Hovlandebd05032019-03-21 10:47:32 +010043 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
Andrzej Puzdrowskifdff3e12020-09-15 08:23:25 +020060config SINGLE_APPLICATION_SLOT
61 bool "Single slot bootloader"
Dominik Ermel4dc3f442020-05-26 08:45:14 +000062 default n
63 help
64 Single image area is used for application which means that
65 uploading a new application overwrites the one that previously
66 occupied the area.
67
Håkon Øye Amundsen21f03762021-11-12 08:21:31 +000068choice BOOT_SIGNATURE_TYPE
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040069 prompt "Signature type"
70 default BOOT_SIGNATURE_TYPE_RSA
71
Arvin Farahmandfb5ec182020-05-05 11:44:12 -040072config BOOT_SIGNATURE_TYPE_NONE
73 bool "No signature; use only hash check"
74 select BOOT_USE_TINYCRYPT
75
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040076config BOOT_SIGNATURE_TYPE_RSA
77 bool "RSA signatures"
78 select BOOT_USE_MBEDTLS
Marti Bolivara4818a52018-04-12 13:02:38 -040079 select MBEDTLS
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040080
Fabio Utzig105b59a2019-05-13 15:08:12 -070081if BOOT_SIGNATURE_TYPE_RSA
82config BOOT_SIGNATURE_TYPE_RSA_LEN
83 int "RSA signature length"
84 range 2048 3072
85 default 2048
86endif
87
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040088config BOOT_SIGNATURE_TYPE_ECDSA_P256
89 bool "Elliptic curve digital signatures with curve P-256"
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040090
Sigvart Hovlandebd05032019-03-21 10:47:32 +010091if BOOT_SIGNATURE_TYPE_ECDSA_P256
Håkon Øye Amundsen21f03762021-11-12 08:21:31 +000092choice BOOT_ECDSA_IMPLEMENTATION
Sigvart Hovlandebd05032019-03-21 10:47:32 +010093 prompt "Ecdsa implementation"
Fabio Utzig34e93a52020-02-03 09:59:53 -030094 default BOOT_ECDSA_TINYCRYPT
Håkon Øye Amundsenee7282d2020-09-28 09:48:29 +000095
Fabio Utzig34e93a52020-02-03 09:59:53 -030096config BOOT_ECDSA_TINYCRYPT
Sigvart Hovlandebd05032019-03-21 10:47:32 +010097 bool "Use tinycrypt"
98 select BOOT_USE_TINYCRYPT
Håkon Øye Amundsenee7282d2020-09-28 09:48:29 +000099
100config BOOT_ECDSA_CC310
Sigvart Hovlandebd05032019-03-21 10:47:32 +0100101 bool "Use CC310"
Håkon Øye Amundsenee7282d2020-09-28 09:48:29 +0000102 depends on HAS_HW_NRF_CC310
103 select BOOT_USE_NRF_CC310_BL
104 select NRF_CC310_BL
105 select NRFXLIB_CRYPTO
Sigvart Hovlandebd05032019-03-21 10:47:32 +0100106 select BOOT_USE_CC310
Håkon Øye Amundsenee7282d2020-09-28 09:48:29 +0000107endchoice # Ecdsa implementation
Sigvart Hovlandebd05032019-03-21 10:47:32 +0100108endif
Fabio Utzig34e93a52020-02-03 09:59:53 -0300109
110config BOOT_SIGNATURE_TYPE_ED25519
111 bool "Edwards curve digital signatures using ed25519"
112
113if BOOT_SIGNATURE_TYPE_ED25519
Håkon Øye Amundsen21f03762021-11-12 08:21:31 +0000114choice BOOT_ED25519_IMPLEMENTATION
Fabio Utzig34e93a52020-02-03 09:59:53 -0300115 prompt "Ecdsa implementation"
116 default BOOT_ED25519_TINYCRYPT
117config BOOT_ED25519_TINYCRYPT
118 bool "Use tinycrypt"
119 select BOOT_USE_TINYCRYPT
120config BOOT_ED25519_MBEDTLS
121 bool "Use mbedTLS"
122 select BOOT_USE_MBEDTLS
123 select MBEDTLS
124endchoice
125endif
126
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400127endchoice
128
Fabio Utzigc690c762018-04-26 10:51:09 -0300129config BOOT_SIGNATURE_KEY_FILE
130 string "PEM key file"
Håkon Øye Amundsen705c6c22020-09-28 09:45:40 +0000131 default "root-ec-p256.pem" if BOOT_SIGNATURE_TYPE_ECDSA_P256
132 default "root-ed25519.pem" if BOOT_SIGNATURE_TYPE_ED25519
133 default "root-rsa-3072.pem" if BOOT_SIGNATURE_TYPE_RSA && BOOT_SIGNATURE_TYPE_RSA_LEN=3072
134 default "root-rsa-2048.pem" if BOOT_SIGNATURE_TYPE_RSA && BOOT_SIGNATURE_TYPE_RSA_LEN=2048
Fabio Utzigc690c762018-04-26 10:51:09 -0300135 default ""
136 help
Marek Pietabdcfc852020-08-04 02:22:55 -0700137 You can use either absolute or relative path.
138 In case relative path is used, the build system assumes that it starts
139 from the directory where the MCUBoot KConfig configuration file is
140 located. If the key file is not there, the build system uses relative
141 path that starts from the MCUBoot repository root directory.
Fabio Utzigc690c762018-04-26 10:51:09 -0300142 The key file will be parsed by imgtool's getpub command and a .c source
143 with the public key information will be written in a format expected by
144 MCUboot.
145
Andrzej Puzdrowski9a605b62020-03-16 13:34:30 +0100146config MCUBOOT_CLEANUP_ARM_CORE
147 bool "Perform core cleanup before chain-load the application"
148 depends on CPU_CORTEX_M
Ioannis Glaropoulos518d93a2020-10-22 14:22:14 +0200149 default y if !ARCH_SUPPORTS_ARCH_HW_INIT
150 help
151 This option instructs MCUboot to perform a clean-up of a set of
152 architecture core HW registers before junping to the application
153 firmware. The clean-up sets these registers to their warm-reset
154 values as specified by the architecture.
155
156 By default, this option is enabled only if the architecture does
157 not have the functionality to perform such a register clean-up
158 during application firmware boot.
159
160 Zephyr applications on Cortex-M will perform this register clean-up
161 by default, if they are chain-loadable by MCUboot, so MCUboot does
162 not need to perform such a cleanup itself.
Andrzej Puzdrowski9a605b62020-03-16 13:34:30 +0100163
Marti Bolivara4818a52018-04-12 13:02:38 -0400164config MBEDTLS_CFG_FILE
165 default "mcuboot-mbedtls-cfg.h"
166
David Vincze03368b82020-04-01 12:53:53 +0200167config BOOT_HW_KEY
168 bool "Use HW key for image verification"
169 default n
170 help
171 Use HW key for image verification, otherwise the public key is embedded
172 in MCUBoot. If enabled the public key is appended to the signed image
173 and requires the hash of the public key to be provisioned to the device
174 beforehand.
175
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400176config BOOT_VALIDATE_SLOT0
David Vincze2d736ad2019-02-18 11:50:22 +0100177 bool "Validate image in the primary slot on every boot"
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400178 default y
179 help
David Vincze2d736ad2019-02-18 11:50:22 +0100180 If y, the bootloader attempts to validate the signature of the
181 primary slot every boot. This adds the signature check time to
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400182 every boot, but can mitigate against some changes that are
183 able to modify the flash image itself.
184
Andrzej Puzdrowskifdff3e12020-09-15 08:23:25 +0200185if !SINGLE_APPLICATION_SLOT
Håkon Øye Amundsen21f03762021-11-12 08:21:31 +0000186choice BOOT_IMAGE_UPGRADE_MODE
David Vincze5a6e1812020-06-29 13:34:42 +0200187 prompt "Image upgrade modes"
188 default BOOT_SWAP_USING_MOVE if SOC_FAMILY_NRF
189 default BOOT_SWAP_USING_SCRATCH
190
191config BOOT_SWAP_USING_SCRATCH
192 bool "Swap mode that run with the scratch partition"
193 help
194 This is the most conservative swap mode but it can work even on
195 devices with heterogeneous flash page layout.
196
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400197config BOOT_UPGRADE_ONLY
198 bool "Overwrite image updates instead of swapping"
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400199 help
David Vincze2d736ad2019-02-18 11:50:22 +0100200 If y, overwrite the primary slot with the upgrade image instead
201 of swapping them. This prevents the fallback recovery, but
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400202 uses a much simpler code path.
203
Fabio Utzigc58842e2019-11-28 10:30:01 -0300204config BOOT_SWAP_USING_MOVE
Fabio Utzigdd2b6802020-01-06 09:10:45 -0300205 bool "Swap mode that can run without a scratch partition"
Fabio Utzigc58842e2019-11-28 10:30:01 -0300206 help
207 If y, the swap upgrade is done in two steps, where first every
208 sector of the primary slot is moved up one sector, then for
209 each sector X in the secondary slot, it is moved to index X in
210 the primary slot, then the sector at X+1 in the primary is
211 moved to index X in the secondary.
212 This allows a swap upgrade without using a scratch partition,
213 but is currently limited to all sectors in both slots being of
214 the same size.
David Vincze5a6e1812020-06-29 13:34:42 +0200215
216config BOOT_DIRECT_XIP
217 bool "Run the latest image directly from its slot"
218 help
219 If y, mcuboot selects the newest valid image based on the image version
220 numbers, thereafter the selected image can run directly from its slot
221 without having to move/copy it into the primary slot. For this reason the
222 images must be linked to be executed from the given image slot. Using this
223 mode results in a simpler code path and smaller code size.
224
225endchoice
Fabio Utzigc58842e2019-11-28 10:30:01 -0300226
David Vincze505fba22020-10-22 13:53:29 +0200227config BOOT_DIRECT_XIP_REVERT
228 bool "Enable the revert mechanism in direct-xip mode"
Andrzej Puzdrowski32342e72020-11-18 17:04:44 +0100229 depends on BOOT_DIRECT_XIP
David Vincze505fba22020-10-22 13:53:29 +0200230 default n
231 help
232 If y, enables the revert mechanism in direct-xip similar to the one in
233 swap mode. It requires the trailer magic to be added to the signed image.
234 When a reboot happens without the image being confirmed at runtime, the
235 bootloader considers the image faulty and erases it. After this it will
236 attempt to boot the previous image. The images can also be made permanent
237 (marked as confirmed in advance) just like in swap mode.
238
Fabio Utzigd0533ed2018-12-19 07:56:33 -0200239config BOOT_BOOTSTRAP
Sam Bristowd0ca0ff2019-10-30 20:51:35 +1300240 bool "Bootstrap erased the primary slot from the secondary slot"
Fabio Utzigd0533ed2018-12-19 07:56:33 -0200241 default n
242 help
243 If y, enables bootstraping support. Bootstrapping allows an erased
David Vincze2d736ad2019-02-18 11:50:22 +0100244 primary slot to be initialized from a valid image in the secondary slot.
Fabio Utzigd0533ed2018-12-19 07:56:33 -0200245 If unsure, leave at the default value.
246
Fabio Utzigca8ead22019-12-20 07:06:04 -0300247config BOOT_SWAP_SAVE_ENCTLV
248 bool "Save encrypted key TLVs instead of plaintext keys in swap metadata"
249 default n
250 help
251 If y, instead of saving the encrypted image keys in plaintext in the
252 swap resume metadata, save the encrypted image TLVs. This should be used
253 when there is no security mechanism protecting the data in the primary
254 slot from being dumped. If n is selected (default), the keys are written
255 after being decrypted from the image TLVs and could be read by an
256 attacker who has access to the flash contents of the primary slot (eg
257 JTAG/SWD or primary slot in external flash).
258 If unsure, leave at the default value.
259
Håkon Øye Amundsene829e9d2021-11-12 14:01:01 +0000260config BOOT_ENCRYPT_IMAGE
261 bool
262 help
263 Hidden option used to check if any image encryption is enabled.
264
Fabio Utzig5fe874c2018-08-31 07:41:50 -0300265config BOOT_ENCRYPT_RSA
Fabio Utzig42cc29a2019-11-05 07:54:41 -0300266 bool "Support for encrypted upgrade images using RSA"
Håkon Øye Amundsene829e9d2021-11-12 14:01:01 +0000267 select BOOT_ENCRYPT_IMAGE
Fabio Utzig5fe874c2018-08-31 07:41:50 -0300268 help
David Vincze2d736ad2019-02-18 11:50:22 +0100269 If y, images in the secondary slot can be encrypted and are decrypted
270 on the fly when upgrading to the primary slot, as well as encrypted
Fabio Utzig42cc29a2019-11-05 07:54:41 -0300271 back when swapping from the primary slot to the secondary slot. The
272 encryption mechanism used in this case is RSA-OAEP (2048 bits).
273
274config BOOT_ENCRYPT_EC256
275 bool "Support for encrypted upgrade images using ECIES-P256"
Håkon Øye Amundsene829e9d2021-11-12 14:01:01 +0000276 select BOOT_ENCRYPT_IMAGE
Fabio Utzig42cc29a2019-11-05 07:54:41 -0300277 help
278 If y, images in the secondary slot can be encrypted and are decrypted
279 on the fly when upgrading to the primary slot, as well as encrypted
280 back when swapping from the primary slot to the secondary slot. The
281 encryption mechanism used in this case is ECIES using primitives
282 described under "ECIES-P256 encryption" in docs/encrypted_images.md.
Fabio Utzig5fe874c2018-08-31 07:41:50 -0300283
Fabio Utzigb6f014c2020-04-02 13:25:01 -0300284config BOOT_ENCRYPT_X25519
285 bool "Support for encrypted upgrade images using ECIES-X25519"
Håkon Øye Amundsene829e9d2021-11-12 14:01:01 +0000286 select BOOT_ENCRYPT_IMAGE
Fabio Utzigb6f014c2020-04-02 13:25:01 -0300287 help
288 If y, images in the secondary slot can be encrypted and are decrypted
289 on the fly when upgrading to the primary slot, as well as encrypted
290 back when swapping from the primary slot to the secondary slot. The
291 encryption mechanism used in this case is ECIES using primitives
292 described under "ECIES-X25519 encryption" in docs/encrypted_images.md.
David Vincze505fba22020-10-22 13:53:29 +0200293endif # !SINGLE_APPLICATION_SLOT
Fabio Utzigb6f014c2020-04-02 13:25:01 -0300294
Wouter Cappelle953a7612021-05-03 16:53:05 +0200295config BOOT_ENCRYPTION_KEY_FILE
296 string "encryption key file"
297 depends on BOOT_ENCRYPT_EC256 || BOOT_SERIAL_ENCRYPT_EC256
298 default "enc-ec256-priv.pem" if BOOT_SIGNATURE_TYPE_ECDSA_P256
299 default ""
300 help
301 You can use either absolute or relative path.
302 In case relative path is used, the build system assumes that it starts
303 from the directory where the MCUBoot KConfig configuration file is
304 located. If the key file is not there, the build system uses relative
305 path that starts from the MCUBoot repository root directory.
306 The key file will be parsed by imgtool's getpriv command and a .c source
307 with the public key information will be written in a format expected by
308 MCUboot.
309
Marti Bolivar0e091c92018-04-12 11:23:16 -0400310config BOOT_MAX_IMG_SECTORS
311 int "Maximum number of sectors per image slot"
312 default 128
313 help
314 This option controls the maximum number of sectors that each of
315 the two image areas can contain. Smaller values reduce MCUboot's
316 memory usage; larger values allow it to support larger images.
317 If unsure, leave at the default value.
318
David Vincze1cf11b52020-03-24 07:51:09 +0100319config MEASURED_BOOT
320 bool "Store the boot state/measurements in shared memory"
321 default n
322 help
323 If enabled, the bootloader will store certain boot measurements such as
324 the hash of the firmware image in a shared memory area. This data can
325 be used later by runtime services (e.g. by a device attestation service).
326
327config BOOT_SHARE_DATA
328 bool "Save application specific data in shared memory area"
329 default n
330
Håkon Øye Amundsen21f03762021-11-12 08:21:31 +0000331choice BOOT_FAULT_INJECTION_HARDENING_PROFILE
Tamas Banfce87332020-07-10 12:40:11 +0100332 prompt "Fault injection hardening profile"
333 default BOOT_FIH_PROFILE_OFF
334
335config BOOT_FIH_PROFILE_OFF
336 bool "No hardening against hardware level fault injection"
337 help
338 No hardening in SW against hardware level fault injection: power or
339 clock glitching, etc.
340
341config BOOT_FIH_PROFILE_LOW
342 bool "Moderate level hardening against hardware level fault injection"
343 help
344 Moderate level hardening: Long global fail loop to avoid break out,
345 control flow integrity check to discover discrepancy in expected code
346 flow.
347
348config BOOT_FIH_PROFILE_MEDIUM
349 bool "Medium level hardening against hardware level fault injection"
350 help
351 Medium level hardening: Long global fail loop to avoid break out,
352 control flow integrity check to discover discrepancy in expected code
353 flow, double variables to discover register or memory corruption.
354
355config BOOT_FIH_PROFILE_HIGH
356 bool "Maximum level hardening against hardware level fault injection"
357 select MBEDTLS
358 help
359 Maximum level hardening: Long global fail loop to avoid break out,
360 control flow integrity check to discover discrepancy in expected code
361 flow, double variables to discover register or memory corruption, random
362 delays to make code execution less predictable. Random delays requires an
363 entropy source.
364
365endchoice
366
Josh Gao837cf882020-11-13 18:51:27 -0800367choice BOOT_USB_DFU
368 prompt "USB DFU"
369 default BOOT_USB_DFU_NO
370
371config BOOT_USB_DFU_NO
372 prompt "Disabled"
373
374config BOOT_USB_DFU_WAIT
Rajavardhan Gundi51c9d702019-02-20 14:08:52 +0530375 bool "Wait for a prescribed duration to see if USB DFU is invoked"
Johann Fischer25852972021-08-02 13:20:09 +0200376 select USB_DEVICE_STACK
Rajavardhan Gundi51c9d702019-02-20 14:08:52 +0530377 select USB_DFU_CLASS
378 select IMG_MANAGER
379 help
380 If y, MCUboot waits for a prescribed duration of time to allow
381 for USB DFU to be invoked. Please note DFU always updates the
382 slot1 image.
383
Josh Gao837cf882020-11-13 18:51:27 -0800384config BOOT_USB_DFU_GPIO
385 bool "Use GPIO to detect whether to trigger DFU mode"
Johann Fischer25852972021-08-02 13:20:09 +0200386 select USB_DEVICE_STACK
Josh Gao837cf882020-11-13 18:51:27 -0800387 select USB_DFU_CLASS
388 select IMG_MANAGER
389 help
390 If y, MCUboot uses GPIO to detect whether to invoke USB DFU.
391
392endchoice
393
394config BOOT_USB_DFU_WAIT_DELAY_MS
395 int "USB DFU wait duration"
396 depends on BOOT_USB_DFU_WAIT
397 default 12000
398 help
399 Milliseconds to wait for USB DFU to be invoked.
400
401if BOOT_USB_DFU_GPIO
402
403config BOOT_USB_DFU_DETECT_PORT
404 string "GPIO device to trigger USB DFU mode"
405 default GPIO_0 if SOC_FAMILY_NRF
406 help
407 Zephyr GPIO device that contains the pin used to trigger
408 USB DFU.
409
410config BOOT_USB_DFU_DETECT_PIN
411 int "Pin to trigger USB DFU mode"
412 default 6 if BOARD_NRF9160DK_NRF9160
413 default 11 if BOARD_NRF52840DK_NRF52840
414 default 13 if BOARD_NRF52DK_NRF52832
Martí Bolívar994816d2021-07-28 12:16:06 -0700415 default 23 if BOARD_NRF5340_DK_NRF5340_CPUAPP || BOARD_NRF5340_DK_NRF5340_CPUAPP_NS
416 default 43 if BOARD_BL5340_DVK_CPUAPP || BOARD_BL5340_DVK_CPUAPP_NS
Josh Gao837cf882020-11-13 18:51:27 -0800417 help
418 Pin on the DFU detect port that triggers DFU mode.
419
420config BOOT_USB_DFU_DETECT_PIN_VAL
421 int "USB DFU detect pin trigger value"
422 default 0
423 range 0 1
424 help
425 Logic value of the detect pin that triggers USB DFU mode.
426
427config BOOT_USB_DFU_DETECT_DELAY
428 int "Serial detect pin detection delay time [ms]"
429 default 0
430 help
431 Used to prevent the bootloader from loading on button press.
432 Useful for powering on when using the same button as
433 the one used to place the device in bootloader mode.
434
435endif # BOOT_USB_DFU_GPIO
436
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400437config ZEPHYR_TRY_MASS_ERASE
438 bool "Try to mass erase flash when flashing MCUboot image"
439 default y
440 help
441 If y, attempt to configure the Zephyr build system's "flash"
442 target to mass-erase the flash device before flashing the
443 MCUboot image. This ensures the scratch and other partitions
444 are in a consistent state.
445
446 This is not available for all targets.
447
David Brownf6d14c22019-12-10 15:36:36 -0700448config BOOT_USE_BENCH
449 bool "Enable benchmark code"
450 default n
451 help
452 If y, adds support for simple benchmarking that can record
453 time intervals between two calls. The time printed depends
454 on the particular Zephyr target, and is generally ticks of a
455 specific board-specific timer.
456
Michael Scott74ceae52019-02-01 14:01:09 -0800457module = MCUBOOT
Piotr Mienkowski15aa6ef2019-04-08 22:48:15 +0200458module-str = MCUBoot bootloader
Michael Scott74ceae52019-02-01 14:01:09 -0800459source "subsys/logging/Kconfig.template.log_config"
Michael Scott74ceae52019-02-01 14:01:09 -0800460
Andrzej Puzdrowskiaf148532020-02-25 12:51:26 +0100461config MCUBOOT_LOG_THREAD_STACK_SIZE
462 int "Stack size for the MCUBoot log processing thread"
463 depends on LOG && !LOG_IMMEDIATE
464 default 2048 if COVERAGE_GCOV
465 default 1024 if NO_OPTIMIZATIONS
466 default 1024 if XTENSA
467 default 4096 if (X86 && X86_64)
468 default 4096 if ARM64
469 default 768
470 help
471 Set the internal stack size for MCUBoot log processing thread.
472
Marti Bolivar0e091c92018-04-12 11:23:16 -0400473menuconfig MCUBOOT_SERIAL
474 bool "MCUboot serial recovery"
475 default n
476 select REBOOT
Emanuele Di Santo30a92652019-01-16 14:01:08 +0100477 select GPIO
Marti Bolivar0e091c92018-04-12 11:23:16 -0400478 select SERIAL
Emanuele Di Santo30a92652019-01-16 14:01:08 +0100479 select UART_INTERRUPT_DRIVEN
Marti Bolivar0e091c92018-04-12 11:23:16 -0400480 select BASE64
Marti Bolivar0e091c92018-04-12 11:23:16 -0400481 help
482 If y, enables a serial-port based update mode. This allows
483 MCUboot itself to load update images into flash over a UART.
484 If unsure, leave at the default value.
485
486if MCUBOOT_SERIAL
487
Håkon Øye Amundsen21f03762021-11-12 08:21:31 +0000488choice BOOT_SERIAL_DEVICE
Emanuele Di Santoc4bf7802018-07-20 11:39:57 +0200489 prompt "Serial device"
Andrzej Puzdrowskif4a9a9d2020-04-24 12:31:51 +0200490 default BOOT_SERIAL_UART if !BOARD_NRF52840DONGLE_NRF52840
491 default BOOT_SERIAL_CDC_ACM if BOARD_NRF52840DONGLE_NRF52840
Emanuele Di Santoc4bf7802018-07-20 11:39:57 +0200492
493config BOOT_SERIAL_UART
494 bool "UART"
495 # SERIAL and UART_INTERRUPT_DRIVEN already selected
496
497config BOOT_SERIAL_CDC_ACM
498 bool "CDC ACM"
Emanuele Di Santoc4bf7802018-07-20 11:39:57 +0200499 select USB_DEVICE_STACK
Emanuele Di Santoc4bf7802018-07-20 11:39:57 +0200500
501endchoice
502
Dominik Ermel6c8932e2021-07-09 10:28:40 +0000503config MCUBOOT_SERIAL_DIRECT_IMAGE_UPLOAD
504 bool "Allow to select image number for DFU"
505 help
506 With the option enabled, the mcuboot serial recovery will
507 respect the "image" field in mcumgr image update frame
508 header.
509 The mapping of image number to partition is as follows:
510 0 -> default behaviour, same as 1;
511 1 -> image-0 (primary slot of the first image);
512 2 -> image-1 (secondary slot of the first image);
513 3 -> image-2;
514 4 -> image-3.
515 Note that 0 is default upload target when no explicit
516 selection is done.
517
Jared Wolff8e4d7912021-01-21 19:34:05 -0500518config MCUBOOT_INDICATION_LED
519 bool "Turns on LED indication when device is in DFU"
520 default n
521 help
522 Device device activates the LED while in bootloader mode.
523 bootloader-led0 alias must be set in the device's .dts
524 definitions for this to work.
525
Marti Bolivar0e091c92018-04-12 11:23:16 -0400526config BOOT_MAX_LINE_INPUT_LEN
527 int "Maximum command line length"
528 default 512
529 help
530 Maximum length of commands transported over the serial port.
531
532config BOOT_SERIAL_DETECT_PORT
533 string "GPIO device to trigger serial recovery mode"
534 default GPIO_0 if SOC_FAMILY_NRF
535 help
Josh Gao837cf882020-11-13 18:51:27 -0800536 Zephyr GPIO device that contains the pin used to trigger
Marti Bolivar0e091c92018-04-12 11:23:16 -0400537 serial recovery mode.
538
539config BOOT_SERIAL_DETECT_PIN
540 int "Pin to trigger serial recovery mode"
Andrzej Puzdrowskif4a9a9d2020-04-24 12:31:51 +0200541 default 6 if BOARD_NRF9160DK_NRF9160
Andrzej Puzdrowskifefdea22020-03-27 09:41:14 +0100542 default 11 if BOARD_NRF52840DK_NRF52840
Håkon Øye Amundsenf04aa542021-04-13 09:47:40 +0200543 default 13 if BOARD_NRF52DK_NRF52832 || BOARD_NRF52833DK_NRF52833
Martí Bolívar994816d2021-07-28 12:16:06 -0700544 default 23 if BOARD_NRF5340PDK_NRF5340_CPUAPP || BOARD_NRF5340PDK_NRF5340_CPUAPP_NS || \
545 BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF5340DK_NRF5340_CPUAPP_NS
Marti Bolivar0e091c92018-04-12 11:23:16 -0400546 help
Josh Gao837cf882020-11-13 18:51:27 -0800547 Pin on the serial detect port that triggers serial recovery mode.
Marti Bolivar0e091c92018-04-12 11:23:16 -0400548
549config BOOT_SERIAL_DETECT_PIN_VAL
550 int "Serial detect pin trigger value"
551 default 0
552 range 0 1
553 help
Josh Gao837cf882020-11-13 18:51:27 -0800554 Logic value of the detect pin that triggers serial recovery
Marti Bolivar0e091c92018-04-12 11:23:16 -0400555 mode.
556
Jared Wolff8e4d7912021-01-21 19:34:05 -0500557config BOOT_SERIAL_DETECT_DELAY
Jared Wolffdf8e9742021-02-04 11:17:00 -0500558 int "Serial detect pin detection delay time [ms]"
Jared Wolff8e4d7912021-01-21 19:34:05 -0500559 default 0
560 help
561 Used to prevent the bootloader from loading on button press.
562 Useful for powering on when using the same button as
563 the one used to place the device in bootloader mode.
564
Dominik Ermel2ae1f162021-07-09 10:59:23 +0000565config BOOT_ERASE_PROGRESSIVELY
566 bool "Erase flash progressively when receiving new firmware"
567 default y if SOC_FAMILY_NRF
568 help
569 If enabled, flash is erased as necessary when receiving new firmware,
570 instead of erasing the whole image slot at once. This is necessary
571 on some hardware that has long erase times, to prevent long wait
572 times at the beginning of the DFU process.
573
Andrzej Puzdrowski420ad9a2021-07-29 16:22:52 +0200574menuconfig ENABLE_MGMT_PERUSER
Dominik Ermel97b4c792021-06-25 17:32:38 +0000575 bool "Enable system specific mcumgr commands"
Dominik Ermel3d51e432021-06-25 17:29:50 +0000576 help
577 The option enables processing of system specific mcumgr commands;
578 system specific commands are within group MGMT_GROUP_ID_PERUSER (64)
579 and above, as defined within mcumgr library.
580 These are system specific command and system specific implementation
581 function is required to process these commands.
582
Andrzej Puzdrowski420ad9a2021-07-29 16:22:52 +0200583if ENABLE_MGMT_PERUSER
Dominik Ermel0435d5d2021-08-16 15:58:15 +0000584config BOOT_MGMT_CUSTOM_STORAGE_ERASE
585 bool "Enable storage erase command"
586 help
587 The option enables mcumgr command that allows to erase storage
588 partition.
589 Note that the storage partition needs to be defined, in DTS, otherwise
590 enabling the option will cause a compilation to fail.
591
Andrzej Puzdrowski420ad9a2021-07-29 16:22:52 +0200592config BOOT_MGMT_CUSTOM_IMG_LIST
593 bool "Enable custom image list command"
594 help
595 The option enables command which returns versions and installation
596 statuses (custom property) for all images.
597
598endif # ENABLE_MGMT_PERUSER
Wouter Cappelle953a7612021-05-03 16:53:05 +0200599
600config BOOT_SERIAL_ENCRYPT_EC256
601 bool "Support for encrypted upgrade images using ECIES-P256 in serial recovery upload"
602 default n
603 help
604 If y, uploaded images via serial recovery can be decrypted
605 on the fly when upgrading to the primary slot. The
606 encryption mechanism used in this case is ECIES using primitives
607 described under "ECIES-P256 encryption" in docs/encrypted_images.md.
608
Marti Bolivar0e091c92018-04-12 11:23:16 -0400609endif # MCUBOOT_SERIAL
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200610
Rafał Kuźniad854bb62020-06-17 15:06:47 +0200611config BOOT_INTR_VEC_RELOC
612 bool "Relocate the interrupt vector to the application"
613 default n
614 depends on SW_VECTOR_RELAY || CPU_CORTEX_M_HAS_VTOR
615 help
616 Relocate the interrupt vector to the application before it is started.
617 Select this option if application requires vector relocation,
618 but it doesn't relocate vector in its reset handler.
619
Andrzej Puzdrowski16b6d152020-06-01 14:16:54 +0200620config UPDATEABLE_IMAGE_NUMBER
621 int "Number of updateable images"
622 default 1
Andrzej Puzdrowskifdff3e12020-09-15 08:23:25 +0200623 range 1 1 if SINGLE_APPLICATION_SLOT
Andrzej Puzdrowski16b6d152020-06-01 14:16:54 +0200624 help
625 Enables support of multi image update.
626
Håkon Øye Amundsen21f03762021-11-12 08:21:31 +0000627choice BOOT_DOWNGRADE_PREVENTION_CHOICE
Andrzej Puzdrowski16b6d152020-06-01 14:16:54 +0200628 prompt "Downgrade prevention"
629 optional
630
631config MCUBOOT_DOWNGRADE_PREVENTION
632 bool "SW based downgrade prevention"
633 depends on BOOT_UPGRADE_ONLY
634 help
635 Prevent downgrades by enforcing incrementing version numbers.
636 When this option is set, any upgrade must have greater major version
637 or greater minor version with equal major version. This mechanism
638 only protects against some attacks against version downgrades (for
639 example, a JTAG could be used to write an older version).
640
641config MCUBOOT_HW_DOWNGRADE_PREVENTION
642 bool "HW based downgrade prevention"
643 help
644 Prevent undesirable/malicious software downgrades. When this option is
645 set, any upgrade must have greater or equal security counter value.
646 Because of the acceptance of equal values it allows for software
647 downgrade to some extent.
648
649endchoice
650
Andrzej Puzdrowskid21442a2020-10-12 16:47:28 +0200651config BOOT_WATCHDOG_FEED
652 bool "Feed the watchdog while doing swap"
653 default y if SOC_FAMILY_NRF
654 imply NRFX_WDT
655 imply NRFX_WDT0
656 imply NRFX_WDT1
657 help
658 Enables implementation of MCUBOOT_WATCHDOG_FEED() macro which is
659 used to feed watchdog while doing time consuming operations.
660
Andrzej Puzdrowski914204d2021-07-09 19:20:46 +0200661config BOOT_IMAGE_ACCESS_HOOKS
662 bool "Enable hooks for overriding MCUboot's native routines"
663 help
664 Allow to provide procedures for override or extend native
665 MCUboot's routines required for access the image data and the image
666 update.
667
668config BOOT_IMAGE_ACCESS_HOOKS_FILE
669 string "Hooks implementation file path"
670 depends on BOOT_IMAGE_ACCESS_HOOKS
671 help
672 Path to the file which implements hooks.
673 You can use either absolute or relative path.
674 In case relative path is used, the build system assumes that it starts
675 from the directory where the MCUBoot KConfig configuration file is
676 located. If the key file is not there, the build system uses relative
677 path that starts from the zephyr port cmake directory (boot/zephyr/).
678
Andrzej Puzdrowski97543282018-04-12 15:16:56 +0200679endmenu
680
Carles Cufi84ede582018-01-29 15:12:00 +0100681config MCUBOOT_DEVICE_SETTINGS
682 # Hidden selector for device-specific settings
683 bool
684 default y
685 # CPU options
686 select MCUBOOT_DEVICE_CPU_CORTEX_M0 if CPU_CORTEX_M0
Carles Cufi67c792e2018-01-29 15:14:31 +0100687 # Enable flash page layout if available
688 select FLASH_PAGE_LAYOUT if FLASH_HAS_PAGE_LAYOUT
Andrzej Puzdrowskib788c712018-04-12 12:42:49 +0200689 # Enable flash_map module as flash I/O back-end
690 select FLASH_MAP
Carles Cufi84ede582018-01-29 15:12:00 +0100691
692config MCUBOOT_DEVICE_CPU_CORTEX_M0
693 # Hidden selector for Cortex-M0 settings
694 bool
695 default n
696 select SW_VECTOR_RELAY if !CPU_CORTEX_M0_HAS_VECTOR_TABLE_REMAP
697
Marti Bolivar0e091c92018-04-12 11:23:16 -0400698comment "Zephyr configuration options"
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200699
Marti Bolivarf84cc4b2019-08-20 16:06:56 -0700700# Disabling MULTITHREADING provides a code size advantage, but
701# it requires peripheral drivers (particularly a flash driver)
702# that works properly with the option enabled.
703#
704# If you know for sure that your hardware will work, you can default
705# it to n here. Otherwise, having it on by default makes the most
706# hardware work.
707config MULTITHREADING
Andrzej Puzdrowski9a4946c2020-02-20 12:39:12 +0100708 default y if BOOT_SERIAL_CDC_ACM #usb driver requires MULTITHREADING
Josh Gao837cf882020-11-13 18:51:27 -0800709 default y if BOOT_USB_DFU_GPIO || BOOT_USB_DFU_WAIT
Marti Bolivarf84cc4b2019-08-20 16:06:56 -0700710 default n if SOC_FAMILY_NRF
711 default y
712
Andrzej Puzdrowski3f092bd2020-02-17 13:25:32 +0100713config LOG_PROCESS_THREAD
714 default n # mcuboot has its own log processing thread
715
716# override USB device name
717config USB_DEVICE_PRODUCT
718 default "MCUBOOT"
Andrzej Puzdrowski9a4946c2020-02-20 12:39:12 +0100719
Andrzej Puzdrowskif573b392020-11-10 14:35:15 +0100720# use MCUboot's own log configuration
721config MCUBOOT_BOOTUTIL_LIB_OWN_LOG
722 bool
723 default n
724
Håkon Øye Amundsene829e9d2021-11-12 14:01:01 +0000725config MCUBOOT_VERIFY_IMG_ADDRESS
726 bool "Verify reset address of image in secondary slot"
727 depends on UPDATEABLE_IMAGE_NUMBER > 1
728 depends on !BOOT_ENCRYPT_IMAGE
729 depends on ARM
730 default y if BOOT_UPGRADE_ONLY
731 help
732 Verify that the reset address in the image located in the secondary slot
733 is contained within the corresponding primary slot. This is recommended
734 if swapping is not used (that is, BOOT_UPGRADE_ONLY is set). If a user
735 incorrectly uploads an update for image 1 to image 0's secondary slot
736 MCUboot will overwrite image 0's primary slot with this image even
737 though it will not boot. If swapping is enabled this will be handled
738 since the image will not confirm itself. If, however, swapping is not
739 enabled then the only mitigation is serial recovery. This feature can
740 also be useful when BOOT_DIRECT_XIP is enabled, to ensure that the image
741 linked at the correct address is loaded.
742
Robert Lubos1b19d2a2020-01-31 14:05:35 +0100743source "Kconfig.zephyr"