Andrzej Puzdrowski | 64ad092 | 2017-09-22 11:33:41 +0200 | [diff] [blame] | 1 | # Copyright (c) 2017 Linaro Limited |
| 2 | # |
| 3 | # SPDX-License-Identifier: Apache-2.0 |
| 4 | # |
| 5 | |
Marti Bolivar | 0e091c9 | 2018-04-12 11:23:16 -0400 | [diff] [blame] | 6 | mainmenu "MCUboot configuration" |
Andrzej Puzdrowski | 64ad092 | 2017-09-22 11:33:41 +0200 | [diff] [blame] | 7 | |
Marti Bolivar | 0e091c9 | 2018-04-12 11:23:16 -0400 | [diff] [blame] | 8 | comment "MCUboot-specific configuration options" |
Andrzej Puzdrowski | 64ad092 | 2017-09-22 11:33:41 +0200 | [diff] [blame] | 9 | |
Emanuele Di Santo | 865777d | 2018-11-08 11:28:15 +0100 | [diff] [blame] | 10 | # Hidden option to mark a project as MCUboot |
| 11 | config MCUBOOT |
| 12 | default y |
| 13 | bool |
Rajavardhan Gundi | 07ba28f | 2018-12-10 15:44:48 +0530 | [diff] [blame] | 14 | select MPU_ALLOW_FLASH_WRITE if ARM_MPU |
Emanuele Di Santo | 865777d | 2018-11-08 11:28:15 +0100 | [diff] [blame] | 15 | |
Emanuele Di Santo | a0ed10b | 2019-01-03 16:47:38 +0100 | [diff] [blame] | 16 | if 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 | |
| 23 | config TEXT_SECTION_OFFSET |
| 24 | default 0x00 |
| 25 | |
| 26 | endif # BOARD_HAS_NRF5_BOOTLOADER |
| 27 | |
Marti Bolivar | bc2fa4e | 2018-04-12 12:18:32 -0400 | [diff] [blame] | 28 | config BOOT_USE_MBEDTLS |
| 29 | bool |
| 30 | # Hidden option |
| 31 | default n |
| 32 | help |
| 33 | Use mbedTLS for crypto primitives. |
| 34 | |
| 35 | config BOOT_USE_TINYCRYPT |
| 36 | bool |
| 37 | # Hidden option |
| 38 | default n |
Sebastian Bøe | 913a385 | 2019-01-22 13:53:12 +0100 | [diff] [blame] | 39 | # 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 Bolivar | bc2fa4e | 2018-04-12 12:18:32 -0400 | [diff] [blame] | 43 | help |
| 44 | Use TinyCrypt for crypto primitives. |
| 45 | |
Andrzej Puzdrowski | 9754328 | 2018-04-12 15:16:56 +0200 | [diff] [blame] | 46 | menu "MCUBoot settings" |
| 47 | |
Marti Bolivar | bc2fa4e | 2018-04-12 12:18:32 -0400 | [diff] [blame] | 48 | choice |
| 49 | prompt "Signature type" |
| 50 | default BOOT_SIGNATURE_TYPE_RSA |
| 51 | |
| 52 | config BOOT_SIGNATURE_TYPE_RSA |
| 53 | bool "RSA signatures" |
| 54 | select BOOT_USE_MBEDTLS |
Marti Bolivar | a4818a5 | 2018-04-12 13:02:38 -0400 | [diff] [blame] | 55 | select MBEDTLS |
Marti Bolivar | bc2fa4e | 2018-04-12 12:18:32 -0400 | [diff] [blame] | 56 | |
| 57 | config BOOT_SIGNATURE_TYPE_ECDSA_P256 |
| 58 | bool "Elliptic curve digital signatures with curve P-256" |
| 59 | select BOOT_USE_TINYCRYPT |
| 60 | |
| 61 | endchoice |
| 62 | |
Fabio Utzig | c690c76 | 2018-04-26 10:51:09 -0300 | [diff] [blame] | 63 | config 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 Bolivar | a4818a5 | 2018-04-12 13:02:38 -0400 | [diff] [blame] | 71 | config MBEDTLS_CFG_FILE |
| 72 | default "mcuboot-mbedtls-cfg.h" |
| 73 | |
Marti Bolivar | bc2fa4e | 2018-04-12 12:18:32 -0400 | [diff] [blame] | 74 | config 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 | |
| 83 | config 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 Utzig | d0533ed | 2018-12-19 07:56:33 -0200 | [diff] [blame] | 91 | config 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 Utzig | 5fe874c | 2018-08-31 07:41:50 -0300 | [diff] [blame] | 99 | config 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 Bolivar | 0e091c9 | 2018-04-12 11:23:16 -0400 | [diff] [blame] | 107 | config 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 Santo | 205c8c6 | 2018-07-20 11:42:31 +0200 | [diff] [blame] | 116 | config 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 Gundi | 51c9d70 | 2019-02-20 14:08:52 +0530 | [diff] [blame^] | 125 | config 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 Bolivar | bc2fa4e | 2018-04-12 12:18:32 -0400 | [diff] [blame] | 136 | config 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 Utzig | 9a4b9ba | 2018-05-07 08:31:27 -0300 | [diff] [blame] | 147 | config BOOT_HAVE_LOGGING |
| 148 | bool "MCUboot have logging enabled" |
| 149 | default y |
Emanuele Di Santo | 9f1933d | 2018-11-20 10:59:59 +0100 | [diff] [blame] | 150 | select LOG |
Michael Scott | cef4427 | 2019-02-01 11:12:15 -0800 | [diff] [blame] | 151 | select LOG_IMMEDIATE |
Fabio Utzig | 9a4b9ba | 2018-05-07 08:31:27 -0300 | [diff] [blame] | 152 | help |
| 153 | If y, enables logging on the serial port. The log level can |
Michael Scott | 74ceae5 | 2019-02-01 14:01:09 -0800 | [diff] [blame] | 154 | be defined by setting `CONFIG_MCUBOOT_LOG_LEVEL_*`. |
Fabio Utzig | 9a4b9ba | 2018-05-07 08:31:27 -0300 | [diff] [blame] | 155 | If unsure, leave at the default value. |
| 156 | |
Michael Scott | 74ceae5 | 2019-02-01 14:01:09 -0800 | [diff] [blame] | 157 | if BOOT_HAVE_LOGGING |
| 158 | module = MCUBOOT |
| 159 | module-dep = LOG |
| 160 | module-str = Log level for MCUBOOT application |
| 161 | source "subsys/logging/Kconfig.template.log_config" |
| 162 | endif |
| 163 | |
Marti Bolivar | 0e091c9 | 2018-04-12 11:23:16 -0400 | [diff] [blame] | 164 | menuconfig MCUBOOT_SERIAL |
| 165 | bool "MCUboot serial recovery" |
| 166 | default n |
| 167 | select REBOOT |
Emanuele Di Santo | 30a9265 | 2019-01-16 14:01:08 +0100 | [diff] [blame] | 168 | select GPIO |
Marti Bolivar | 0e091c9 | 2018-04-12 11:23:16 -0400 | [diff] [blame] | 169 | select SERIAL |
Emanuele Di Santo | 30a9265 | 2019-01-16 14:01:08 +0100 | [diff] [blame] | 170 | select UART_INTERRUPT_DRIVEN |
Marti Bolivar | 0e091c9 | 2018-04-12 11:23:16 -0400 | [diff] [blame] | 171 | 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 | |
| 178 | if MCUBOOT_SERIAL |
| 179 | |
Emanuele Di Santo | c4bf780 | 2018-07-20 11:39:57 +0200 | [diff] [blame] | 180 | choice |
| 181 | prompt "Serial device" |
| 182 | default BOOT_SERIAL_UART if !BOARD_NRF52840_PCA10059 |
| 183 | default BOOT_SERIAL_CDC_ACM if BOARD_NRF52840_PCA10059 |
| 184 | |
| 185 | config BOOT_SERIAL_UART |
| 186 | bool "UART" |
| 187 | # SERIAL and UART_INTERRUPT_DRIVEN already selected |
| 188 | |
| 189 | config BOOT_SERIAL_CDC_ACM |
| 190 | bool "CDC ACM" |
| 191 | select USB |
| 192 | select USB_DEVICE_STACK |
| 193 | select USB_CDC_ACM |
| 194 | |
| 195 | endchoice |
| 196 | |
Marti Bolivar | 0e091c9 | 2018-04-12 11:23:16 -0400 | [diff] [blame] | 197 | config 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 | |
| 203 | config 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 | |
| 210 | config 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 | |
| 217 | config 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 | |
| 225 | endif # MCUBOOT_SERIAL |
Andrzej Puzdrowski | 64ad092 | 2017-09-22 11:33:41 +0200 | [diff] [blame] | 226 | |
Andrzej Puzdrowski | 9754328 | 2018-04-12 15:16:56 +0200 | [diff] [blame] | 227 | endmenu |
| 228 | |
Carles Cufi | 84ede58 | 2018-01-29 15:12:00 +0100 | [diff] [blame] | 229 | config 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 Cufi | 67c792e | 2018-01-29 15:14:31 +0100 | [diff] [blame] | 235 | # Enable flash page layout if available |
| 236 | select FLASH_PAGE_LAYOUT if FLASH_HAS_PAGE_LAYOUT |
Andrzej Puzdrowski | b788c71 | 2018-04-12 12:42:49 +0200 | [diff] [blame] | 237 | # Enable flash_map module as flash I/O back-end |
| 238 | select FLASH_MAP |
Carles Cufi | 84ede58 | 2018-01-29 15:12:00 +0100 | [diff] [blame] | 239 | |
| 240 | config 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 Bolivar | 0e091c9 | 2018-04-12 11:23:16 -0400 | [diff] [blame] | 246 | comment "Zephyr configuration options" |
Andrzej Puzdrowski | 64ad092 | 2017-09-22 11:33:41 +0200 | [diff] [blame] | 247 | |
Marti Bolivar | 0e091c9 | 2018-04-12 11:23:16 -0400 | [diff] [blame] | 248 | config ZEPHYR_BASE |
Andrzej Puzdrowski | 64ad092 | 2017-09-22 11:33:41 +0200 | [diff] [blame] | 249 | string |
Marti Bolivar | 0e091c9 | 2018-04-12 11:23:16 -0400 | [diff] [blame] | 250 | option env="ZEPHYR_BASE" |
Andrzej Puzdrowski | 64ad092 | 2017-09-22 11:33:41 +0200 | [diff] [blame] | 251 | |
Marti Bolivar | 0e091c9 | 2018-04-12 11:23:16 -0400 | [diff] [blame] | 252 | source "$ZEPHYR_BASE/Kconfig.zephyr" |