blob: 77c5b6300fe37323d9ee74585176cf0371fabe4e [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
Sebastian Bøe913a3852019-01-22 13:53:12 +010039 # 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
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040043 help
44 Use TinyCrypt for crypto primitives.
45
Andrzej Puzdrowski97543282018-04-12 15:16:56 +020046menu "MCUBoot settings"
47
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040048choice
49 prompt "Signature type"
50 default BOOT_SIGNATURE_TYPE_RSA
51
52config BOOT_SIGNATURE_TYPE_RSA
53 bool "RSA signatures"
54 select BOOT_USE_MBEDTLS
Marti Bolivara4818a52018-04-12 13:02:38 -040055 select MBEDTLS
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040056
57config BOOT_SIGNATURE_TYPE_ECDSA_P256
58 bool "Elliptic curve digital signatures with curve P-256"
59 select BOOT_USE_TINYCRYPT
60
61endchoice
62
Fabio Utzigc690c762018-04-26 10:51:09 -030063config BOOT_SIGNATURE_KEY_FILE
64 string "PEM key file"
65 default ""
66 help
67 The key file will be parsed by imgtool's getpub command and a .c source
68 with the public key information will be written in a format expected by
69 MCUboot.
70
Marti Bolivara4818a52018-04-12 13:02:38 -040071config MBEDTLS_CFG_FILE
72 default "mcuboot-mbedtls-cfg.h"
73
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -040074config BOOT_VALIDATE_SLOT0
75 bool "Validate image slot 0 on every boot"
76 default y
77 help
78 If y, the bootloader attempts to validate the signature of
79 slot0 every boot. This adds the signature check time to
80 every boot, but can mitigate against some changes that are
81 able to modify the flash image itself.
82
83config BOOT_UPGRADE_ONLY
84 bool "Overwrite image updates instead of swapping"
85 default n
86 help
87 If y, overwrite slot0 with the upgrade image instead of
88 swapping them. This prevents the fallback recovery, but
89 uses a much simpler code path.
90
Fabio Utzigd0533ed2018-12-19 07:56:33 -020091config BOOT_BOOTSTRAP
92 bool "Boostrap erased slot0 from slot1"
93 default n
94 help
95 If y, enables bootstraping support. Bootstrapping allows an erased
96 slot0 to be initialized from a valid image in slot1.
97 If unsure, leave at the default value.
98
Fabio Utzig5fe874c2018-08-31 07:41:50 -030099config BOOT_ENCRYPT_RSA
100 bool "Support for encrypted upgrade images"
101 default n
102 help
103 If y, images in slot 1 can be encrypted and are decrypted
104 on the fly when upgrading to slot 0, as well as encrypted
105 back when swapping from slot 0 to slot 1.
106
Marti Bolivar0e091c92018-04-12 11:23:16 -0400107config BOOT_MAX_IMG_SECTORS
108 int "Maximum number of sectors per image slot"
109 default 128
110 help
111 This option controls the maximum number of sectors that each of
112 the two image areas can contain. Smaller values reduce MCUboot's
113 memory usage; larger values allow it to support larger images.
114 If unsure, leave at the default value.
115
Emanuele Di Santo205c8c62018-07-20 11:42:31 +0200116config BOOT_ERASE_PROGRESSIVELY
117 bool "Erase flash progressively when receiving new firmware"
118 default y if SOC_NRF52840
119 help
120 If enabled, flash is erased as necessary when receiving new firmware,
121 instead of erasing the whole image slot at once. This is necessary
122 on some hardware that has long erase times, to prevent long wait
123 times at the beginning of the DFU process.
124
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400125config ZEPHYR_TRY_MASS_ERASE
126 bool "Try to mass erase flash when flashing MCUboot image"
127 default y
128 help
129 If y, attempt to configure the Zephyr build system's "flash"
130 target to mass-erase the flash device before flashing the
131 MCUboot image. This ensures the scratch and other partitions
132 are in a consistent state.
133
134 This is not available for all targets.
135
Fabio Utzig9a4b9ba2018-05-07 08:31:27 -0300136config BOOT_HAVE_LOGGING
137 bool "MCUboot have logging enabled"
138 default y
Emanuele Di Santo9f1933d2018-11-20 10:59:59 +0100139 select LOG
Michael Scottcef44272019-02-01 11:12:15 -0800140 select LOG_IMMEDIATE
Fabio Utzig9a4b9ba2018-05-07 08:31:27 -0300141 help
142 If y, enables logging on the serial port. The log level can
Michael Scott74ceae52019-02-01 14:01:09 -0800143 be defined by setting `CONFIG_MCUBOOT_LOG_LEVEL_*`.
Fabio Utzig9a4b9ba2018-05-07 08:31:27 -0300144 If unsure, leave at the default value.
145
Michael Scott74ceae52019-02-01 14:01:09 -0800146if BOOT_HAVE_LOGGING
147module = MCUBOOT
148module-dep = LOG
149module-str = Log level for MCUBOOT application
150source "subsys/logging/Kconfig.template.log_config"
151endif
152
Marti Bolivar0e091c92018-04-12 11:23:16 -0400153menuconfig MCUBOOT_SERIAL
154 bool "MCUboot serial recovery"
155 default n
156 select REBOOT
Emanuele Di Santo30a92652019-01-16 14:01:08 +0100157 select GPIO
Marti Bolivar0e091c92018-04-12 11:23:16 -0400158 select SERIAL
Emanuele Di Santo30a92652019-01-16 14:01:08 +0100159 select UART_INTERRUPT_DRIVEN
Marti Bolivar0e091c92018-04-12 11:23:16 -0400160 select BASE64
161 select TINYCBOR
162 help
163 If y, enables a serial-port based update mode. This allows
164 MCUboot itself to load update images into flash over a UART.
165 If unsure, leave at the default value.
166
167if MCUBOOT_SERIAL
168
Emanuele Di Santoc4bf7802018-07-20 11:39:57 +0200169choice
170 prompt "Serial device"
171 default BOOT_SERIAL_UART if !BOARD_NRF52840_PCA10059
172 default BOOT_SERIAL_CDC_ACM if BOARD_NRF52840_PCA10059
173
174config BOOT_SERIAL_UART
175 bool "UART"
176 # SERIAL and UART_INTERRUPT_DRIVEN already selected
177
178config BOOT_SERIAL_CDC_ACM
179 bool "CDC ACM"
180 select USB
181 select USB_DEVICE_STACK
182 select USB_CDC_ACM
183
184endchoice
185
Marti Bolivar0e091c92018-04-12 11:23:16 -0400186config BOOT_MAX_LINE_INPUT_LEN
187 int "Maximum command line length"
188 default 512
189 help
190 Maximum length of commands transported over the serial port.
191
192config BOOT_SERIAL_DETECT_PORT
193 string "GPIO device to trigger serial recovery mode"
194 default GPIO_0 if SOC_FAMILY_NRF
195 help
196 Zephyr GPIO device which contains the pin used to trigger
197 serial recovery mode.
198
199config BOOT_SERIAL_DETECT_PIN
200 int "Pin to trigger serial recovery mode"
201 default 11 if BOARD_NRF52840_PCA10056
202 default 13 if BOARD_NRF52_PCA10040
203 help
204 Pin on the serial detect port which triggers serial recovery mode.
205
206config BOOT_SERIAL_DETECT_PIN_VAL
207 int "Serial detect pin trigger value"
208 default 0
209 range 0 1
210 help
211 Logic value of the detect pin which triggers serial recovery
212 mode.
213
214endif # MCUBOOT_SERIAL
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200215
Andrzej Puzdrowski97543282018-04-12 15:16:56 +0200216endmenu
217
Carles Cufi84ede582018-01-29 15:12:00 +0100218config MCUBOOT_DEVICE_SETTINGS
219 # Hidden selector for device-specific settings
220 bool
221 default y
222 # CPU options
223 select MCUBOOT_DEVICE_CPU_CORTEX_M0 if CPU_CORTEX_M0
Carles Cufi67c792e2018-01-29 15:14:31 +0100224 # Enable flash page layout if available
225 select FLASH_PAGE_LAYOUT if FLASH_HAS_PAGE_LAYOUT
Andrzej Puzdrowskib788c712018-04-12 12:42:49 +0200226 # Enable flash_map module as flash I/O back-end
227 select FLASH_MAP
Carles Cufi84ede582018-01-29 15:12:00 +0100228
229config MCUBOOT_DEVICE_CPU_CORTEX_M0
230 # Hidden selector for Cortex-M0 settings
231 bool
232 default n
233 select SW_VECTOR_RELAY if !CPU_CORTEX_M0_HAS_VECTOR_TABLE_REMAP
234
Marti Bolivar0e091c92018-04-12 11:23:16 -0400235comment "Zephyr configuration options"
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200236
Marti Bolivar0e091c92018-04-12 11:23:16 -0400237config ZEPHYR_BASE
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200238 string
Marti Bolivar0e091c92018-04-12 11:23:16 -0400239 option env="ZEPHYR_BASE"
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200240
Marti Bolivar0e091c92018-04-12 11:23:16 -0400241source "$ZEPHYR_BASE/Kconfig.zephyr"