blob: b44ca68d8db7dc2a0c1d5249f545de2fe16fa9f6 [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
Andrzej Puzdrowski97543282018-04-12 15:16:56 +020047menu "MCUBoot settings"
48
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040049choice
50 prompt "Signature type"
51 default BOOT_SIGNATURE_TYPE_RSA
52
53config BOOT_SIGNATURE_TYPE_RSA
54 bool "RSA signatures"
55 select BOOT_USE_MBEDTLS
Marti Bolivara4818a52018-04-12 13:02:38 -040056 select MBEDTLS
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040057
58config BOOT_SIGNATURE_TYPE_ECDSA_P256
59 bool "Elliptic curve digital signatures with curve P-256"
60 select BOOT_USE_TINYCRYPT
61
62endchoice
63
Fabio Utzigc690c762018-04-26 10:51:09 -030064config BOOT_SIGNATURE_KEY_FILE
65 string "PEM key file"
66 default ""
67 help
68 The key file will be parsed by imgtool's getpub command and a .c source
69 with the public key information will be written in a format expected by
70 MCUboot.
71
Marti Bolivara4818a52018-04-12 13:02:38 -040072config MBEDTLS_CFG_FILE
73 default "mcuboot-mbedtls-cfg.h"
74
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040075config BOOT_VALIDATE_SLOT0
David Vincze2d736ad2019-02-18 11:50:22 +010076 bool "Validate image in the primary slot on every boot"
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040077 default y
78 help
David Vincze2d736ad2019-02-18 11:50:22 +010079 If y, the bootloader attempts to validate the signature of the
80 primary slot every boot. This adds the signature check time to
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040081 every boot, but can mitigate against some changes that are
82 able to modify the flash image itself.
83
84config BOOT_UPGRADE_ONLY
85 bool "Overwrite image updates instead of swapping"
86 default n
87 help
David Vincze2d736ad2019-02-18 11:50:22 +010088 If y, overwrite the primary slot with the upgrade image instead
89 of swapping them. This prevents the fallback recovery, but
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040090 uses a much simpler code path.
91
Fabio Utzigd0533ed2018-12-19 07:56:33 -020092config BOOT_BOOTSTRAP
David Vincze2d736ad2019-02-18 11:50:22 +010093 bool "Boostrap erased the primary slot from the secondary slot"
Fabio Utzigd0533ed2018-12-19 07:56:33 -020094 default n
95 help
96 If y, enables bootstraping support. Bootstrapping allows an erased
David Vincze2d736ad2019-02-18 11:50:22 +010097 primary slot to be initialized from a valid image in the secondary slot.
Fabio Utzigd0533ed2018-12-19 07:56:33 -020098 If unsure, leave at the default value.
99
Fabio Utzig5fe874c2018-08-31 07:41:50 -0300100config BOOT_ENCRYPT_RSA
101 bool "Support for encrypted upgrade images"
102 default n
103 help
David Vincze2d736ad2019-02-18 11:50:22 +0100104 If y, images in the secondary slot can be encrypted and are decrypted
105 on the fly when upgrading to the primary slot, as well as encrypted
106 back when swapping from the primary slot to the secondary slot.
Fabio Utzig5fe874c2018-08-31 07:41:50 -0300107
Marti Bolivar0e091c92018-04-12 11:23:16 -0400108config BOOT_MAX_IMG_SECTORS
109 int "Maximum number of sectors per image slot"
110 default 128
111 help
112 This option controls the maximum number of sectors that each of
113 the two image areas can contain. Smaller values reduce MCUboot's
114 memory usage; larger values allow it to support larger images.
115 If unsure, leave at the default value.
116
Emanuele Di Santo205c8c62018-07-20 11:42:31 +0200117config BOOT_ERASE_PROGRESSIVELY
118 bool "Erase flash progressively when receiving new firmware"
119 default y if SOC_NRF52840
120 help
121 If enabled, flash is erased as necessary when receiving new firmware,
122 instead of erasing the whole image slot at once. This is necessary
123 on some hardware that has long erase times, to prevent long wait
124 times at the beginning of the DFU process.
125
Rajavardhan Gundi51c9d702019-02-20 14:08:52 +0530126config BOOT_WAIT_FOR_USB_DFU
127 bool "Wait for a prescribed duration to see if USB DFU is invoked"
128 default n
129 select USB
130 select USB_DFU_CLASS
131 select IMG_MANAGER
132 help
133 If y, MCUboot waits for a prescribed duration of time to allow
134 for USB DFU to be invoked. Please note DFU always updates the
135 slot1 image.
136
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400137config ZEPHYR_TRY_MASS_ERASE
138 bool "Try to mass erase flash when flashing MCUboot image"
139 default y
140 help
141 If y, attempt to configure the Zephyr build system's "flash"
142 target to mass-erase the flash device before flashing the
143 MCUboot image. This ensures the scratch and other partitions
144 are in a consistent state.
145
146 This is not available for all targets.
147
Fabio Utzig9a4b9ba2018-05-07 08:31:27 -0300148config BOOT_HAVE_LOGGING
149 bool "MCUboot have logging enabled"
150 default y
Emanuele Di Santo9f1933d2018-11-20 10:59:59 +0100151 select LOG
Michael Scottcef44272019-02-01 11:12:15 -0800152 select LOG_IMMEDIATE
Fabio Utzig9a4b9ba2018-05-07 08:31:27 -0300153 help
154 If y, enables logging on the serial port. The log level can
Michael Scott74ceae52019-02-01 14:01:09 -0800155 be defined by setting `CONFIG_MCUBOOT_LOG_LEVEL_*`.
Fabio Utzig9a4b9ba2018-05-07 08:31:27 -0300156 If unsure, leave at the default value.
157
Michael Scott74ceae52019-02-01 14:01:09 -0800158if BOOT_HAVE_LOGGING
159module = MCUBOOT
160module-dep = LOG
161module-str = Log level for MCUBOOT application
162source "subsys/logging/Kconfig.template.log_config"
163endif
164
Marti Bolivar0e091c92018-04-12 11:23:16 -0400165menuconfig MCUBOOT_SERIAL
166 bool "MCUboot serial recovery"
167 default n
168 select REBOOT
Emanuele Di Santo30a92652019-01-16 14:01:08 +0100169 select GPIO
Marti Bolivar0e091c92018-04-12 11:23:16 -0400170 select SERIAL
Emanuele Di Santo30a92652019-01-16 14:01:08 +0100171 select UART_INTERRUPT_DRIVEN
Marti Bolivar0e091c92018-04-12 11:23:16 -0400172 select BASE64
173 select TINYCBOR
174 help
175 If y, enables a serial-port based update mode. This allows
176 MCUboot itself to load update images into flash over a UART.
177 If unsure, leave at the default value.
178
179if MCUBOOT_SERIAL
180
Emanuele Di Santoc4bf7802018-07-20 11:39:57 +0200181choice
182 prompt "Serial device"
183 default BOOT_SERIAL_UART if !BOARD_NRF52840_PCA10059
184 default BOOT_SERIAL_CDC_ACM if BOARD_NRF52840_PCA10059
185
186config BOOT_SERIAL_UART
187 bool "UART"
188 # SERIAL and UART_INTERRUPT_DRIVEN already selected
189
190config BOOT_SERIAL_CDC_ACM
191 bool "CDC ACM"
192 select USB
193 select USB_DEVICE_STACK
194 select USB_CDC_ACM
195
196endchoice
197
Marti Bolivar0e091c92018-04-12 11:23:16 -0400198config BOOT_MAX_LINE_INPUT_LEN
199 int "Maximum command line length"
200 default 512
201 help
202 Maximum length of commands transported over the serial port.
203
204config BOOT_SERIAL_DETECT_PORT
205 string "GPIO device to trigger serial recovery mode"
206 default GPIO_0 if SOC_FAMILY_NRF
207 help
208 Zephyr GPIO device which contains the pin used to trigger
209 serial recovery mode.
210
211config BOOT_SERIAL_DETECT_PIN
212 int "Pin to trigger serial recovery mode"
213 default 11 if BOARD_NRF52840_PCA10056
214 default 13 if BOARD_NRF52_PCA10040
215 help
216 Pin on the serial detect port which triggers serial recovery mode.
217
218config BOOT_SERIAL_DETECT_PIN_VAL
219 int "Serial detect pin trigger value"
220 default 0
221 range 0 1
222 help
223 Logic value of the detect pin which triggers serial recovery
224 mode.
225
226endif # MCUBOOT_SERIAL
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200227
Andrzej Puzdrowski97543282018-04-12 15:16:56 +0200228endmenu
229
Carles Cufi84ede582018-01-29 15:12:00 +0100230config MCUBOOT_DEVICE_SETTINGS
231 # Hidden selector for device-specific settings
232 bool
233 default y
234 # CPU options
235 select MCUBOOT_DEVICE_CPU_CORTEX_M0 if CPU_CORTEX_M0
Carles Cufi67c792e2018-01-29 15:14:31 +0100236 # Enable flash page layout if available
237 select FLASH_PAGE_LAYOUT if FLASH_HAS_PAGE_LAYOUT
Andrzej Puzdrowskib788c712018-04-12 12:42:49 +0200238 # Enable flash_map module as flash I/O back-end
239 select FLASH_MAP
Carles Cufi84ede582018-01-29 15:12:00 +0100240
241config MCUBOOT_DEVICE_CPU_CORTEX_M0
242 # Hidden selector for Cortex-M0 settings
243 bool
244 default n
245 select SW_VECTOR_RELAY if !CPU_CORTEX_M0_HAS_VECTOR_TABLE_REMAP
246
Marti Bolivar0e091c92018-04-12 11:23:16 -0400247comment "Zephyr configuration options"
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200248
Marti Bolivar0e091c92018-04-12 11:23:16 -0400249config ZEPHYR_BASE
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200250 string
Marti Bolivar0e091c92018-04-12 11:23:16 -0400251 option env="ZEPHYR_BASE"
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200252
Marti Bolivar0e091c92018-04-12 11:23:16 -0400253source "$ZEPHYR_BASE/Kconfig.zephyr"