blob: 29193d12e7ca1ce6d0ca925810492678e7121fe4 [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
Rajavardhan Gundi51c9d702019-02-20 14:08:52 +0530125config BOOT_WAIT_FOR_USB_DFU
126 bool "Wait for a prescribed duration to see if USB DFU is invoked"
127 default n
128 select USB
129 select USB_DFU_CLASS
130 select IMG_MANAGER
131 help
132 If y, MCUboot waits for a prescribed duration of time to allow
133 for USB DFU to be invoked. Please note DFU always updates the
134 slot1 image.
135
Marti Bolivarbc2fa4e2018-04-12 12:18:32 -0400136config ZEPHYR_TRY_MASS_ERASE
137 bool "Try to mass erase flash when flashing MCUboot image"
138 default y
139 help
140 If y, attempt to configure the Zephyr build system's "flash"
141 target to mass-erase the flash device before flashing the
142 MCUboot image. This ensures the scratch and other partitions
143 are in a consistent state.
144
145 This is not available for all targets.
146
Fabio Utzig9a4b9ba2018-05-07 08:31:27 -0300147config BOOT_HAVE_LOGGING
148 bool "MCUboot have logging enabled"
149 default y
Emanuele Di Santo9f1933d2018-11-20 10:59:59 +0100150 select LOG
Michael Scottcef44272019-02-01 11:12:15 -0800151 select LOG_IMMEDIATE
Fabio Utzig9a4b9ba2018-05-07 08:31:27 -0300152 help
153 If y, enables logging on the serial port. The log level can
Michael Scott74ceae52019-02-01 14:01:09 -0800154 be defined by setting `CONFIG_MCUBOOT_LOG_LEVEL_*`.
Fabio Utzig9a4b9ba2018-05-07 08:31:27 -0300155 If unsure, leave at the default value.
156
Michael Scott74ceae52019-02-01 14:01:09 -0800157if BOOT_HAVE_LOGGING
158module = MCUBOOT
159module-dep = LOG
160module-str = Log level for MCUBOOT application
161source "subsys/logging/Kconfig.template.log_config"
162endif
163
Marti Bolivar0e091c92018-04-12 11:23:16 -0400164menuconfig MCUBOOT_SERIAL
165 bool "MCUboot serial recovery"
166 default n
167 select REBOOT
Emanuele Di Santo30a92652019-01-16 14:01:08 +0100168 select GPIO
Marti Bolivar0e091c92018-04-12 11:23:16 -0400169 select SERIAL
Emanuele Di Santo30a92652019-01-16 14:01:08 +0100170 select UART_INTERRUPT_DRIVEN
Marti Bolivar0e091c92018-04-12 11:23:16 -0400171 select BASE64
172 select TINYCBOR
173 help
174 If y, enables a serial-port based update mode. This allows
175 MCUboot itself to load update images into flash over a UART.
176 If unsure, leave at the default value.
177
178if MCUBOOT_SERIAL
179
Emanuele Di Santoc4bf7802018-07-20 11:39:57 +0200180choice
181 prompt "Serial device"
182 default BOOT_SERIAL_UART if !BOARD_NRF52840_PCA10059
183 default BOOT_SERIAL_CDC_ACM if BOARD_NRF52840_PCA10059
184
185config BOOT_SERIAL_UART
186 bool "UART"
187 # SERIAL and UART_INTERRUPT_DRIVEN already selected
188
189config BOOT_SERIAL_CDC_ACM
190 bool "CDC ACM"
191 select USB
192 select USB_DEVICE_STACK
193 select USB_CDC_ACM
194
195endchoice
196
Marti Bolivar0e091c92018-04-12 11:23:16 -0400197config BOOT_MAX_LINE_INPUT_LEN
198 int "Maximum command line length"
199 default 512
200 help
201 Maximum length of commands transported over the serial port.
202
203config BOOT_SERIAL_DETECT_PORT
204 string "GPIO device to trigger serial recovery mode"
205 default GPIO_0 if SOC_FAMILY_NRF
206 help
207 Zephyr GPIO device which contains the pin used to trigger
208 serial recovery mode.
209
210config BOOT_SERIAL_DETECT_PIN
211 int "Pin to trigger serial recovery mode"
212 default 11 if BOARD_NRF52840_PCA10056
213 default 13 if BOARD_NRF52_PCA10040
214 help
215 Pin on the serial detect port which triggers serial recovery mode.
216
217config BOOT_SERIAL_DETECT_PIN_VAL
218 int "Serial detect pin trigger value"
219 default 0
220 range 0 1
221 help
222 Logic value of the detect pin which triggers serial recovery
223 mode.
224
225endif # MCUBOOT_SERIAL
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200226
Andrzej Puzdrowski97543282018-04-12 15:16:56 +0200227endmenu
228
Carles Cufi84ede582018-01-29 15:12:00 +0100229config MCUBOOT_DEVICE_SETTINGS
230 # Hidden selector for device-specific settings
231 bool
232 default y
233 # CPU options
234 select MCUBOOT_DEVICE_CPU_CORTEX_M0 if CPU_CORTEX_M0
Carles Cufi67c792e2018-01-29 15:14:31 +0100235 # Enable flash page layout if available
236 select FLASH_PAGE_LAYOUT if FLASH_HAS_PAGE_LAYOUT
Andrzej Puzdrowskib788c712018-04-12 12:42:49 +0200237 # Enable flash_map module as flash I/O back-end
238 select FLASH_MAP
Carles Cufi84ede582018-01-29 15:12:00 +0100239
240config MCUBOOT_DEVICE_CPU_CORTEX_M0
241 # Hidden selector for Cortex-M0 settings
242 bool
243 default n
244 select SW_VECTOR_RELAY if !CPU_CORTEX_M0_HAS_VECTOR_TABLE_REMAP
245
Marti Bolivar0e091c92018-04-12 11:23:16 -0400246comment "Zephyr configuration options"
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200247
Marti Bolivar0e091c92018-04-12 11:23:16 -0400248config ZEPHYR_BASE
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200249 string
Marti Bolivar0e091c92018-04-12 11:23:16 -0400250 option env="ZEPHYR_BASE"
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200251
Marti Bolivar0e091c92018-04-12 11:23:16 -0400252source "$ZEPHYR_BASE/Kconfig.zephyr"