blob: ac0176d85cd2edcea3e3d92a9df3c2133d3d3da5 [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
Emanuele Di Santoa0ed10b2019-01-03 16:47:38 +010017if BOARD_HAS_NRF5_BOOTLOADER
18
19# When compiling MCUBoot, the image will be linked to the boot partition.
20# Override .text offset to make sure it is set to zero.
21# This is necessary when other bootloaders set a different default for
22# application images which are not bootloaders.
23
24config TEXT_SECTION_OFFSET
25 default 0x00
26
27endif # BOARD_HAS_NRF5_BOOTLOADER
28
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040029config BOOT_USE_MBEDTLS
30 bool
31 # Hidden option
32 default n
33 help
34 Use mbedTLS for crypto primitives.
35
36config BOOT_USE_TINYCRYPT
37 bool
38 # Hidden option
39 default n
Sebastian Bøe913a3852019-01-22 13:53:12 +010040 # 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.
43 depends on ! MBEDTLS
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040044 help
45 Use TinyCrypt for crypto primitives.
46
Sigvart Hovlandebd05032019-03-21 10:47:32 +010047config BOOT_USE_CC310
48 bool
49 # Hidden option
50 default n
51 # When building for ECDSA, we use our own copy of mbedTLS, so the
52 # Zephyr one must not be enabled or the MBEDTLS_CONFIG_FILE macros
53 # will collide.
54 depends on ! MBEDTLS
55 help
56 Use cc310 for crypto primitives.
57
58config BOOT_USE_NRF_CC310_BL
59 bool
60 default n
61
62config NRFXLIB_CRYPTO
63 bool
64 default n
65
66config NRF_CC310_BL
67 bool
68 default n
69
Andrzej Puzdrowski97543282018-04-12 15:16:56 +020070menu "MCUBoot settings"
71
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040072choice
73 prompt "Signature type"
74 default BOOT_SIGNATURE_TYPE_RSA
75
76config 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
81config BOOT_SIGNATURE_TYPE_ECDSA_P256
82 bool "Elliptic curve digital signatures with curve P-256"
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040083
Sigvart Hovlandebd05032019-03-21 10:47:32 +010084if BOOT_SIGNATURE_TYPE_ECDSA_P256
85choice
86 prompt "Ecdsa implementation"
87 default BOOT_TINYCRYPT
88config BOOT_TINYCRYPT
89 bool "Use tinycrypt"
90 select BOOT_USE_TINYCRYPT
91config BOOT_CC310
92 bool "Use CC310"
93 select BOOT_USE_NRF_CC310_BL if HAS_HW_NRF_CC310
94 select NRF_CC310_BL if HAS_HW_NRF_CC310
95 select NRFXLIB_CRYPTO if SOC_FAMILY_NRF
96 select BOOT_USE_CC310
97endchoice
98endif
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040099endchoice
100
Fabio Utzigc690c762018-04-26 10:51:09 -0300101config BOOT_SIGNATURE_KEY_FILE
102 string "PEM key file"
103 default ""
104 help
105 The key file will be parsed by imgtool's getpub command and a .c source
106 with the public key information will be written in a format expected by
107 MCUboot.
108
Marti Bolivara4818a52018-04-12 13:02:38 -0400109config MBEDTLS_CFG_FILE
110 default "mcuboot-mbedtls-cfg.h"
111
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400112config BOOT_VALIDATE_SLOT0
David Vincze2d736ad2019-02-18 11:50:22 +0100113 bool "Validate image in the primary slot on every boot"
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400114 default y
115 help
David Vincze2d736ad2019-02-18 11:50:22 +0100116 If y, the bootloader attempts to validate the signature of the
117 primary slot every boot. This adds the signature check time to
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400118 every boot, but can mitigate against some changes that are
119 able to modify the flash image itself.
120
121config BOOT_UPGRADE_ONLY
122 bool "Overwrite image updates instead of swapping"
123 default n
124 help
David Vincze2d736ad2019-02-18 11:50:22 +0100125 If y, overwrite the primary slot with the upgrade image instead
126 of swapping them. This prevents the fallback recovery, but
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400127 uses a much simpler code path.
128
Fabio Utzigd0533ed2018-12-19 07:56:33 -0200129config BOOT_BOOTSTRAP
David Vincze2d736ad2019-02-18 11:50:22 +0100130 bool "Boostrap erased the primary slot from the secondary slot"
Fabio Utzigd0533ed2018-12-19 07:56:33 -0200131 default n
132 help
133 If y, enables bootstraping support. Bootstrapping allows an erased
David Vincze2d736ad2019-02-18 11:50:22 +0100134 primary slot to be initialized from a valid image in the secondary slot.
Fabio Utzigd0533ed2018-12-19 07:56:33 -0200135 If unsure, leave at the default value.
136
Fabio Utzig5fe874c2018-08-31 07:41:50 -0300137config BOOT_ENCRYPT_RSA
138 bool "Support for encrypted upgrade images"
139 default n
140 help
David Vincze2d736ad2019-02-18 11:50:22 +0100141 If y, images in the secondary slot can be encrypted and are decrypted
142 on the fly when upgrading to the primary slot, as well as encrypted
143 back when swapping from the primary slot to the secondary slot.
Fabio Utzig5fe874c2018-08-31 07:41:50 -0300144
Marti Bolivar0e091c92018-04-12 11:23:16 -0400145config BOOT_MAX_IMG_SECTORS
146 int "Maximum number of sectors per image slot"
147 default 128
148 help
149 This option controls the maximum number of sectors that each of
150 the two image areas can contain. Smaller values reduce MCUboot's
151 memory usage; larger values allow it to support larger images.
152 If unsure, leave at the default value.
153
Emanuele Di Santo205c8c62018-07-20 11:42:31 +0200154config BOOT_ERASE_PROGRESSIVELY
155 bool "Erase flash progressively when receiving new firmware"
156 default y if SOC_NRF52840
157 help
158 If enabled, flash is erased as necessary when receiving new firmware,
159 instead of erasing the whole image slot at once. This is necessary
160 on some hardware that has long erase times, to prevent long wait
161 times at the beginning of the DFU process.
162
Rajavardhan Gundi51c9d702019-02-20 14:08:52 +0530163config BOOT_WAIT_FOR_USB_DFU
164 bool "Wait for a prescribed duration to see if USB DFU is invoked"
165 default n
166 select USB
167 select USB_DFU_CLASS
168 select IMG_MANAGER
169 help
170 If y, MCUboot waits for a prescribed duration of time to allow
171 for USB DFU to be invoked. Please note DFU always updates the
172 slot1 image.
173
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400174config ZEPHYR_TRY_MASS_ERASE
175 bool "Try to mass erase flash when flashing MCUboot image"
176 default y
177 help
178 If y, attempt to configure the Zephyr build system's "flash"
179 target to mass-erase the flash device before flashing the
180 MCUboot image. This ensures the scratch and other partitions
181 are in a consistent state.
182
183 This is not available for all targets.
184
Fabio Utzig9a4b9ba2018-05-07 08:31:27 -0300185config BOOT_HAVE_LOGGING
186 bool "MCUboot have logging enabled"
187 default y
Emanuele Di Santo9f1933d2018-11-20 10:59:59 +0100188 select LOG
Michael Scottcef44272019-02-01 11:12:15 -0800189 select LOG_IMMEDIATE
Fabio Utzig9a4b9ba2018-05-07 08:31:27 -0300190 help
191 If y, enables logging on the serial port. The log level can
Michael Scott74ceae52019-02-01 14:01:09 -0800192 be defined by setting `CONFIG_MCUBOOT_LOG_LEVEL_*`.
Fabio Utzig9a4b9ba2018-05-07 08:31:27 -0300193 If unsure, leave at the default value.
194
Michael Scott74ceae52019-02-01 14:01:09 -0800195if BOOT_HAVE_LOGGING
196module = MCUBOOT
197module-dep = LOG
198module-str = Log level for MCUBOOT application
199source "subsys/logging/Kconfig.template.log_config"
200endif
201
Marti Bolivar0e091c92018-04-12 11:23:16 -0400202menuconfig MCUBOOT_SERIAL
203 bool "MCUboot serial recovery"
204 default n
205 select REBOOT
Emanuele Di Santo30a92652019-01-16 14:01:08 +0100206 select GPIO
Marti Bolivar0e091c92018-04-12 11:23:16 -0400207 select SERIAL
Emanuele Di Santo30a92652019-01-16 14:01:08 +0100208 select UART_INTERRUPT_DRIVEN
Marti Bolivar0e091c92018-04-12 11:23:16 -0400209 select BASE64
210 select TINYCBOR
211 help
212 If y, enables a serial-port based update mode. This allows
213 MCUboot itself to load update images into flash over a UART.
214 If unsure, leave at the default value.
215
216if MCUBOOT_SERIAL
217
Emanuele Di Santoc4bf7802018-07-20 11:39:57 +0200218choice
219 prompt "Serial device"
220 default BOOT_SERIAL_UART if !BOARD_NRF52840_PCA10059
221 default BOOT_SERIAL_CDC_ACM if BOARD_NRF52840_PCA10059
222
223config BOOT_SERIAL_UART
224 bool "UART"
225 # SERIAL and UART_INTERRUPT_DRIVEN already selected
226
227config BOOT_SERIAL_CDC_ACM
228 bool "CDC ACM"
229 select USB
230 select USB_DEVICE_STACK
231 select USB_CDC_ACM
232
233endchoice
234
Marti Bolivar0e091c92018-04-12 11:23:16 -0400235config BOOT_MAX_LINE_INPUT_LEN
236 int "Maximum command line length"
237 default 512
238 help
239 Maximum length of commands transported over the serial port.
240
241config BOOT_SERIAL_DETECT_PORT
242 string "GPIO device to trigger serial recovery mode"
243 default GPIO_0 if SOC_FAMILY_NRF
244 help
245 Zephyr GPIO device which contains the pin used to trigger
246 serial recovery mode.
247
248config BOOT_SERIAL_DETECT_PIN
249 int "Pin to trigger serial recovery mode"
250 default 11 if BOARD_NRF52840_PCA10056
251 default 13 if BOARD_NRF52_PCA10040
252 help
253 Pin on the serial detect port which triggers serial recovery mode.
254
255config BOOT_SERIAL_DETECT_PIN_VAL
256 int "Serial detect pin trigger value"
257 default 0
258 range 0 1
259 help
260 Logic value of the detect pin which triggers serial recovery
261 mode.
262
263endif # MCUBOOT_SERIAL
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200264
Andrzej Puzdrowski97543282018-04-12 15:16:56 +0200265endmenu
266
Carles Cufi84ede582018-01-29 15:12:00 +0100267config MCUBOOT_DEVICE_SETTINGS
268 # Hidden selector for device-specific settings
269 bool
270 default y
271 # CPU options
272 select MCUBOOT_DEVICE_CPU_CORTEX_M0 if CPU_CORTEX_M0
Carles Cufi67c792e2018-01-29 15:14:31 +0100273 # Enable flash page layout if available
274 select FLASH_PAGE_LAYOUT if FLASH_HAS_PAGE_LAYOUT
Andrzej Puzdrowskib788c712018-04-12 12:42:49 +0200275 # Enable flash_map module as flash I/O back-end
276 select FLASH_MAP
Carles Cufi84ede582018-01-29 15:12:00 +0100277
278config MCUBOOT_DEVICE_CPU_CORTEX_M0
279 # Hidden selector for Cortex-M0 settings
280 bool
281 default n
282 select SW_VECTOR_RELAY if !CPU_CORTEX_M0_HAS_VECTOR_TABLE_REMAP
283
Marti Bolivar0e091c92018-04-12 11:23:16 -0400284comment "Zephyr configuration options"
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200285
Marti Bolivar0e091c92018-04-12 11:23:16 -0400286config ZEPHYR_BASE
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200287 string
Marti Bolivar0e091c92018-04-12 11:23:16 -0400288 option env="ZEPHYR_BASE"
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200289
Marti Bolivar0e091c92018-04-12 11:23:16 -0400290source "$ZEPHYR_BASE/Kconfig.zephyr"