blob: e87db5a7b9b0ad3651b87c9e5762783747b0b5d3 [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
Emanuele Di Santo865777d2018-11-08 11:28:15 +010015
Emanuele Di Santoa0ed10b2019-01-03 16:47:38 +010016if BOARD_HAS_NRF5_BOOTLOADER
17
18# When compiling MCUBoot, the image will be linked to the boot partition.
19# Override .text offset to make sure it is set to zero.
20# This is necessary when other bootloaders set a different default for
21# application images which are not bootloaders.
22
23config TEXT_SECTION_OFFSET
24 default 0x00
25
26endif # BOARD_HAS_NRF5_BOOTLOADER
27
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040028config BOOT_USE_MBEDTLS
29 bool
30 # Hidden option
31 default n
32 help
33 Use mbedTLS for crypto primitives.
34
35config BOOT_USE_TINYCRYPT
36 bool
37 # Hidden option
38 default n
39 help
40 Use TinyCrypt for crypto primitives.
41
Andrzej Puzdrowski97543282018-04-12 15:16:56 +020042menu "MCUBoot settings"
43
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040044choice
45 prompt "Signature type"
46 default BOOT_SIGNATURE_TYPE_RSA
47
48config BOOT_SIGNATURE_TYPE_RSA
49 bool "RSA signatures"
50 select BOOT_USE_MBEDTLS
Marti Bolivara4818a52018-04-12 13:02:38 -040051 select MBEDTLS
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040052
53config BOOT_SIGNATURE_TYPE_ECDSA_P256
54 bool "Elliptic curve digital signatures with curve P-256"
55 select BOOT_USE_TINYCRYPT
56
57endchoice
58
Fabio Utzigc690c762018-04-26 10:51:09 -030059config BOOT_SIGNATURE_KEY_FILE
60 string "PEM key file"
61 default ""
62 help
63 The key file will be parsed by imgtool's getpub command and a .c source
64 with the public key information will be written in a format expected by
65 MCUboot.
66
Marti Bolivara4818a52018-04-12 13:02:38 -040067config MBEDTLS_CFG_FILE
68 default "mcuboot-mbedtls-cfg.h"
69
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040070config BOOT_VALIDATE_SLOT0
71 bool "Validate image slot 0 on every boot"
72 default y
73 help
74 If y, the bootloader attempts to validate the signature of
75 slot0 every boot. This adds the signature check time to
76 every boot, but can mitigate against some changes that are
77 able to modify the flash image itself.
78
79config BOOT_UPGRADE_ONLY
80 bool "Overwrite image updates instead of swapping"
81 default n
82 help
83 If y, overwrite slot0 with the upgrade image instead of
84 swapping them. This prevents the fallback recovery, but
85 uses a much simpler code path.
86
Fabio Utzigd0533ed2018-12-19 07:56:33 -020087config BOOT_BOOTSTRAP
88 bool "Boostrap erased slot0 from slot1"
89 default n
90 help
91 If y, enables bootstraping support. Bootstrapping allows an erased
92 slot0 to be initialized from a valid image in slot1.
93 If unsure, leave at the default value.
94
Fabio Utzig5fe874c2018-08-31 07:41:50 -030095config BOOT_ENCRYPT_RSA
96 bool "Support for encrypted upgrade images"
97 default n
98 help
99 If y, images in slot 1 can be encrypted and are decrypted
100 on the fly when upgrading to slot 0, as well as encrypted
101 back when swapping from slot 0 to slot 1.
102
Marti Bolivar0e091c92018-04-12 11:23:16 -0400103config BOOT_MAX_IMG_SECTORS
104 int "Maximum number of sectors per image slot"
105 default 128
106 help
107 This option controls the maximum number of sectors that each of
108 the two image areas can contain. Smaller values reduce MCUboot's
109 memory usage; larger values allow it to support larger images.
110 If unsure, leave at the default value.
111
Emanuele Di Santo205c8c62018-07-20 11:42:31 +0200112config BOOT_ERASE_PROGRESSIVELY
113 bool "Erase flash progressively when receiving new firmware"
114 default y if SOC_NRF52840
115 help
116 If enabled, flash is erased as necessary when receiving new firmware,
117 instead of erasing the whole image slot at once. This is necessary
118 on some hardware that has long erase times, to prevent long wait
119 times at the beginning of the DFU process.
120
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400121config ZEPHYR_TRY_MASS_ERASE
122 bool "Try to mass erase flash when flashing MCUboot image"
123 default y
124 help
125 If y, attempt to configure the Zephyr build system's "flash"
126 target to mass-erase the flash device before flashing the
127 MCUboot image. This ensures the scratch and other partitions
128 are in a consistent state.
129
130 This is not available for all targets.
131
Fabio Utzig9a4b9ba2018-05-07 08:31:27 -0300132config BOOT_HAVE_LOGGING
133 bool "MCUboot have logging enabled"
134 default y
135 select SYS_LOG
136 help
137 If y, enables logging on the serial port. The log level can
138 be defined by setting `SYS_LOG_DEFAULT_LEVEL`.
139 If unsure, leave at the default value.
140
Marti Bolivar0e091c92018-04-12 11:23:16 -0400141menuconfig MCUBOOT_SERIAL
142 bool "MCUboot serial recovery"
143 default n
144 select REBOOT
145 select UART_INTERRUPT_DRIVEN
146 select SERIAL
147 select BASE64
148 select TINYCBOR
149 help
150 If y, enables a serial-port based update mode. This allows
151 MCUboot itself to load update images into flash over a UART.
152 If unsure, leave at the default value.
153
154if MCUBOOT_SERIAL
155
Emanuele Di Santoc4bf7802018-07-20 11:39:57 +0200156choice
157 prompt "Serial device"
158 default BOOT_SERIAL_UART if !BOARD_NRF52840_PCA10059
159 default BOOT_SERIAL_CDC_ACM if BOARD_NRF52840_PCA10059
160
161config BOOT_SERIAL_UART
162 bool "UART"
163 # SERIAL and UART_INTERRUPT_DRIVEN already selected
164
165config BOOT_SERIAL_CDC_ACM
166 bool "CDC ACM"
167 select USB
168 select USB_DEVICE_STACK
169 select USB_CDC_ACM
170
171endchoice
172
Marti Bolivar0e091c92018-04-12 11:23:16 -0400173config BOOT_MAX_LINE_INPUT_LEN
174 int "Maximum command line length"
175 default 512
176 help
177 Maximum length of commands transported over the serial port.
178
179config BOOT_SERIAL_DETECT_PORT
180 string "GPIO device to trigger serial recovery mode"
181 default GPIO_0 if SOC_FAMILY_NRF
182 help
183 Zephyr GPIO device which contains the pin used to trigger
184 serial recovery mode.
185
186config BOOT_SERIAL_DETECT_PIN
187 int "Pin to trigger serial recovery mode"
188 default 11 if BOARD_NRF52840_PCA10056
189 default 13 if BOARD_NRF52_PCA10040
190 help
191 Pin on the serial detect port which triggers serial recovery mode.
192
193config BOOT_SERIAL_DETECT_PIN_VAL
194 int "Serial detect pin trigger value"
195 default 0
196 range 0 1
197 help
198 Logic value of the detect pin which triggers serial recovery
199 mode.
200
201endif # MCUBOOT_SERIAL
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200202
Andrzej Puzdrowski97543282018-04-12 15:16:56 +0200203endmenu
204
Carles Cufi84ede582018-01-29 15:12:00 +0100205config MCUBOOT_DEVICE_SETTINGS
206 # Hidden selector for device-specific settings
207 bool
208 default y
209 # CPU options
210 select MCUBOOT_DEVICE_CPU_CORTEX_M0 if CPU_CORTEX_M0
Carles Cufi67c792e2018-01-29 15:14:31 +0100211 # Enable flash page layout if available
212 select FLASH_PAGE_LAYOUT if FLASH_HAS_PAGE_LAYOUT
Andrzej Puzdrowskib788c712018-04-12 12:42:49 +0200213 # Enable flash_map module as flash I/O back-end
214 select FLASH_MAP
Carles Cufi84ede582018-01-29 15:12:00 +0100215
216config MCUBOOT_DEVICE_CPU_CORTEX_M0
217 # Hidden selector for Cortex-M0 settings
218 bool
219 default n
220 select SW_VECTOR_RELAY if !CPU_CORTEX_M0_HAS_VECTOR_TABLE_REMAP
221
Marti Bolivar0e091c92018-04-12 11:23:16 -0400222comment "Zephyr configuration options"
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200223
Marti Bolivar0e091c92018-04-12 11:23:16 -0400224config ZEPHYR_BASE
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200225 string
Marti Bolivar0e091c92018-04-12 11:23:16 -0400226 option env="ZEPHYR_BASE"
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200227
Marti Bolivar0e091c92018-04-12 11:23:16 -0400228source "$ZEPHYR_BASE/Kconfig.zephyr"