blob: 34cb54138ead86a589255a42eab9a029e254a9fe [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
Emanuele Di Santo9f1933d2018-11-20 10:59:59 +0100135 select LOG
136 select LOG_INPLACE_PROCESS
Fabio Utzig9a4b9ba2018-05-07 08:31:27 -0300137 help
138 If y, enables logging on the serial port. The log level can
Emanuele Di Santo9f1933d2018-11-20 10:59:59 +0100139 be defined by setting `LOG_DEFAULT_LEVEL`.
Fabio Utzig9a4b9ba2018-05-07 08:31:27 -0300140 If unsure, leave at the default value.
141
Marti Bolivar0e091c92018-04-12 11:23:16 -0400142menuconfig MCUBOOT_SERIAL
143 bool "MCUboot serial recovery"
144 default n
145 select REBOOT
Emanuele Di Santo30a92652019-01-16 14:01:08 +0100146 select GPIO
Marti Bolivar0e091c92018-04-12 11:23:16 -0400147 select SERIAL
Emanuele Di Santo30a92652019-01-16 14:01:08 +0100148 select UART_INTERRUPT_DRIVEN
Marti Bolivar0e091c92018-04-12 11:23:16 -0400149 select BASE64
150 select TINYCBOR
151 help
152 If y, enables a serial-port based update mode. This allows
153 MCUboot itself to load update images into flash over a UART.
154 If unsure, leave at the default value.
155
156if MCUBOOT_SERIAL
157
Emanuele Di Santoc4bf7802018-07-20 11:39:57 +0200158choice
159 prompt "Serial device"
160 default BOOT_SERIAL_UART if !BOARD_NRF52840_PCA10059
161 default BOOT_SERIAL_CDC_ACM if BOARD_NRF52840_PCA10059
162
163config BOOT_SERIAL_UART
164 bool "UART"
165 # SERIAL and UART_INTERRUPT_DRIVEN already selected
166
167config BOOT_SERIAL_CDC_ACM
168 bool "CDC ACM"
169 select USB
170 select USB_DEVICE_STACK
171 select USB_CDC_ACM
172
173endchoice
174
Marti Bolivar0e091c92018-04-12 11:23:16 -0400175config BOOT_MAX_LINE_INPUT_LEN
176 int "Maximum command line length"
177 default 512
178 help
179 Maximum length of commands transported over the serial port.
180
181config BOOT_SERIAL_DETECT_PORT
182 string "GPIO device to trigger serial recovery mode"
183 default GPIO_0 if SOC_FAMILY_NRF
184 help
185 Zephyr GPIO device which contains the pin used to trigger
186 serial recovery mode.
187
188config BOOT_SERIAL_DETECT_PIN
189 int "Pin to trigger serial recovery mode"
190 default 11 if BOARD_NRF52840_PCA10056
191 default 13 if BOARD_NRF52_PCA10040
192 help
193 Pin on the serial detect port which triggers serial recovery mode.
194
195config BOOT_SERIAL_DETECT_PIN_VAL
196 int "Serial detect pin trigger value"
197 default 0
198 range 0 1
199 help
200 Logic value of the detect pin which triggers serial recovery
201 mode.
202
203endif # MCUBOOT_SERIAL
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200204
Andrzej Puzdrowski97543282018-04-12 15:16:56 +0200205endmenu
206
Carles Cufi84ede582018-01-29 15:12:00 +0100207config MCUBOOT_DEVICE_SETTINGS
208 # Hidden selector for device-specific settings
209 bool
210 default y
211 # CPU options
212 select MCUBOOT_DEVICE_CPU_CORTEX_M0 if CPU_CORTEX_M0
Carles Cufi67c792e2018-01-29 15:14:31 +0100213 # Enable flash page layout if available
214 select FLASH_PAGE_LAYOUT if FLASH_HAS_PAGE_LAYOUT
Andrzej Puzdrowskib788c712018-04-12 12:42:49 +0200215 # Enable flash_map module as flash I/O back-end
216 select FLASH_MAP
Carles Cufi84ede582018-01-29 15:12:00 +0100217
218config MCUBOOT_DEVICE_CPU_CORTEX_M0
219 # Hidden selector for Cortex-M0 settings
220 bool
221 default n
222 select SW_VECTOR_RELAY if !CPU_CORTEX_M0_HAS_VECTOR_TABLE_REMAP
223
Marti Bolivar0e091c92018-04-12 11:23:16 -0400224comment "Zephyr configuration options"
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200225
Marti Bolivar0e091c92018-04-12 11:23:16 -0400226config ZEPHYR_BASE
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200227 string
Marti Bolivar0e091c92018-04-12 11:23:16 -0400228 option env="ZEPHYR_BASE"
Andrzej Puzdrowski64ad0922017-09-22 11:33:41 +0200229
Marti Bolivar0e091c92018-04-12 11:23:16 -0400230source "$ZEPHYR_BASE/Kconfig.zephyr"