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 |
Andrzej Puzdrowski | 23d3c66 | 2019-03-18 14:12:22 +0100 | [diff] [blame] | 15 | select USE_CODE_PARTITION if HAS_FLASH_LOAD_OFFSET |
Emanuele Di Santo | 865777d | 2018-11-08 11:28:15 +0100 | [diff] [blame] | 16 | |
Emanuele Di Santo | a0ed10b | 2019-01-03 16:47:38 +0100 | [diff] [blame] | 17 | if BOARD_HAS_NRF5_BOOTLOADER |
| 18 | |
| 19 | # When compiling MCUBoot, the image will be linked to the boot partition. |
| 20 | # Override .text offset to make sure it is set to zero. |
| 21 | # This is necessary when other bootloaders set a different default for |
| 22 | # application images which are not bootloaders. |
| 23 | |
| 24 | config TEXT_SECTION_OFFSET |
| 25 | default 0x00 |
| 26 | |
| 27 | endif # BOARD_HAS_NRF5_BOOTLOADER |
| 28 | |
Marti Bolivar | bc2fa4e | 2018-04-12 12:18:32 -0400 | [diff] [blame] | 29 | config BOOT_USE_MBEDTLS |
| 30 | bool |
| 31 | # Hidden option |
| 32 | default n |
| 33 | help |
| 34 | Use mbedTLS for crypto primitives. |
| 35 | |
| 36 | config BOOT_USE_TINYCRYPT |
| 37 | bool |
| 38 | # Hidden option |
| 39 | default n |
Sebastian Bøe | 913a385 | 2019-01-22 13:53:12 +0100 | [diff] [blame] | 40 | # When building for ECDSA, we use our own copy of mbedTLS, so the |
| 41 | # Zephyr one must not be enabled or the MBEDTLS_CONFIG_FILE macros |
| 42 | # will collide. |
| 43 | depends on ! MBEDTLS |
Marti Bolivar | bc2fa4e | 2018-04-12 12:18:32 -0400 | [diff] [blame] | 44 | help |
| 45 | Use TinyCrypt for crypto primitives. |
| 46 | |
Andrzej Puzdrowski | 9754328 | 2018-04-12 15:16:56 +0200 | [diff] [blame] | 47 | menu "MCUBoot settings" |
| 48 | |
Marti Bolivar | bc2fa4e | 2018-04-12 12:18:32 -0400 | [diff] [blame] | 49 | choice |
| 50 | prompt "Signature type" |
| 51 | default BOOT_SIGNATURE_TYPE_RSA |
| 52 | |
| 53 | config BOOT_SIGNATURE_TYPE_RSA |
| 54 | bool "RSA signatures" |
| 55 | select BOOT_USE_MBEDTLS |
Marti Bolivar | a4818a5 | 2018-04-12 13:02:38 -0400 | [diff] [blame] | 56 | select MBEDTLS |
Marti Bolivar | bc2fa4e | 2018-04-12 12:18:32 -0400 | [diff] [blame] | 57 | |
| 58 | config BOOT_SIGNATURE_TYPE_ECDSA_P256 |
| 59 | bool "Elliptic curve digital signatures with curve P-256" |
| 60 | select BOOT_USE_TINYCRYPT |
| 61 | |
| 62 | endchoice |
| 63 | |
Fabio Utzig | c690c76 | 2018-04-26 10:51:09 -0300 | [diff] [blame] | 64 | config BOOT_SIGNATURE_KEY_FILE |
| 65 | string "PEM key file" |
| 66 | default "" |
| 67 | help |
| 68 | The key file will be parsed by imgtool's getpub command and a .c source |
| 69 | with the public key information will be written in a format expected by |
| 70 | MCUboot. |
| 71 | |
Marti Bolivar | a4818a5 | 2018-04-12 13:02:38 -0400 | [diff] [blame] | 72 | config MBEDTLS_CFG_FILE |
| 73 | default "mcuboot-mbedtls-cfg.h" |
| 74 | |
Marti Bolivar | bc2fa4e | 2018-04-12 12:18:32 -0400 | [diff] [blame] | 75 | config BOOT_VALIDATE_SLOT0 |
David Vincze | 2d736ad | 2019-02-18 11:50:22 +0100 | [diff] [blame] | 76 | bool "Validate image in the primary slot on every boot" |
Marti Bolivar | bc2fa4e | 2018-04-12 12:18:32 -0400 | [diff] [blame] | 77 | default y |
| 78 | help |
David Vincze | 2d736ad | 2019-02-18 11:50:22 +0100 | [diff] [blame] | 79 | If y, the bootloader attempts to validate the signature of the |
| 80 | primary slot every boot. This adds the signature check time to |
Marti Bolivar | bc2fa4e | 2018-04-12 12:18:32 -0400 | [diff] [blame] | 81 | every boot, but can mitigate against some changes that are |
| 82 | able to modify the flash image itself. |
| 83 | |
| 84 | config BOOT_UPGRADE_ONLY |
| 85 | bool "Overwrite image updates instead of swapping" |
| 86 | default n |
| 87 | help |
David Vincze | 2d736ad | 2019-02-18 11:50:22 +0100 | [diff] [blame] | 88 | If y, overwrite the primary slot with the upgrade image instead |
| 89 | of swapping them. This prevents the fallback recovery, but |
Marti Bolivar | bc2fa4e | 2018-04-12 12:18:32 -0400 | [diff] [blame] | 90 | uses a much simpler code path. |
| 91 | |
Fabio Utzig | d0533ed | 2018-12-19 07:56:33 -0200 | [diff] [blame] | 92 | config BOOT_BOOTSTRAP |
David Vincze | 2d736ad | 2019-02-18 11:50:22 +0100 | [diff] [blame] | 93 | bool "Boostrap erased the primary slot from the secondary slot" |
Fabio Utzig | d0533ed | 2018-12-19 07:56:33 -0200 | [diff] [blame] | 94 | default n |
| 95 | help |
| 96 | If y, enables bootstraping support. Bootstrapping allows an erased |
David Vincze | 2d736ad | 2019-02-18 11:50:22 +0100 | [diff] [blame] | 97 | primary slot to be initialized from a valid image in the secondary slot. |
Fabio Utzig | d0533ed | 2018-12-19 07:56:33 -0200 | [diff] [blame] | 98 | If unsure, leave at the default value. |
| 99 | |
Fabio Utzig | 5fe874c | 2018-08-31 07:41:50 -0300 | [diff] [blame] | 100 | config BOOT_ENCRYPT_RSA |
| 101 | bool "Support for encrypted upgrade images" |
| 102 | default n |
| 103 | help |
David Vincze | 2d736ad | 2019-02-18 11:50:22 +0100 | [diff] [blame] | 104 | If y, images in the secondary slot can be encrypted and are decrypted |
| 105 | on the fly when upgrading to the primary slot, as well as encrypted |
| 106 | back when swapping from the primary slot to the secondary slot. |
Fabio Utzig | 5fe874c | 2018-08-31 07:41:50 -0300 | [diff] [blame] | 107 | |
Marti Bolivar | 0e091c9 | 2018-04-12 11:23:16 -0400 | [diff] [blame] | 108 | config BOOT_MAX_IMG_SECTORS |
| 109 | int "Maximum number of sectors per image slot" |
| 110 | default 128 |
| 111 | help |
| 112 | This option controls the maximum number of sectors that each of |
| 113 | the two image areas can contain. Smaller values reduce MCUboot's |
| 114 | memory usage; larger values allow it to support larger images. |
| 115 | If unsure, leave at the default value. |
| 116 | |
Emanuele Di Santo | 205c8c6 | 2018-07-20 11:42:31 +0200 | [diff] [blame] | 117 | config BOOT_ERASE_PROGRESSIVELY |
| 118 | bool "Erase flash progressively when receiving new firmware" |
| 119 | default y if SOC_NRF52840 |
| 120 | help |
| 121 | If enabled, flash is erased as necessary when receiving new firmware, |
| 122 | instead of erasing the whole image slot at once. This is necessary |
| 123 | on some hardware that has long erase times, to prevent long wait |
| 124 | times at the beginning of the DFU process. |
| 125 | |
Rajavardhan Gundi | 51c9d70 | 2019-02-20 14:08:52 +0530 | [diff] [blame] | 126 | config BOOT_WAIT_FOR_USB_DFU |
| 127 | bool "Wait for a prescribed duration to see if USB DFU is invoked" |
| 128 | default n |
| 129 | select USB |
| 130 | select USB_DFU_CLASS |
| 131 | select IMG_MANAGER |
| 132 | help |
| 133 | If y, MCUboot waits for a prescribed duration of time to allow |
| 134 | for USB DFU to be invoked. Please note DFU always updates the |
| 135 | slot1 image. |
| 136 | |
Marti Bolivar | bc2fa4e | 2018-04-12 12:18:32 -0400 | [diff] [blame] | 137 | config ZEPHYR_TRY_MASS_ERASE |
| 138 | bool "Try to mass erase flash when flashing MCUboot image" |
| 139 | default y |
| 140 | help |
| 141 | If y, attempt to configure the Zephyr build system's "flash" |
| 142 | target to mass-erase the flash device before flashing the |
| 143 | MCUboot image. This ensures the scratch and other partitions |
| 144 | are in a consistent state. |
| 145 | |
| 146 | This is not available for all targets. |
| 147 | |
Fabio Utzig | 9a4b9ba | 2018-05-07 08:31:27 -0300 | [diff] [blame] | 148 | config BOOT_HAVE_LOGGING |
| 149 | bool "MCUboot have logging enabled" |
| 150 | default y |
Emanuele Di Santo | 9f1933d | 2018-11-20 10:59:59 +0100 | [diff] [blame] | 151 | select LOG |
Michael Scott | cef4427 | 2019-02-01 11:12:15 -0800 | [diff] [blame] | 152 | select LOG_IMMEDIATE |
Fabio Utzig | 9a4b9ba | 2018-05-07 08:31:27 -0300 | [diff] [blame] | 153 | help |
| 154 | If y, enables logging on the serial port. The log level can |
Michael Scott | 74ceae5 | 2019-02-01 14:01:09 -0800 | [diff] [blame] | 155 | be defined by setting `CONFIG_MCUBOOT_LOG_LEVEL_*`. |
Fabio Utzig | 9a4b9ba | 2018-05-07 08:31:27 -0300 | [diff] [blame] | 156 | If unsure, leave at the default value. |
| 157 | |
Michael Scott | 74ceae5 | 2019-02-01 14:01:09 -0800 | [diff] [blame] | 158 | if BOOT_HAVE_LOGGING |
| 159 | module = MCUBOOT |
| 160 | module-dep = LOG |
| 161 | module-str = Log level for MCUBOOT application |
| 162 | source "subsys/logging/Kconfig.template.log_config" |
| 163 | endif |
| 164 | |
Marti Bolivar | 0e091c9 | 2018-04-12 11:23:16 -0400 | [diff] [blame] | 165 | menuconfig MCUBOOT_SERIAL |
| 166 | bool "MCUboot serial recovery" |
| 167 | default n |
| 168 | select REBOOT |
Emanuele Di Santo | 30a9265 | 2019-01-16 14:01:08 +0100 | [diff] [blame] | 169 | select GPIO |
Marti Bolivar | 0e091c9 | 2018-04-12 11:23:16 -0400 | [diff] [blame] | 170 | select SERIAL |
Emanuele Di Santo | 30a9265 | 2019-01-16 14:01:08 +0100 | [diff] [blame] | 171 | select UART_INTERRUPT_DRIVEN |
Marti Bolivar | 0e091c9 | 2018-04-12 11:23:16 -0400 | [diff] [blame] | 172 | select BASE64 |
| 173 | select TINYCBOR |
| 174 | help |
| 175 | If y, enables a serial-port based update mode. This allows |
| 176 | MCUboot itself to load update images into flash over a UART. |
| 177 | If unsure, leave at the default value. |
| 178 | |
| 179 | if MCUBOOT_SERIAL |
| 180 | |
Emanuele Di Santo | c4bf780 | 2018-07-20 11:39:57 +0200 | [diff] [blame] | 181 | choice |
| 182 | prompt "Serial device" |
| 183 | default BOOT_SERIAL_UART if !BOARD_NRF52840_PCA10059 |
| 184 | default BOOT_SERIAL_CDC_ACM if BOARD_NRF52840_PCA10059 |
| 185 | |
| 186 | config BOOT_SERIAL_UART |
| 187 | bool "UART" |
| 188 | # SERIAL and UART_INTERRUPT_DRIVEN already selected |
| 189 | |
| 190 | config BOOT_SERIAL_CDC_ACM |
| 191 | bool "CDC ACM" |
| 192 | select USB |
| 193 | select USB_DEVICE_STACK |
| 194 | select USB_CDC_ACM |
| 195 | |
| 196 | endchoice |
| 197 | |
Marti Bolivar | 0e091c9 | 2018-04-12 11:23:16 -0400 | [diff] [blame] | 198 | config BOOT_MAX_LINE_INPUT_LEN |
| 199 | int "Maximum command line length" |
| 200 | default 512 |
| 201 | help |
| 202 | Maximum length of commands transported over the serial port. |
| 203 | |
| 204 | config BOOT_SERIAL_DETECT_PORT |
| 205 | string "GPIO device to trigger serial recovery mode" |
| 206 | default GPIO_0 if SOC_FAMILY_NRF |
| 207 | help |
| 208 | Zephyr GPIO device which contains the pin used to trigger |
| 209 | serial recovery mode. |
| 210 | |
| 211 | config BOOT_SERIAL_DETECT_PIN |
| 212 | int "Pin to trigger serial recovery mode" |
| 213 | default 11 if BOARD_NRF52840_PCA10056 |
| 214 | default 13 if BOARD_NRF52_PCA10040 |
| 215 | help |
| 216 | Pin on the serial detect port which triggers serial recovery mode. |
| 217 | |
| 218 | config BOOT_SERIAL_DETECT_PIN_VAL |
| 219 | int "Serial detect pin trigger value" |
| 220 | default 0 |
| 221 | range 0 1 |
| 222 | help |
| 223 | Logic value of the detect pin which triggers serial recovery |
| 224 | mode. |
| 225 | |
| 226 | endif # MCUBOOT_SERIAL |
Andrzej Puzdrowski | 64ad092 | 2017-09-22 11:33:41 +0200 | [diff] [blame] | 227 | |
Andrzej Puzdrowski | 9754328 | 2018-04-12 15:16:56 +0200 | [diff] [blame] | 228 | endmenu |
| 229 | |
Carles Cufi | 84ede58 | 2018-01-29 15:12:00 +0100 | [diff] [blame] | 230 | config MCUBOOT_DEVICE_SETTINGS |
| 231 | # Hidden selector for device-specific settings |
| 232 | bool |
| 233 | default y |
| 234 | # CPU options |
| 235 | select MCUBOOT_DEVICE_CPU_CORTEX_M0 if CPU_CORTEX_M0 |
Carles Cufi | 67c792e | 2018-01-29 15:14:31 +0100 | [diff] [blame] | 236 | # Enable flash page layout if available |
| 237 | select FLASH_PAGE_LAYOUT if FLASH_HAS_PAGE_LAYOUT |
Andrzej Puzdrowski | b788c71 | 2018-04-12 12:42:49 +0200 | [diff] [blame] | 238 | # Enable flash_map module as flash I/O back-end |
| 239 | select FLASH_MAP |
Carles Cufi | 84ede58 | 2018-01-29 15:12:00 +0100 | [diff] [blame] | 240 | |
| 241 | config MCUBOOT_DEVICE_CPU_CORTEX_M0 |
| 242 | # Hidden selector for Cortex-M0 settings |
| 243 | bool |
| 244 | default n |
| 245 | select SW_VECTOR_RELAY if !CPU_CORTEX_M0_HAS_VECTOR_TABLE_REMAP |
| 246 | |
Marti Bolivar | 0e091c9 | 2018-04-12 11:23:16 -0400 | [diff] [blame] | 247 | comment "Zephyr configuration options" |
Andrzej Puzdrowski | 64ad092 | 2017-09-22 11:33:41 +0200 | [diff] [blame] | 248 | |
Marti Bolivar | 0e091c9 | 2018-04-12 11:23:16 -0400 | [diff] [blame] | 249 | config ZEPHYR_BASE |
Andrzej Puzdrowski | 64ad092 | 2017-09-22 11:33:41 +0200 | [diff] [blame] | 250 | string |
Marti Bolivar | 0e091c9 | 2018-04-12 11:23:16 -0400 | [diff] [blame] | 251 | option env="ZEPHYR_BASE" |
Andrzej Puzdrowski | 64ad092 | 2017-09-22 11:33:41 +0200 | [diff] [blame] | 252 | |
Marti Bolivar | 0e091c9 | 2018-04-12 11:23:16 -0400 | [diff] [blame] | 253 | source "$ZEPHYR_BASE/Kconfig.zephyr" |