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