blob: a93be08fd72fb6785f9107369a321bf8a57992b7 [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
Wouter Cappellebb7a39d2021-05-03 16:44:44 +0200185config BOOT_VALIDATE_SLOT0_ONCE
186 bool "Validate image in the primary slot just once after after upgrade"
187 depends on !BOOT_VALIDATE_SLOT0 && SINGLE_APPLICATION_SLOT
188 default n
189 help
190 If y, the bootloader attempts to validate the signature of the
191 primary slot only once after an upgrade of the main slot.
192 It caches the result in the magic area, which makes it an unsecure
193 method. This option is usefull for lowering the boot up time for
194 low end devices with as a compromise lowering the security level.
195 If unsure, leave at the default value.
196
David Brown08a30a42022-04-26 14:49:51 -0600197config BOOT_PREFER_SWAP_MOVE
198 bool "Prefer the newer swap move algorithm"
199 default y if SOC_FAMILY_NRF
Thomas Strangeraa217e22022-10-28 21:17:55 +0200200 default y if !$(dt_nodelabel_enabled,scratch_partition)
David Brown08a30a42022-04-26 14:49:51 -0600201 help
202 If y, the BOOT_IMAGE_UPGRADE_MODE will default to using
203 "move" instead of "scratch". This is a separate bool config
204 option, because Kconfig doesn't allow defaults to be
205 overridden in choice options. Most devices should be using
206 swap move.
207
Andrzej Puzdrowskifdff3e12020-09-15 08:23:25 +0200208if !SINGLE_APPLICATION_SLOT
Håkon Øye Amundsen21f03762021-11-12 08:21:31 +0000209choice BOOT_IMAGE_UPGRADE_MODE
David Vincze5a6e1812020-06-29 13:34:42 +0200210 prompt "Image upgrade modes"
David Brown08a30a42022-04-26 14:49:51 -0600211 default BOOT_SWAP_USING_MOVE if BOOT_PREFER_SWAP_MOVE
David Vincze5a6e1812020-06-29 13:34:42 +0200212 default BOOT_SWAP_USING_SCRATCH
213
214config BOOT_SWAP_USING_SCRATCH
215 bool "Swap mode that run with the scratch partition"
216 help
217 This is the most conservative swap mode but it can work even on
218 devices with heterogeneous flash page layout.
219
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400220config BOOT_UPGRADE_ONLY
221 bool "Overwrite image updates instead of swapping"
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400222 help
David Vincze2d736ad2019-02-18 11:50:22 +0100223 If y, overwrite the primary slot with the upgrade image instead
224 of swapping them. This prevents the fallback recovery, but
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400225 uses a much simpler code path.
226
Fabio Utzigc58842e2019-11-28 10:30:01 -0300227config BOOT_SWAP_USING_MOVE
Fabio Utzigdd2b6802020-01-06 09:10:45 -0300228 bool "Swap mode that can run without a scratch partition"
Fabio Utzigc58842e2019-11-28 10:30:01 -0300229 help
230 If y, the swap upgrade is done in two steps, where first every
231 sector of the primary slot is moved up one sector, then for
232 each sector X in the secondary slot, it is moved to index X in
233 the primary slot, then the sector at X+1 in the primary is
234 moved to index X in the secondary.
235 This allows a swap upgrade without using a scratch partition,
236 but is currently limited to all sectors in both slots being of
237 the same size.
David Vincze5a6e1812020-06-29 13:34:42 +0200238
239config BOOT_DIRECT_XIP
240 bool "Run the latest image directly from its slot"
241 help
242 If y, mcuboot selects the newest valid image based on the image version
243 numbers, thereafter the selected image can run directly from its slot
244 without having to move/copy it into the primary slot. For this reason the
245 images must be linked to be executed from the given image slot. Using this
246 mode results in a simpler code path and smaller code size.
247
Johan Öhmanb5889072022-04-01 09:10:28 +0200248config BOOT_RAM_LOAD
249 bool "RAM load"
250 help
251 If y, mcuboot selects the newest valid image based on the image version
252 numbers, thereafter the selected image is copied to RAM and executed from
253 there. For this reason, the image has to be linked to be executed from RAM.
254 The address that the image is copied to is specified using the load-addr
255 argument to the imgtool.py script which writes it to the image header.
256
David Vincze5a6e1812020-06-29 13:34:42 +0200257endchoice
Fabio Utzigc58842e2019-11-28 10:30:01 -0300258
Johan Öhmanb5889072022-04-01 09:10:28 +0200259# Workaround for not being able to have commas in macro arguments
260DT_CHOSEN_Z_SRAM := zephyr,sram
261
262if BOOT_RAM_LOAD
263config BOOT_IMAGE_EXECUTABLE_RAM_START
264 hex "Boot image executable ram start"
265 default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_SRAM))
266
267config BOOT_IMAGE_EXECUTABLE_RAM_SIZE
268 int "Boot image executable base size"
269 default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_SRAM),0)
270endif
271
David Vincze505fba22020-10-22 13:53:29 +0200272config BOOT_DIRECT_XIP_REVERT
273 bool "Enable the revert mechanism in direct-xip mode"
Andrzej Puzdrowski32342e72020-11-18 17:04:44 +0100274 depends on BOOT_DIRECT_XIP
David Vincze505fba22020-10-22 13:53:29 +0200275 default n
276 help
277 If y, enables the revert mechanism in direct-xip similar to the one in
278 swap mode. It requires the trailer magic to be added to the signed image.
279 When a reboot happens without the image being confirmed at runtime, the
280 bootloader considers the image faulty and erases it. After this it will
281 attempt to boot the previous image. The images can also be made permanent
282 (marked as confirmed in advance) just like in swap mode.
283
Fabio Utzigd0533ed2018-12-19 07:56:33 -0200284config BOOT_BOOTSTRAP
Sam Bristowd0ca0ff2019-10-30 20:51:35 +1300285 bool "Bootstrap erased the primary slot from the secondary slot"
Fabio Utzigd0533ed2018-12-19 07:56:33 -0200286 default n
287 help
288 If y, enables bootstraping support. Bootstrapping allows an erased
David Vincze2d736ad2019-02-18 11:50:22 +0100289 primary slot to be initialized from a valid image in the secondary slot.
Fabio Utzigd0533ed2018-12-19 07:56:33 -0200290 If unsure, leave at the default value.
291
Fabio Utzigca8ead22019-12-20 07:06:04 -0300292config BOOT_SWAP_SAVE_ENCTLV
293 bool "Save encrypted key TLVs instead of plaintext keys in swap metadata"
294 default n
295 help
296 If y, instead of saving the encrypted image keys in plaintext in the
297 swap resume metadata, save the encrypted image TLVs. This should be used
298 when there is no security mechanism protecting the data in the primary
299 slot from being dumped. If n is selected (default), the keys are written
300 after being decrypted from the image TLVs and could be read by an
301 attacker who has access to the flash contents of the primary slot (eg
302 JTAG/SWD or primary slot in external flash).
303 If unsure, leave at the default value.
304
Håkon Øye Amundsene829e9d2021-11-12 14:01:01 +0000305config BOOT_ENCRYPT_IMAGE
306 bool
307 help
308 Hidden option used to check if any image encryption is enabled.
309
Fabio Utzig5fe874c2018-08-31 07:41:50 -0300310config BOOT_ENCRYPT_RSA
Fabio Utzig42cc29a2019-11-05 07:54:41 -0300311 bool "Support for encrypted upgrade images using RSA"
Håkon Øye Amundsene829e9d2021-11-12 14:01:01 +0000312 select BOOT_ENCRYPT_IMAGE
Fabio Utzig5fe874c2018-08-31 07:41:50 -0300313 help
David Vincze2d736ad2019-02-18 11:50:22 +0100314 If y, images in the secondary slot can be encrypted and are decrypted
315 on the fly when upgrading to the primary slot, as well as encrypted
Fabio Utzig42cc29a2019-11-05 07:54:41 -0300316 back when swapping from the primary slot to the secondary slot. The
317 encryption mechanism used in this case is RSA-OAEP (2048 bits).
318
319config BOOT_ENCRYPT_EC256
320 bool "Support for encrypted upgrade images using ECIES-P256"
Håkon Øye Amundsene829e9d2021-11-12 14:01:01 +0000321 select BOOT_ENCRYPT_IMAGE
Fabio Utzig42cc29a2019-11-05 07:54:41 -0300322 help
323 If y, images in the secondary slot can be encrypted and are decrypted
324 on the fly when upgrading to the primary slot, as well as encrypted
325 back when swapping from the primary slot to the secondary slot. The
326 encryption mechanism used in this case is ECIES using primitives
327 described under "ECIES-P256 encryption" in docs/encrypted_images.md.
Fabio Utzig5fe874c2018-08-31 07:41:50 -0300328
Fabio Utzigb6f014c2020-04-02 13:25:01 -0300329config BOOT_ENCRYPT_X25519
330 bool "Support for encrypted upgrade images using ECIES-X25519"
Håkon Øye Amundsene829e9d2021-11-12 14:01:01 +0000331 select BOOT_ENCRYPT_IMAGE
Fabio Utzigb6f014c2020-04-02 13:25:01 -0300332 help
333 If y, images in the secondary slot can be encrypted and are decrypted
334 on the fly when upgrading to the primary slot, as well as encrypted
335 back when swapping from the primary slot to the secondary slot. The
336 encryption mechanism used in this case is ECIES using primitives
337 described under "ECIES-X25519 encryption" in docs/encrypted_images.md.
David Vincze505fba22020-10-22 13:53:29 +0200338endif # !SINGLE_APPLICATION_SLOT
Fabio Utzigb6f014c2020-04-02 13:25:01 -0300339
Wouter Cappelle953a7612021-05-03 16:53:05 +0200340config BOOT_ENCRYPTION_KEY_FILE
341 string "encryption key file"
342 depends on BOOT_ENCRYPT_EC256 || BOOT_SERIAL_ENCRYPT_EC256
343 default "enc-ec256-priv.pem" if BOOT_SIGNATURE_TYPE_ECDSA_P256
344 default ""
345 help
346 You can use either absolute or relative path.
347 In case relative path is used, the build system assumes that it starts
348 from the directory where the MCUBoot KConfig configuration file is
349 located. If the key file is not there, the build system uses relative
350 path that starts from the MCUBoot repository root directory.
351 The key file will be parsed by imgtool's getpriv command and a .c source
352 with the public key information will be written in a format expected by
353 MCUboot.
354
Marti Bolivar0e091c92018-04-12 11:23:16 -0400355config BOOT_MAX_IMG_SECTORS
356 int "Maximum number of sectors per image slot"
357 default 128
358 help
359 This option controls the maximum number of sectors that each of
360 the two image areas can contain. Smaller values reduce MCUboot's
361 memory usage; larger values allow it to support larger images.
362 If unsure, leave at the default value.
363
David Vincze1cf11b52020-03-24 07:51:09 +0100364config MEASURED_BOOT
365 bool "Store the boot state/measurements in shared memory"
366 default n
367 help
368 If enabled, the bootloader will store certain boot measurements such as
369 the hash of the firmware image in a shared memory area. This data can
370 be used later by runtime services (e.g. by a device attestation service).
371
372config BOOT_SHARE_DATA
373 bool "Save application specific data in shared memory area"
374 default n
375
Håkon Øye Amundsen21f03762021-11-12 08:21:31 +0000376choice BOOT_FAULT_INJECTION_HARDENING_PROFILE
Tamas Banfce87332020-07-10 12:40:11 +0100377 prompt "Fault injection hardening profile"
378 default BOOT_FIH_PROFILE_OFF
379
380config BOOT_FIH_PROFILE_OFF
381 bool "No hardening against hardware level fault injection"
382 help
383 No hardening in SW against hardware level fault injection: power or
384 clock glitching, etc.
385
386config BOOT_FIH_PROFILE_LOW
387 bool "Moderate level hardening against hardware level fault injection"
388 help
389 Moderate level hardening: Long global fail loop to avoid break out,
390 control flow integrity check to discover discrepancy in expected code
391 flow.
392
393config BOOT_FIH_PROFILE_MEDIUM
394 bool "Medium level hardening against hardware level fault injection"
395 help
396 Medium level hardening: Long global fail loop to avoid break out,
397 control flow integrity check to discover discrepancy in expected code
398 flow, double variables to discover register or memory corruption.
399
400config BOOT_FIH_PROFILE_HIGH
401 bool "Maximum level hardening against hardware level fault injection"
402 select MBEDTLS
403 help
404 Maximum level hardening: Long global fail loop to avoid break out,
405 control flow integrity check to discover discrepancy in expected code
406 flow, double variables to discover register or memory corruption, random
407 delays to make code execution less predictable. Random delays requires an
408 entropy source.
409
410endchoice
411
Josh Gao837cf882020-11-13 18:51:27 -0800412choice BOOT_USB_DFU
413 prompt "USB DFU"
414 default BOOT_USB_DFU_NO
415
416config BOOT_USB_DFU_NO
417 prompt "Disabled"
418
419config BOOT_USB_DFU_WAIT
Rajavardhan Gundi51c9d702019-02-20 14:08:52 +0530420 bool "Wait for a prescribed duration to see if USB DFU is invoked"
Johann Fischer25852972021-08-02 13:20:09 +0200421 select USB_DEVICE_STACK
Rajavardhan Gundi51c9d702019-02-20 14:08:52 +0530422 select USB_DFU_CLASS
423 select IMG_MANAGER
424 help
425 If y, MCUboot waits for a prescribed duration of time to allow
426 for USB DFU to be invoked. Please note DFU always updates the
427 slot1 image.
428
Josh Gao837cf882020-11-13 18:51:27 -0800429config BOOT_USB_DFU_GPIO
430 bool "Use GPIO to detect whether to trigger DFU mode"
Johann Fischer25852972021-08-02 13:20:09 +0200431 select USB_DEVICE_STACK
Josh Gao837cf882020-11-13 18:51:27 -0800432 select USB_DFU_CLASS
433 select IMG_MANAGER
434 help
435 If y, MCUboot uses GPIO to detect whether to invoke USB DFU.
436
437endchoice
438
439config BOOT_USB_DFU_WAIT_DELAY_MS
440 int "USB DFU wait duration"
441 depends on BOOT_USB_DFU_WAIT
442 default 12000
443 help
444 Milliseconds to wait for USB DFU to be invoked.
445
446if BOOT_USB_DFU_GPIO
447
448config BOOT_USB_DFU_DETECT_PORT
Andrzej Puzdrowskic5faf432022-04-09 13:34:23 +0200449 string "GPIO device to trigger USB DFU mode (DEPRECATED)"
Josh Gao837cf882020-11-13 18:51:27 -0800450 default GPIO_0 if SOC_FAMILY_NRF
451 help
452 Zephyr GPIO device that contains the pin used to trigger
453 USB DFU.
454
455config BOOT_USB_DFU_DETECT_PIN
Andrzej Puzdrowskic5faf432022-04-09 13:34:23 +0200456 int "Pin to trigger USB DFU mode (DEPRECATED)"
Josh Gao837cf882020-11-13 18:51:27 -0800457 default 6 if BOARD_NRF9160DK_NRF9160
458 default 11 if BOARD_NRF52840DK_NRF52840
459 default 13 if BOARD_NRF52DK_NRF52832
Martí Bolívar994816d2021-07-28 12:16:06 -0700460 default 23 if BOARD_NRF5340_DK_NRF5340_CPUAPP || BOARD_NRF5340_DK_NRF5340_CPUAPP_NS
461 default 43 if BOARD_BL5340_DVK_CPUAPP || BOARD_BL5340_DVK_CPUAPP_NS
Marek Pieta2fa11902022-09-13 11:31:30 +0200462 default -1
Josh Gao837cf882020-11-13 18:51:27 -0800463 help
464 Pin on the DFU detect port that triggers DFU mode.
465
466config BOOT_USB_DFU_DETECT_PIN_VAL
Andrzej Puzdrowskic5faf432022-04-09 13:34:23 +0200467 int "USB DFU detect pin trigger value (DEPRECATED)"
Josh Gao837cf882020-11-13 18:51:27 -0800468 default 0
469 range 0 1
470 help
471 Logic value of the detect pin that triggers USB DFU mode.
472
473config BOOT_USB_DFU_DETECT_DELAY
474 int "Serial detect pin detection delay time [ms]"
475 default 0
476 help
477 Used to prevent the bootloader from loading on button press.
478 Useful for powering on when using the same button as
479 the one used to place the device in bootloader mode.
480
481endif # BOOT_USB_DFU_GPIO
482
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400483config ZEPHYR_TRY_MASS_ERASE
Jamie McCrae93156542023-01-11 09:33:45 +0000484 bool "Try to mass erase flash when flashing MCUboot image (DEPRECATED)"
485 select DEPRECATED
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400486 help
487 If y, attempt to configure the Zephyr build system's "flash"
488 target to mass-erase the flash device before flashing the
489 MCUboot image. This ensures the scratch and other partitions
490 are in a consistent state.
491
492 This is not available for all targets.
493
Jamie McCrae93156542023-01-11 09:33:45 +0000494 This option has been deprecated, to perform a mass erase when
495 flashing a board, `west flash --erase` should be used instead.
496
David Brownf6d14c22019-12-10 15:36:36 -0700497config BOOT_USE_BENCH
498 bool "Enable benchmark code"
499 default n
500 help
501 If y, adds support for simple benchmarking that can record
502 time intervals between two calls. The time printed depends
503 on the particular Zephyr target, and is generally ticks of a
504 specific board-specific timer.
505
Michael Scott74ceae52019-02-01 14:01:09 -0800506module = MCUBOOT
Piotr Mienkowski15aa6ef2019-04-08 22:48:15 +0200507module-str = MCUBoot bootloader
Michael Scott74ceae52019-02-01 14:01:09 -0800508source "subsys/logging/Kconfig.template.log_config"
Michael Scott74ceae52019-02-01 14:01:09 -0800509
Andrzej Puzdrowskiaf148532020-02-25 12:51:26 +0100510config MCUBOOT_LOG_THREAD_STACK_SIZE
511 int "Stack size for the MCUBoot log processing thread"
512 depends on LOG && !LOG_IMMEDIATE
513 default 2048 if COVERAGE_GCOV
514 default 1024 if NO_OPTIMIZATIONS
515 default 1024 if XTENSA
516 default 4096 if (X86 && X86_64)
517 default 4096 if ARM64
518 default 768
519 help
520 Set the internal stack size for MCUBoot log processing thread.
521
Andrzej Puzdrowski6c00b5e2022-04-01 16:51:27 +0200522config MCUBOOT_INDICATION_LED
523 bool "Turns on LED indication when device is in DFU"
524 default n
525 help
526 Device device activates the LED while in bootloader mode.
527 bootloader-led0 alias must be set in the device's .dts
528 definitions for this to work.
529
Andrzej Puzdrowski35f61d32022-04-01 17:00:08 +0200530rsource "Kconfig.serial_recovery"
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200531
Rafał Kuźniad854bb62020-06-17 15:06:47 +0200532config BOOT_INTR_VEC_RELOC
533 bool "Relocate the interrupt vector to the application"
534 default n
535 depends on SW_VECTOR_RELAY || CPU_CORTEX_M_HAS_VTOR
536 help
537 Relocate the interrupt vector to the application before it is started.
538 Select this option if application requires vector relocation,
539 but it doesn't relocate vector in its reset handler.
540
Andrzej Puzdrowski16b6d152020-06-01 14:16:54 +0200541config UPDATEABLE_IMAGE_NUMBER
542 int "Number of updateable images"
543 default 1
Andrzej Puzdrowskifdff3e12020-09-15 08:23:25 +0200544 range 1 1 if SINGLE_APPLICATION_SLOT
Andrzej Puzdrowski16b6d152020-06-01 14:16:54 +0200545 help
546 Enables support of multi image update.
547
Håkon Øye Amundsen21f03762021-11-12 08:21:31 +0000548choice BOOT_DOWNGRADE_PREVENTION_CHOICE
Andrzej Puzdrowski16b6d152020-06-01 14:16:54 +0200549 prompt "Downgrade prevention"
550 optional
551
552config MCUBOOT_DOWNGRADE_PREVENTION
553 bool "SW based downgrade prevention"
Jerzy Kasenbergb8801fc2022-06-29 15:54:37 +0200554 depends on !BOOT_DIRECT_XIP
Andrzej Puzdrowski16b6d152020-06-01 14:16:54 +0200555 help
556 Prevent downgrades by enforcing incrementing version numbers.
557 When this option is set, any upgrade must have greater major version
558 or greater minor version with equal major version. This mechanism
559 only protects against some attacks against version downgrades (for
560 example, a JTAG could be used to write an older version).
561
Jerzy Kasenbergb8801fc2022-06-29 15:54:37 +0200562config MCUBOOT_DOWNGRADE_PREVENTION_SECURITY_COUNTER
563 bool "Use image security counter instead of version number"
564 depends on MCUBOOT_DOWNGRADE_PREVENTION
565 depends on (BOOT_SWAP_USING_MOVE || BOOT_SWAP_USING_SCRATCH)
566 help
567 Security counter is used for version eligibility check instead of pure
568 version. When this option is set, any upgrade must have greater or
569 equal security counter value.
570 Because of the acceptance of equal values it allows for software
571 downgrades to some extent.
572
Andrzej Puzdrowski16b6d152020-06-01 14:16:54 +0200573config MCUBOOT_HW_DOWNGRADE_PREVENTION
574 bool "HW based downgrade prevention"
575 help
576 Prevent undesirable/malicious software downgrades. When this option is
577 set, any upgrade must have greater or equal security counter value.
578 Because of the acceptance of equal values it allows for software
579 downgrade to some extent.
580
581endchoice
582
Andrzej Puzdrowskid21442a2020-10-12 16:47:28 +0200583config BOOT_WATCHDOG_FEED
584 bool "Feed the watchdog while doing swap"
Andrzej Puzdrowskib25ba4b2022-09-28 15:58:19 +0200585 default y if WATCHDOG
586 default y if SOC_FAMILY_NRF
587 # for nRF nrfx based implementation is available
Bartosz Bilasa1c8c8e2022-08-30 21:50:28 +0200588 imply NRFX_WDT if SOC_FAMILY_NRF
589 imply NRFX_WDT0 if SOC_FAMILY_NRF
590 imply NRFX_WDT1 if SOC_FAMILY_NRF
Andrzej Puzdrowskid21442a2020-10-12 16:47:28 +0200591 help
592 Enables implementation of MCUBOOT_WATCHDOG_FEED() macro which is
593 used to feed watchdog while doing time consuming operations.
594
Andrzej Puzdrowski914204d2021-07-09 19:20:46 +0200595config BOOT_IMAGE_ACCESS_HOOKS
596 bool "Enable hooks for overriding MCUboot's native routines"
597 help
598 Allow to provide procedures for override or extend native
599 MCUboot's routines required for access the image data and the image
Andrzej Puzdrowski1c150c62022-07-07 14:55:22 +0200600 update. It is up to the project customization to add required source
601 files to the build.
Andrzej Puzdrowski914204d2021-07-09 19:20:46 +0200602
Jamie McCrae56cb6102022-03-23 11:57:03 +0000603config MCUBOOT_ACTION_HOOKS
604 bool "Enable hooks for responding to MCUboot status changes"
605 help
606 This will call a handler when the MCUboot status changes which allows
607 for some level of user feedback, for instance to change LED status to
608 indicate a failure, using the callback:
609 'void mcuboot_status_change(mcuboot_status_type_t status)' where
610 'mcuboot_status_type_t' is listed in
611 boot/bootutil/include/bootutil/mcuboot_status.h
612
Andrzej Puzdrowski97543282018-04-12 15:16:56 +0200613endmenu
614
Carles Cufi84ede582018-01-29 15:12:00 +0100615config MCUBOOT_DEVICE_SETTINGS
616 # Hidden selector for device-specific settings
617 bool
618 default y
619 # CPU options
620 select MCUBOOT_DEVICE_CPU_CORTEX_M0 if CPU_CORTEX_M0
Carles Cufi67c792e2018-01-29 15:14:31 +0100621 # Enable flash page layout if available
622 select FLASH_PAGE_LAYOUT if FLASH_HAS_PAGE_LAYOUT
Andrzej Puzdrowskib788c712018-04-12 12:42:49 +0200623 # Enable flash_map module as flash I/O back-end
624 select FLASH_MAP
Carles Cufi84ede582018-01-29 15:12:00 +0100625
626config MCUBOOT_DEVICE_CPU_CORTEX_M0
627 # Hidden selector for Cortex-M0 settings
628 bool
629 default n
630 select SW_VECTOR_RELAY if !CPU_CORTEX_M0_HAS_VECTOR_TABLE_REMAP
631
Marti Bolivar0e091c92018-04-12 11:23:16 -0400632comment "Zephyr configuration options"
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200633
Marti Bolivarf84cc4b2019-08-20 16:06:56 -0700634# Disabling MULTITHREADING provides a code size advantage, but
635# it requires peripheral drivers (particularly a flash driver)
636# that works properly with the option enabled.
637#
638# If you know for sure that your hardware will work, you can default
639# it to n here. Otherwise, having it on by default makes the most
640# hardware work.
641config MULTITHREADING
Andrzej Puzdrowski9a4946c2020-02-20 12:39:12 +0100642 default y if BOOT_SERIAL_CDC_ACM #usb driver requires MULTITHREADING
Josh Gao837cf882020-11-13 18:51:27 -0800643 default y if BOOT_USB_DFU_GPIO || BOOT_USB_DFU_WAIT
Marti Bolivarf84cc4b2019-08-20 16:06:56 -0700644 default n if SOC_FAMILY_NRF
645 default y
646
Andrzej Puzdrowski3f092bd2020-02-17 13:25:32 +0100647config LOG_PROCESS_THREAD
648 default n # mcuboot has its own log processing thread
649
650# override USB device name
651config USB_DEVICE_PRODUCT
652 default "MCUBOOT"
Andrzej Puzdrowski9a4946c2020-02-20 12:39:12 +0100653
Andrzej Puzdrowskif573b392020-11-10 14:35:15 +0100654# use MCUboot's own log configuration
655config MCUBOOT_BOOTUTIL_LIB_OWN_LOG
656 bool
657 default n
658
Håkon Øye Amundsene829e9d2021-11-12 14:01:01 +0000659config MCUBOOT_VERIFY_IMG_ADDRESS
660 bool "Verify reset address of image in secondary slot"
661 depends on UPDATEABLE_IMAGE_NUMBER > 1
662 depends on !BOOT_ENCRYPT_IMAGE
663 depends on ARM
664 default y if BOOT_UPGRADE_ONLY
665 help
666 Verify that the reset address in the image located in the secondary slot
667 is contained within the corresponding primary slot. This is recommended
668 if swapping is not used (that is, BOOT_UPGRADE_ONLY is set). If a user
669 incorrectly uploads an update for image 1 to image 0's secondary slot
670 MCUboot will overwrite image 0's primary slot with this image even
671 though it will not boot. If swapping is enabled this will be handled
672 since the image will not confirm itself. If, however, swapping is not
673 enabled then the only mitigation is serial recovery. This feature can
674 also be useful when BOOT_DIRECT_XIP is enabled, to ensure that the image
675 linked at the correct address is loaded.
676
Robert Lubos1b19d2a2020-01-31 14:05:35 +0100677source "Kconfig.zephyr"