blob: e8b63098602eda63ae0487c167931a12304bd453 [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
Jamie McCrae25d2f2c2023-07-17 14:17:53 +010080 select BOOT_ENCRYPTION_SUPPORT
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040081
Fabio Utzig105b59a2019-05-13 15:08:12 -070082if BOOT_SIGNATURE_TYPE_RSA
83config BOOT_SIGNATURE_TYPE_RSA_LEN
84 int "RSA signature length"
85 range 2048 3072
86 default 2048
87endif
88
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040089config BOOT_SIGNATURE_TYPE_ECDSA_P256
90 bool "Elliptic curve digital signatures with curve P-256"
Jamie McCrae25d2f2c2023-07-17 14:17:53 +010091 select BOOT_ENCRYPTION_SUPPORT
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040092
Sigvart Hovlandebd05032019-03-21 10:47:32 +010093if BOOT_SIGNATURE_TYPE_ECDSA_P256
Håkon Øye Amundsen21f03762021-11-12 08:21:31 +000094choice BOOT_ECDSA_IMPLEMENTATION
Sigvart Hovlandebd05032019-03-21 10:47:32 +010095 prompt "Ecdsa implementation"
Fabio Utzig34e93a52020-02-03 09:59:53 -030096 default BOOT_ECDSA_TINYCRYPT
Håkon Øye Amundsenee7282d2020-09-28 09:48:29 +000097
Fabio Utzig34e93a52020-02-03 09:59:53 -030098config BOOT_ECDSA_TINYCRYPT
Sigvart Hovlandebd05032019-03-21 10:47:32 +010099 bool "Use tinycrypt"
100 select BOOT_USE_TINYCRYPT
Håkon Øye Amundsenee7282d2020-09-28 09:48:29 +0000101
102config BOOT_ECDSA_CC310
Sigvart Hovlandebd05032019-03-21 10:47:32 +0100103 bool "Use CC310"
Håkon Øye Amundsenee7282d2020-09-28 09:48:29 +0000104 depends on HAS_HW_NRF_CC310
105 select BOOT_USE_NRF_CC310_BL
106 select NRF_CC310_BL
107 select NRFXLIB_CRYPTO
Sigvart Hovlandebd05032019-03-21 10:47:32 +0100108 select BOOT_USE_CC310
Håkon Øye Amundsenee7282d2020-09-28 09:48:29 +0000109endchoice # Ecdsa implementation
Sigvart Hovlandebd05032019-03-21 10:47:32 +0100110endif
Fabio Utzig34e93a52020-02-03 09:59:53 -0300111
112config BOOT_SIGNATURE_TYPE_ED25519
113 bool "Edwards curve digital signatures using ed25519"
Jamie McCrae25d2f2c2023-07-17 14:17:53 +0100114 select BOOT_ENCRYPTION_SUPPORT
Fabio Utzig34e93a52020-02-03 09:59:53 -0300115
116if BOOT_SIGNATURE_TYPE_ED25519
Håkon Øye Amundsen21f03762021-11-12 08:21:31 +0000117choice BOOT_ED25519_IMPLEMENTATION
Fabio Utzig34e93a52020-02-03 09:59:53 -0300118 prompt "Ecdsa implementation"
119 default BOOT_ED25519_TINYCRYPT
120config BOOT_ED25519_TINYCRYPT
121 bool "Use tinycrypt"
122 select BOOT_USE_TINYCRYPT
123config BOOT_ED25519_MBEDTLS
124 bool "Use mbedTLS"
125 select BOOT_USE_MBEDTLS
126 select MBEDTLS
127endchoice
128endif
129
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400130endchoice
131
Fabio Utzigc690c762018-04-26 10:51:09 -0300132config BOOT_SIGNATURE_KEY_FILE
133 string "PEM key file"
Håkon Øye Amundsen705c6c22020-09-28 09:45:40 +0000134 default "root-ec-p256.pem" if BOOT_SIGNATURE_TYPE_ECDSA_P256
135 default "root-ed25519.pem" if BOOT_SIGNATURE_TYPE_ED25519
136 default "root-rsa-3072.pem" if BOOT_SIGNATURE_TYPE_RSA && BOOT_SIGNATURE_TYPE_RSA_LEN=3072
137 default "root-rsa-2048.pem" if BOOT_SIGNATURE_TYPE_RSA && BOOT_SIGNATURE_TYPE_RSA_LEN=2048
Fabio Utzigc690c762018-04-26 10:51:09 -0300138 default ""
139 help
Marek Pietabdcfc852020-08-04 02:22:55 -0700140 You can use either absolute or relative path.
141 In case relative path is used, the build system assumes that it starts
142 from the directory where the MCUBoot KConfig configuration file is
143 located. If the key file is not there, the build system uses relative
144 path that starts from the MCUBoot repository root directory.
Fabio Utzigc690c762018-04-26 10:51:09 -0300145 The key file will be parsed by imgtool's getpub command and a .c source
146 with the public key information will be written in a format expected by
147 MCUboot.
148
Andrzej Puzdrowski9a605b62020-03-16 13:34:30 +0100149config MCUBOOT_CLEANUP_ARM_CORE
150 bool "Perform core cleanup before chain-load the application"
151 depends on CPU_CORTEX_M
Jamie McCrae9e8eddc2023-02-27 12:51:09 +0000152 default y
Ioannis Glaropoulos518d93a2020-10-22 14:22:14 +0200153 help
154 This option instructs MCUboot to perform a clean-up of a set of
Marcin Niestroj9ced4592023-05-17 14:50:57 +0200155 architecture core HW registers before jumping to the application
Ioannis Glaropoulos518d93a2020-10-22 14:22:14 +0200156 firmware. The clean-up sets these registers to their warm-reset
157 values as specified by the architecture.
158
Jamie McCrae9e8eddc2023-02-27 12:51:09 +0000159 This option is enabled by default to prevent possible problems when
160 booting zephyr (or other) applications whereby e.g. a MPU stack guard
161 may be initialised in RAM which is then used by the application
162 start-up code which can cause a module fault and potentially make the
163 module irrecoverable.
Andrzej Puzdrowski9a605b62020-03-16 13:34:30 +0100164
Marti Bolivara4818a52018-04-12 13:02:38 -0400165config MBEDTLS_CFG_FILE
166 default "mcuboot-mbedtls-cfg.h"
167
David Vincze03368b82020-04-01 12:53:53 +0200168config BOOT_HW_KEY
169 bool "Use HW key for image verification"
170 default n
171 help
172 Use HW key for image verification, otherwise the public key is embedded
173 in MCUBoot. If enabled the public key is appended to the signed image
174 and requires the hash of the public key to be provisioned to the device
175 beforehand.
176
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400177config BOOT_VALIDATE_SLOT0
David Vincze2d736ad2019-02-18 11:50:22 +0100178 bool "Validate image in the primary slot on every boot"
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400179 default y
180 help
David Vincze2d736ad2019-02-18 11:50:22 +0100181 If y, the bootloader attempts to validate the signature of the
182 primary slot every boot. This adds the signature check time to
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400183 every boot, but can mitigate against some changes that are
184 able to modify the flash image itself.
185
Wouter Cappellebb7a39d2021-05-03 16:44:44 +0200186config BOOT_VALIDATE_SLOT0_ONCE
187 bool "Validate image in the primary slot just once after after upgrade"
188 depends on !BOOT_VALIDATE_SLOT0 && SINGLE_APPLICATION_SLOT
189 default n
190 help
191 If y, the bootloader attempts to validate the signature of the
192 primary slot only once after an upgrade of the main slot.
193 It caches the result in the magic area, which makes it an unsecure
194 method. This option is usefull for lowering the boot up time for
195 low end devices with as a compromise lowering the security level.
196 If unsure, leave at the default value.
197
David Brown08a30a42022-04-26 14:49:51 -0600198config BOOT_PREFER_SWAP_MOVE
199 bool "Prefer the newer swap move algorithm"
200 default y if SOC_FAMILY_NRF
Thomas Strangeraa217e22022-10-28 21:17:55 +0200201 default y if !$(dt_nodelabel_enabled,scratch_partition)
David Brown08a30a42022-04-26 14:49:51 -0600202 help
203 If y, the BOOT_IMAGE_UPGRADE_MODE will default to using
204 "move" instead of "scratch". This is a separate bool config
205 option, because Kconfig doesn't allow defaults to be
206 overridden in choice options. Most devices should be using
207 swap move.
208
Andrzej Puzdrowskifdff3e12020-09-15 08:23:25 +0200209if !SINGLE_APPLICATION_SLOT
Håkon Øye Amundsen21f03762021-11-12 08:21:31 +0000210choice BOOT_IMAGE_UPGRADE_MODE
David Vincze5a6e1812020-06-29 13:34:42 +0200211 prompt "Image upgrade modes"
David Brown08a30a42022-04-26 14:49:51 -0600212 default BOOT_SWAP_USING_MOVE if BOOT_PREFER_SWAP_MOVE
David Vincze5a6e1812020-06-29 13:34:42 +0200213 default BOOT_SWAP_USING_SCRATCH
214
215config BOOT_SWAP_USING_SCRATCH
216 bool "Swap mode that run with the scratch partition"
217 help
218 This is the most conservative swap mode but it can work even on
219 devices with heterogeneous flash page layout.
220
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400221config BOOT_UPGRADE_ONLY
222 bool "Overwrite image updates instead of swapping"
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400223 help
David Vincze2d736ad2019-02-18 11:50:22 +0100224 If y, overwrite the primary slot with the upgrade image instead
225 of swapping them. This prevents the fallback recovery, but
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400226 uses a much simpler code path.
227
Fabio Utzigc58842e2019-11-28 10:30:01 -0300228config BOOT_SWAP_USING_MOVE
Fabio Utzigdd2b6802020-01-06 09:10:45 -0300229 bool "Swap mode that can run without a scratch partition"
Fabio Utzigc58842e2019-11-28 10:30:01 -0300230 help
231 If y, the swap upgrade is done in two steps, where first every
232 sector of the primary slot is moved up one sector, then for
233 each sector X in the secondary slot, it is moved to index X in
234 the primary slot, then the sector at X+1 in the primary is
235 moved to index X in the secondary.
236 This allows a swap upgrade without using a scratch partition,
237 but is currently limited to all sectors in both slots being of
238 the same size.
David Vincze5a6e1812020-06-29 13:34:42 +0200239
240config BOOT_DIRECT_XIP
241 bool "Run the latest image directly from its slot"
242 help
243 If y, mcuboot selects the newest valid image based on the image version
244 numbers, thereafter the selected image can run directly from its slot
245 without having to move/copy it into the primary slot. For this reason the
246 images must be linked to be executed from the given image slot. Using this
247 mode results in a simpler code path and smaller code size.
248
Johan Öhmanb5889072022-04-01 09:10:28 +0200249config BOOT_RAM_LOAD
250 bool "RAM load"
251 help
252 If y, mcuboot selects the newest valid image based on the image version
253 numbers, thereafter the selected image is copied to RAM and executed from
254 there. For this reason, the image has to be linked to be executed from RAM.
255 The address that the image is copied to is specified using the load-addr
256 argument to the imgtool.py script which writes it to the image header.
257
David Vincze5a6e1812020-06-29 13:34:42 +0200258endchoice
Fabio Utzigc58842e2019-11-28 10:30:01 -0300259
Johan Öhmanb5889072022-04-01 09:10:28 +0200260# Workaround for not being able to have commas in macro arguments
261DT_CHOSEN_Z_SRAM := zephyr,sram
262
263if BOOT_RAM_LOAD
264config BOOT_IMAGE_EXECUTABLE_RAM_START
265 hex "Boot image executable ram start"
266 default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_SRAM))
267
268config BOOT_IMAGE_EXECUTABLE_RAM_SIZE
269 int "Boot image executable base size"
270 default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_SRAM),0)
271endif
272
David Vincze505fba22020-10-22 13:53:29 +0200273config BOOT_DIRECT_XIP_REVERT
274 bool "Enable the revert mechanism in direct-xip mode"
Andrzej Puzdrowski32342e72020-11-18 17:04:44 +0100275 depends on BOOT_DIRECT_XIP
David Vincze505fba22020-10-22 13:53:29 +0200276 default n
277 help
278 If y, enables the revert mechanism in direct-xip similar to the one in
279 swap mode. It requires the trailer magic to be added to the signed image.
280 When a reboot happens without the image being confirmed at runtime, the
281 bootloader considers the image faulty and erases it. After this it will
282 attempt to boot the previous image. The images can also be made permanent
283 (marked as confirmed in advance) just like in swap mode.
284
Fabio Utzigd0533ed2018-12-19 07:56:33 -0200285config BOOT_BOOTSTRAP
Sam Bristowd0ca0ff2019-10-30 20:51:35 +1300286 bool "Bootstrap erased the primary slot from the secondary slot"
Fabio Utzigd0533ed2018-12-19 07:56:33 -0200287 default n
288 help
289 If y, enables bootstraping support. Bootstrapping allows an erased
David Vincze2d736ad2019-02-18 11:50:22 +0100290 primary slot to be initialized from a valid image in the secondary slot.
Fabio Utzigd0533ed2018-12-19 07:56:33 -0200291 If unsure, leave at the default value.
292
Fabio Utzigca8ead22019-12-20 07:06:04 -0300293config BOOT_SWAP_SAVE_ENCTLV
294 bool "Save encrypted key TLVs instead of plaintext keys in swap metadata"
295 default n
296 help
297 If y, instead of saving the encrypted image keys in plaintext in the
298 swap resume metadata, save the encrypted image TLVs. This should be used
299 when there is no security mechanism protecting the data in the primary
300 slot from being dumped. If n is selected (default), the keys are written
301 after being decrypted from the image TLVs and could be read by an
302 attacker who has access to the flash contents of the primary slot (eg
303 JTAG/SWD or primary slot in external flash).
304 If unsure, leave at the default value.
305
David Vincze505fba22020-10-22 13:53:29 +0200306endif # !SINGLE_APPLICATION_SLOT
Fabio Utzigb6f014c2020-04-02 13:25:01 -0300307
Jamie McCrae25d2f2c2023-07-17 14:17:53 +0100308config BOOT_ENCRYPTION_SUPPORT
309 bool
310 help
311 Hidden option used to check if image encryption is supported.
312
313config BOOT_ENCRYPT_IMAGE
314 bool "Support for encrypted image updates"
315 depends on BOOT_ENCRYPTION_SUPPORT
316 select BOOT_ENCRYPT_RSA if BOOT_SIGNATURE_TYPE_RSA
317 select BOOT_ENCRYPT_EC256 if BOOT_SIGNATURE_TYPE_ECDSA_P256
318 select BOOT_ENCRYPT_X25519 if BOOT_SIGNATURE_TYPE_ED25519
319 depends on !SINGLE_APPLICATION_SLOT || MCUBOOT_SERIAL
320 help
321 If y, images in the secondary slot can be encrypted and are decrypted
322 on the fly when upgrading to the primary slot, as well as encrypted
323 back when swapping from the primary slot to the secondary slot. The
324 encryption mechanism must match the same type as the signature type,
325 supported types include:
326 - RSA-OAEP (2048 bits).
327 - ECIES using primitives described under "ECIES-P256 encryption" in
328 docs/encrypted_images.md.
329 - ECIES using primitives described under "ECIES-X25519 encryption"
330 in docs/encrypted_images.md.
331
332 Note that for single slot operation, this can still be used to allow
333 loading encrypted images via serial recovery which are then
334 decrypted on-the-fly without needing a second slot.
335
336config BOOT_ENCRYPT_RSA
337 bool
338 help
339 Hidden option selecting RSA encryption.
340
341config BOOT_ENCRYPT_EC256
342 bool
343 help
344 Hidden option selecting EC256 encryption.
345
346config BOOT_ENCRYPT_X25519
347 bool
348 help
349 Hidden option selecting x25519 encryption.
350
Wouter Cappelle953a7612021-05-03 16:53:05 +0200351config BOOT_ENCRYPTION_KEY_FILE
Jamie McCrae25d2f2c2023-07-17 14:17:53 +0100352 string "Encryption key file"
353 depends on BOOT_ENCRYPT_IMAGE
354 default "enc-rsa2048-priv.pem" if BOOT_ENCRYPT_RSA
355 default "enc-ec256-priv.pem" if BOOT_ENCRYPT_EC256
356 default "enc-x25519-priv.pem" if BOOT_ENCRYPT_X25519
Wouter Cappelle953a7612021-05-03 16:53:05 +0200357 default ""
358 help
359 You can use either absolute or relative path.
360 In case relative path is used, the build system assumes that it starts
361 from the directory where the MCUBoot KConfig configuration file is
362 located. If the key file is not there, the build system uses relative
363 path that starts from the MCUBoot repository root directory.
364 The key file will be parsed by imgtool's getpriv command and a .c source
365 with the public key information will be written in a format expected by
366 MCUboot.
367
Marti Bolivar0e091c92018-04-12 11:23:16 -0400368config BOOT_MAX_IMG_SECTORS
369 int "Maximum number of sectors per image slot"
370 default 128
371 help
372 This option controls the maximum number of sectors that each of
373 the two image areas can contain. Smaller values reduce MCUboot's
374 memory usage; larger values allow it to support larger images.
375 If unsure, leave at the default value.
376
David Vincze1cf11b52020-03-24 07:51:09 +0100377config MEASURED_BOOT
378 bool "Store the boot state/measurements in shared memory"
379 default n
380 help
381 If enabled, the bootloader will store certain boot measurements such as
382 the hash of the firmware image in a shared memory area. This data can
383 be used later by runtime services (e.g. by a device attestation service).
384
385config BOOT_SHARE_DATA
386 bool "Save application specific data in shared memory area"
387 default n
388
Håkon Øye Amundsen21f03762021-11-12 08:21:31 +0000389choice BOOT_FAULT_INJECTION_HARDENING_PROFILE
Tamas Banfce87332020-07-10 12:40:11 +0100390 prompt "Fault injection hardening profile"
391 default BOOT_FIH_PROFILE_OFF
392
393config BOOT_FIH_PROFILE_OFF
394 bool "No hardening against hardware level fault injection"
395 help
396 No hardening in SW against hardware level fault injection: power or
397 clock glitching, etc.
398
399config BOOT_FIH_PROFILE_LOW
400 bool "Moderate level hardening against hardware level fault injection"
401 help
402 Moderate level hardening: Long global fail loop to avoid break out,
403 control flow integrity check to discover discrepancy in expected code
404 flow.
405
406config BOOT_FIH_PROFILE_MEDIUM
407 bool "Medium level hardening against hardware level fault injection"
408 help
409 Medium level hardening: Long global fail loop to avoid break out,
410 control flow integrity check to discover discrepancy in expected code
411 flow, double variables to discover register or memory corruption.
412
413config BOOT_FIH_PROFILE_HIGH
414 bool "Maximum level hardening against hardware level fault injection"
415 select MBEDTLS
416 help
417 Maximum level hardening: Long global fail loop to avoid break out,
418 control flow integrity check to discover discrepancy in expected code
419 flow, double variables to discover register or memory corruption, random
420 delays to make code execution less predictable. Random delays requires an
421 entropy source.
422
423endchoice
424
Josh Gao837cf882020-11-13 18:51:27 -0800425choice BOOT_USB_DFU
426 prompt "USB DFU"
427 default BOOT_USB_DFU_NO
428
429config BOOT_USB_DFU_NO
430 prompt "Disabled"
431
432config BOOT_USB_DFU_WAIT
Rajavardhan Gundi51c9d702019-02-20 14:08:52 +0530433 bool "Wait for a prescribed duration to see if USB DFU is invoked"
Johann Fischer25852972021-08-02 13:20:09 +0200434 select USB_DEVICE_STACK
Rajavardhan Gundi51c9d702019-02-20 14:08:52 +0530435 select USB_DFU_CLASS
436 select IMG_MANAGER
Dominik Ermel143485e2023-03-17 11:33:42 +0000437 select STREAM_FLASH
438 select MULTITHREADING
Rajavardhan Gundi51c9d702019-02-20 14:08:52 +0530439 help
440 If y, MCUboot waits for a prescribed duration of time to allow
441 for USB DFU to be invoked. Please note DFU always updates the
442 slot1 image.
443
Josh Gao837cf882020-11-13 18:51:27 -0800444config BOOT_USB_DFU_GPIO
445 bool "Use GPIO to detect whether to trigger DFU mode"
Johann Fischer25852972021-08-02 13:20:09 +0200446 select USB_DEVICE_STACK
Josh Gao837cf882020-11-13 18:51:27 -0800447 select USB_DFU_CLASS
448 select IMG_MANAGER
Dominik Ermel143485e2023-03-17 11:33:42 +0000449 select STREAM_FLASH
450 select MULTITHREADING
Josh Gao837cf882020-11-13 18:51:27 -0800451 help
452 If y, MCUboot uses GPIO to detect whether to invoke USB DFU.
453
454endchoice
455
456config BOOT_USB_DFU_WAIT_DELAY_MS
457 int "USB DFU wait duration"
458 depends on BOOT_USB_DFU_WAIT
459 default 12000
460 help
461 Milliseconds to wait for USB DFU to be invoked.
462
463if BOOT_USB_DFU_GPIO
464
Josh Gao837cf882020-11-13 18:51:27 -0800465config BOOT_USB_DFU_DETECT_DELAY
466 int "Serial detect pin detection delay time [ms]"
467 default 0
468 help
469 Used to prevent the bootloader from loading on button press.
470 Useful for powering on when using the same button as
471 the one used to place the device in bootloader mode.
472
473endif # BOOT_USB_DFU_GPIO
474
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400475config ZEPHYR_TRY_MASS_ERASE
Jamie McCrae93156542023-01-11 09:33:45 +0000476 bool "Try to mass erase flash when flashing MCUboot image (DEPRECATED)"
477 select DEPRECATED
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400478 help
479 If y, attempt to configure the Zephyr build system's "flash"
480 target to mass-erase the flash device before flashing the
481 MCUboot image. This ensures the scratch and other partitions
482 are in a consistent state.
483
484 This is not available for all targets.
485
Jamie McCrae93156542023-01-11 09:33:45 +0000486 This option has been deprecated, to perform a mass erase when
487 flashing a board, `west flash --erase` should be used instead.
488
David Brownf6d14c22019-12-10 15:36:36 -0700489config BOOT_USE_BENCH
490 bool "Enable benchmark code"
491 default n
492 help
493 If y, adds support for simple benchmarking that can record
494 time intervals between two calls. The time printed depends
495 on the particular Zephyr target, and is generally ticks of a
496 specific board-specific timer.
497
Michael Scott74ceae52019-02-01 14:01:09 -0800498module = MCUBOOT
Piotr Mienkowski15aa6ef2019-04-08 22:48:15 +0200499module-str = MCUBoot bootloader
Michael Scott74ceae52019-02-01 14:01:09 -0800500source "subsys/logging/Kconfig.template.log_config"
Michael Scott74ceae52019-02-01 14:01:09 -0800501
Andrzej Puzdrowskiaf148532020-02-25 12:51:26 +0100502config MCUBOOT_LOG_THREAD_STACK_SIZE
503 int "Stack size for the MCUBoot log processing thread"
504 depends on LOG && !LOG_IMMEDIATE
505 default 2048 if COVERAGE_GCOV
506 default 1024 if NO_OPTIMIZATIONS
507 default 1024 if XTENSA
508 default 4096 if (X86 && X86_64)
509 default 4096 if ARM64
510 default 768
511 help
512 Set the internal stack size for MCUBoot log processing thread.
513
Andrzej Puzdrowski6c00b5e2022-04-01 16:51:27 +0200514config MCUBOOT_INDICATION_LED
515 bool "Turns on LED indication when device is in DFU"
Jamie McCrae2c867552023-07-27 14:18:47 +0100516 select GPIO
Andrzej Puzdrowski6c00b5e2022-04-01 16:51:27 +0200517 help
518 Device device activates the LED while in bootloader mode.
Jeppe Odgaard1dbe0cf2023-05-17 11:09:10 +0200519 mcuboot-led0 alias must be set in the device's .dts
Andrzej Puzdrowski6c00b5e2022-04-01 16:51:27 +0200520 definitions for this to work.
521
Andrzej Puzdrowski35f61d32022-04-01 17:00:08 +0200522rsource "Kconfig.serial_recovery"
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200523
Rafał Kuźniad854bb62020-06-17 15:06:47 +0200524config BOOT_INTR_VEC_RELOC
525 bool "Relocate the interrupt vector to the application"
526 default n
527 depends on SW_VECTOR_RELAY || CPU_CORTEX_M_HAS_VTOR
528 help
529 Relocate the interrupt vector to the application before it is started.
530 Select this option if application requires vector relocation,
531 but it doesn't relocate vector in its reset handler.
532
Andrzej Puzdrowski16b6d152020-06-01 14:16:54 +0200533config UPDATEABLE_IMAGE_NUMBER
534 int "Number of updateable images"
535 default 1
Andrzej Puzdrowskifdff3e12020-09-15 08:23:25 +0200536 range 1 1 if SINGLE_APPLICATION_SLOT
Andrzej Puzdrowski16b6d152020-06-01 14:16:54 +0200537 help
538 Enables support of multi image update.
539
Marek Pietaa95a41b2023-04-21 14:03:19 +0200540config BOOT_VERSION_CMP_USE_BUILD_NUMBER
541 bool "Use build number while comparing image version"
542 depends on (UPDATEABLE_IMAGE_NUMBER > 1) || BOOT_DIRECT_XIP || \
543 BOOT_RAM_LOAD || MCUBOOT_DOWNGRADE_PREVENTION
544 help
545 By default, the image version comparison relies only on version major,
546 minor and revision. Enable this option to take into account the build
547 number as well.
548
Håkon Øye Amundsen21f03762021-11-12 08:21:31 +0000549choice BOOT_DOWNGRADE_PREVENTION_CHOICE
Andrzej Puzdrowski16b6d152020-06-01 14:16:54 +0200550 prompt "Downgrade prevention"
551 optional
552
553config MCUBOOT_DOWNGRADE_PREVENTION
554 bool "SW based downgrade prevention"
Jerzy Kasenbergb8801fc2022-06-29 15:54:37 +0200555 depends on !BOOT_DIRECT_XIP
Andrzej Puzdrowski16b6d152020-06-01 14:16:54 +0200556 help
557 Prevent downgrades by enforcing incrementing version numbers.
558 When this option is set, any upgrade must have greater major version
559 or greater minor version with equal major version. This mechanism
560 only protects against some attacks against version downgrades (for
561 example, a JTAG could be used to write an older version).
562
Jerzy Kasenbergb8801fc2022-06-29 15:54:37 +0200563config MCUBOOT_DOWNGRADE_PREVENTION_SECURITY_COUNTER
564 bool "Use image security counter instead of version number"
565 depends on MCUBOOT_DOWNGRADE_PREVENTION
566 depends on (BOOT_SWAP_USING_MOVE || BOOT_SWAP_USING_SCRATCH)
567 help
568 Security counter is used for version eligibility check instead of pure
569 version. When this option is set, any upgrade must have greater or
570 equal security counter value.
571 Because of the acceptance of equal values it allows for software
572 downgrades to some extent.
573
Andrzej Puzdrowski16b6d152020-06-01 14:16:54 +0200574config MCUBOOT_HW_DOWNGRADE_PREVENTION
575 bool "HW based downgrade prevention"
576 help
577 Prevent undesirable/malicious software downgrades. When this option is
578 set, any upgrade must have greater or equal security counter value.
579 Because of the acceptance of equal values it allows for software
580 downgrade to some extent.
581
582endchoice
583
Andrzej Puzdrowskid21442a2020-10-12 16:47:28 +0200584config BOOT_WATCHDOG_FEED
585 bool "Feed the watchdog while doing swap"
Andrzej Puzdrowskib25ba4b2022-09-28 15:58:19 +0200586 default y if WATCHDOG
587 default y if SOC_FAMILY_NRF
588 # for nRF nrfx based implementation is available
Bartosz Bilasa1c8c8e2022-08-30 21:50:28 +0200589 imply NRFX_WDT if SOC_FAMILY_NRF
590 imply NRFX_WDT0 if SOC_FAMILY_NRF
591 imply NRFX_WDT1 if SOC_FAMILY_NRF
Andrzej Puzdrowskid21442a2020-10-12 16:47:28 +0200592 help
593 Enables implementation of MCUBOOT_WATCHDOG_FEED() macro which is
594 used to feed watchdog while doing time consuming operations.
595
Andrzej Puzdrowski914204d2021-07-09 19:20:46 +0200596config BOOT_IMAGE_ACCESS_HOOKS
597 bool "Enable hooks for overriding MCUboot's native routines"
598 help
599 Allow to provide procedures for override or extend native
600 MCUboot's routines required for access the image data and the image
Andrzej Puzdrowski1c150c62022-07-07 14:55:22 +0200601 update. It is up to the project customization to add required source
602 files to the build.
Andrzej Puzdrowski914204d2021-07-09 19:20:46 +0200603
Jamie McCrae56cb6102022-03-23 11:57:03 +0000604config MCUBOOT_ACTION_HOOKS
605 bool "Enable hooks for responding to MCUboot status changes"
606 help
607 This will call a handler when the MCUboot status changes which allows
608 for some level of user feedback, for instance to change LED status to
609 indicate a failure, using the callback:
610 'void mcuboot_status_change(mcuboot_status_type_t status)' where
611 'mcuboot_status_type_t' is listed in
612 boot/bootutil/include/bootutil/mcuboot_status.h
613
Andrzej Puzdrowski97543282018-04-12 15:16:56 +0200614endmenu
615
Carles Cufi84ede582018-01-29 15:12:00 +0100616config MCUBOOT_DEVICE_SETTINGS
617 # Hidden selector for device-specific settings
618 bool
619 default y
620 # CPU options
621 select MCUBOOT_DEVICE_CPU_CORTEX_M0 if CPU_CORTEX_M0
Carles Cufi67c792e2018-01-29 15:14:31 +0100622 # Enable flash page layout if available
623 select FLASH_PAGE_LAYOUT if FLASH_HAS_PAGE_LAYOUT
Andrzej Puzdrowskib788c712018-04-12 12:42:49 +0200624 # Enable flash_map module as flash I/O back-end
625 select FLASH_MAP
Carles Cufi84ede582018-01-29 15:12:00 +0100626
627config MCUBOOT_DEVICE_CPU_CORTEX_M0
628 # Hidden selector for Cortex-M0 settings
629 bool
630 default n
631 select SW_VECTOR_RELAY if !CPU_CORTEX_M0_HAS_VECTOR_TABLE_REMAP
632
Marti Bolivar0e091c92018-04-12 11:23:16 -0400633comment "Zephyr configuration options"
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200634
Marti Bolivarf84cc4b2019-08-20 16:06:56 -0700635# Disabling MULTITHREADING provides a code size advantage, but
636# it requires peripheral drivers (particularly a flash driver)
637# that works properly with the option enabled.
638#
639# If you know for sure that your hardware will work, you can default
640# it to n here. Otherwise, having it on by default makes the most
641# hardware work.
642config MULTITHREADING
Andrzej Puzdrowski9a4946c2020-02-20 12:39:12 +0100643 default y if BOOT_SERIAL_CDC_ACM #usb driver requires MULTITHREADING
Josh Gao837cf882020-11-13 18:51:27 -0800644 default y if BOOT_USB_DFU_GPIO || BOOT_USB_DFU_WAIT
Marti Bolivarf84cc4b2019-08-20 16:06:56 -0700645 default n if SOC_FAMILY_NRF
Marek Matej67693442023-01-23 17:54:36 +0100646 default n if SOC_FAMILY_ESP32 && MCUBOOT
Marti Bolivarf84cc4b2019-08-20 16:06:56 -0700647 default y
648
Andrzej Puzdrowski3f092bd2020-02-17 13:25:32 +0100649config LOG_PROCESS_THREAD
650 default n # mcuboot has its own log processing thread
651
652# override USB device name
653config USB_DEVICE_PRODUCT
654 default "MCUBOOT"
Andrzej Puzdrowski9a4946c2020-02-20 12:39:12 +0100655
Andrzej Puzdrowskif573b392020-11-10 14:35:15 +0100656# use MCUboot's own log configuration
657config MCUBOOT_BOOTUTIL_LIB_OWN_LOG
658 bool
659 default n
660
Håkon Øye Amundsene829e9d2021-11-12 14:01:01 +0000661config MCUBOOT_VERIFY_IMG_ADDRESS
662 bool "Verify reset address of image in secondary slot"
663 depends on UPDATEABLE_IMAGE_NUMBER > 1
664 depends on !BOOT_ENCRYPT_IMAGE
665 depends on ARM
666 default y if BOOT_UPGRADE_ONLY
667 help
668 Verify that the reset address in the image located in the secondary slot
669 is contained within the corresponding primary slot. This is recommended
670 if swapping is not used (that is, BOOT_UPGRADE_ONLY is set). If a user
671 incorrectly uploads an update for image 1 to image 0's secondary slot
672 MCUboot will overwrite image 0's primary slot with this image even
673 though it will not boot. If swapping is enabled this will be handled
674 since the image will not confirm itself. If, however, swapping is not
675 enabled then the only mitigation is serial recovery. This feature can
676 also be useful when BOOT_DIRECT_XIP is enabled, to ensure that the image
677 linked at the correct address is loaded.
678
Robert Lubos1b19d2a2020-01-31 14:05:35 +0100679source "Kconfig.zephyr"