blob: 3de379fc1b541f95289c85ca5ed5ba48103d8501 [file] [log] [blame]
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +02001# Copyright (c) 2017 Linaro Limited
2#
3# SPDX-License-Identifier: Apache-2.0
4#
5
Marti Bolivar0e091c92018-04-12 11:23:16 -04006mainmenu "MCUboot configuration"
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +02007
Marti Bolivar0e091c92018-04-12 11:23:16 -04008comment "MCUboot-specific configuration options"
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +02009
Emanuele Di Santo865777d2018-11-08 11:28:15 +010010# Hidden option to mark a project as MCUboot
11config MCUBOOT
12 default y
13 bool
Rajavardhan Gundi07ba28f2018-12-10 15:44:48 +053014 select MPU_ALLOW_FLASH_WRITE if ARM_MPU
Andrzej Puzdrowski23d3c662019-03-18 14:12:22 +010015 select USE_CODE_PARTITION if HAS_FLASH_LOAD_OFFSET
Emanuele Di Santo865777d2018-11-08 11:28:15 +010016
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040017config BOOT_USE_MBEDTLS
18 bool
19 # Hidden option
20 default n
21 help
22 Use mbedTLS for crypto primitives.
23
24config BOOT_USE_TINYCRYPT
25 bool
26 # Hidden option
27 default n
Sebastian Bøe913a3852019-01-22 13:53:12 +010028 # When building for ECDSA, we use our own copy of mbedTLS, so the
29 # Zephyr one must not be enabled or the MBEDTLS_CONFIG_FILE macros
30 # will collide.
31 depends on ! MBEDTLS
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040032 help
33 Use TinyCrypt for crypto primitives.
34
Sigvart Hovlandebd05032019-03-21 10:47:32 +010035config BOOT_USE_CC310
36 bool
37 # Hidden option
38 default n
39 # When building for ECDSA, we use our own copy of mbedTLS, so the
40 # Zephyr one must not be enabled or the MBEDTLS_CONFIG_FILE macros
41 # will collide.
42 depends on ! MBEDTLS
43 help
44 Use cc310 for crypto primitives.
45
46config BOOT_USE_NRF_CC310_BL
47 bool
48 default n
49
50config NRFXLIB_CRYPTO
51 bool
52 default n
53
54config NRF_CC310_BL
55 bool
56 default n
57
Andrzej Puzdrowski97543282018-04-12 15:16:56 +020058menu "MCUBoot settings"
59
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040060choice
61 prompt "Signature type"
62 default BOOT_SIGNATURE_TYPE_RSA
63
64config BOOT_SIGNATURE_TYPE_RSA
65 bool "RSA signatures"
66 select BOOT_USE_MBEDTLS
Marti Bolivara4818a52018-04-12 13:02:38 -040067 select MBEDTLS
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040068
Fabio Utzig105b59a2019-05-13 15:08:12 -070069if BOOT_SIGNATURE_TYPE_RSA
70config BOOT_SIGNATURE_TYPE_RSA_LEN
71 int "RSA signature length"
72 range 2048 3072
73 default 2048
74endif
75
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040076config BOOT_SIGNATURE_TYPE_ECDSA_P256
77 bool "Elliptic curve digital signatures with curve P-256"
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040078
Sigvart Hovlandebd05032019-03-21 10:47:32 +010079if BOOT_SIGNATURE_TYPE_ECDSA_P256
80choice
81 prompt "Ecdsa implementation"
82 default BOOT_TINYCRYPT
83config BOOT_TINYCRYPT
84 bool "Use tinycrypt"
85 select BOOT_USE_TINYCRYPT
86config BOOT_CC310
87 bool "Use CC310"
88 select BOOT_USE_NRF_CC310_BL if HAS_HW_NRF_CC310
89 select NRF_CC310_BL if HAS_HW_NRF_CC310
90 select NRFXLIB_CRYPTO if SOC_FAMILY_NRF
91 select BOOT_USE_CC310
92endchoice
93endif
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040094endchoice
95
Fabio Utzigc690c762018-04-26 10:51:09 -030096config BOOT_SIGNATURE_KEY_FILE
97 string "PEM key file"
98 default ""
99 help
100 The key file will be parsed by imgtool's getpub command and a .c source
101 with the public key information will be written in a format expected by
102 MCUboot.
103
Marti Bolivara4818a52018-04-12 13:02:38 -0400104config MBEDTLS_CFG_FILE
105 default "mcuboot-mbedtls-cfg.h"
106
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400107config BOOT_VALIDATE_SLOT0
David Vincze2d736ad2019-02-18 11:50:22 +0100108 bool "Validate image in the primary slot on every boot"
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400109 default y
110 help
David Vincze2d736ad2019-02-18 11:50:22 +0100111 If y, the bootloader attempts to validate the signature of the
112 primary slot every boot. This adds the signature check time to
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400113 every boot, but can mitigate against some changes that are
114 able to modify the flash image itself.
115
116config BOOT_UPGRADE_ONLY
117 bool "Overwrite image updates instead of swapping"
118 default n
119 help
David Vincze2d736ad2019-02-18 11:50:22 +0100120 If y, overwrite the primary slot with the upgrade image instead
121 of swapping them. This prevents the fallback recovery, but
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400122 uses a much simpler code path.
123
Fabio Utzigd0533ed2018-12-19 07:56:33 -0200124config BOOT_BOOTSTRAP
David Vincze2d736ad2019-02-18 11:50:22 +0100125 bool "Boostrap erased the primary slot from the secondary slot"
Fabio Utzigd0533ed2018-12-19 07:56:33 -0200126 default n
127 help
128 If y, enables bootstraping support. Bootstrapping allows an erased
David Vincze2d736ad2019-02-18 11:50:22 +0100129 primary slot to be initialized from a valid image in the secondary slot.
Fabio Utzigd0533ed2018-12-19 07:56:33 -0200130 If unsure, leave at the default value.
131
Fabio Utzig5fe874c2018-08-31 07:41:50 -0300132config BOOT_ENCRYPT_RSA
133 bool "Support for encrypted upgrade images"
134 default n
135 help
David Vincze2d736ad2019-02-18 11:50:22 +0100136 If y, images in the secondary slot can be encrypted and are decrypted
137 on the fly when upgrading to the primary slot, as well as encrypted
138 back when swapping from the primary slot to the secondary slot.
Fabio Utzig5fe874c2018-08-31 07:41:50 -0300139
Marti Bolivar0e091c92018-04-12 11:23:16 -0400140config BOOT_MAX_IMG_SECTORS
141 int "Maximum number of sectors per image slot"
142 default 128
143 help
144 This option controls the maximum number of sectors that each of
145 the two image areas can contain. Smaller values reduce MCUboot's
146 memory usage; larger values allow it to support larger images.
147 If unsure, leave at the default value.
148
Emanuele Di Santo205c8c62018-07-20 11:42:31 +0200149config BOOT_ERASE_PROGRESSIVELY
150 bool "Erase flash progressively when receiving new firmware"
151 default y if SOC_NRF52840
152 help
153 If enabled, flash is erased as necessary when receiving new firmware,
154 instead of erasing the whole image slot at once. This is necessary
155 on some hardware that has long erase times, to prevent long wait
156 times at the beginning of the DFU process.
157
Rajavardhan Gundi51c9d702019-02-20 14:08:52 +0530158config BOOT_WAIT_FOR_USB_DFU
159 bool "Wait for a prescribed duration to see if USB DFU is invoked"
160 default n
161 select USB
162 select USB_DFU_CLASS
163 select IMG_MANAGER
164 help
165 If y, MCUboot waits for a prescribed duration of time to allow
166 for USB DFU to be invoked. Please note DFU always updates the
167 slot1 image.
168
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400169config ZEPHYR_TRY_MASS_ERASE
170 bool "Try to mass erase flash when flashing MCUboot image"
171 default y
172 help
173 If y, attempt to configure the Zephyr build system's "flash"
174 target to mass-erase the flash device before flashing the
175 MCUboot image. This ensures the scratch and other partitions
176 are in a consistent state.
177
178 This is not available for all targets.
179
Michael Scott74ceae52019-02-01 14:01:09 -0800180module = MCUBOOT
Piotr Mienkowski15aa6ef2019-04-08 22:48:15 +0200181module-str = MCUBoot bootloader
Michael Scott74ceae52019-02-01 14:01:09 -0800182source "subsys/logging/Kconfig.template.log_config"
Michael Scott74ceae52019-02-01 14:01:09 -0800183
Marti Bolivar0e091c92018-04-12 11:23:16 -0400184menuconfig MCUBOOT_SERIAL
185 bool "MCUboot serial recovery"
186 default n
187 select REBOOT
Emanuele Di Santo30a92652019-01-16 14:01:08 +0100188 select GPIO
Marti Bolivar0e091c92018-04-12 11:23:16 -0400189 select SERIAL
Emanuele Di Santo30a92652019-01-16 14:01:08 +0100190 select UART_INTERRUPT_DRIVEN
Marti Bolivar0e091c92018-04-12 11:23:16 -0400191 select BASE64
192 select TINYCBOR
193 help
194 If y, enables a serial-port based update mode. This allows
195 MCUboot itself to load update images into flash over a UART.
196 If unsure, leave at the default value.
197
198if MCUBOOT_SERIAL
199
Emanuele Di Santoc4bf7802018-07-20 11:39:57 +0200200choice
201 prompt "Serial device"
202 default BOOT_SERIAL_UART if !BOARD_NRF52840_PCA10059
203 default BOOT_SERIAL_CDC_ACM if BOARD_NRF52840_PCA10059
204
205config BOOT_SERIAL_UART
206 bool "UART"
207 # SERIAL and UART_INTERRUPT_DRIVEN already selected
208
209config BOOT_SERIAL_CDC_ACM
210 bool "CDC ACM"
211 select USB
212 select USB_DEVICE_STACK
213 select USB_CDC_ACM
214
215endchoice
216
Marti Bolivar0e091c92018-04-12 11:23:16 -0400217config BOOT_MAX_LINE_INPUT_LEN
218 int "Maximum command line length"
219 default 512
220 help
221 Maximum length of commands transported over the serial port.
222
223config BOOT_SERIAL_DETECT_PORT
224 string "GPIO device to trigger serial recovery mode"
225 default GPIO_0 if SOC_FAMILY_NRF
226 help
227 Zephyr GPIO device which contains the pin used to trigger
228 serial recovery mode.
229
230config BOOT_SERIAL_DETECT_PIN
231 int "Pin to trigger serial recovery mode"
Andreas Vibeto704b8ba2019-04-25 10:51:23 +0200232 default 6 if BOARD_NRF9160_PCA10090
Marti Bolivar0e091c92018-04-12 11:23:16 -0400233 default 11 if BOARD_NRF52840_PCA10056
234 default 13 if BOARD_NRF52_PCA10040
235 help
236 Pin on the serial detect port which triggers serial recovery mode.
237
238config BOOT_SERIAL_DETECT_PIN_VAL
239 int "Serial detect pin trigger value"
240 default 0
241 range 0 1
242 help
243 Logic value of the detect pin which triggers serial recovery
244 mode.
245
246endif # MCUBOOT_SERIAL
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200247
Andrzej Puzdrowski97543282018-04-12 15:16:56 +0200248endmenu
249
Carles Cufi84ede582018-01-29 15:12:00 +0100250config MCUBOOT_DEVICE_SETTINGS
251 # Hidden selector for device-specific settings
252 bool
253 default y
254 # CPU options
255 select MCUBOOT_DEVICE_CPU_CORTEX_M0 if CPU_CORTEX_M0
Carles Cufi67c792e2018-01-29 15:14:31 +0100256 # Enable flash page layout if available
257 select FLASH_PAGE_LAYOUT if FLASH_HAS_PAGE_LAYOUT
Andrzej Puzdrowskib788c712018-04-12 12:42:49 +0200258 # Enable flash_map module as flash I/O back-end
259 select FLASH_MAP
Carles Cufi84ede582018-01-29 15:12:00 +0100260
261config MCUBOOT_DEVICE_CPU_CORTEX_M0
262 # Hidden selector for Cortex-M0 settings
263 bool
264 default n
265 select SW_VECTOR_RELAY if !CPU_CORTEX_M0_HAS_VECTOR_TABLE_REMAP
266
Marti Bolivar0e091c92018-04-12 11:23:16 -0400267comment "Zephyr configuration options"
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200268
Marti Bolivar0e091c92018-04-12 11:23:16 -0400269config ZEPHYR_BASE
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200270 string
Marti Bolivar0e091c92018-04-12 11:23:16 -0400271 option env="ZEPHYR_BASE"
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200272
Marti Bolivar0e091c92018-04-12 11:23:16 -0400273source "$ZEPHYR_BASE/Kconfig.zephyr"