304 lines
7.9 KiB
Plaintext
304 lines
7.9 KiB
Plaintext
# Copyright (c) 2017 Linaro Limited
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
mainmenu "MCUboot configuration"
|
|
|
|
comment "MCUboot-specific configuration options"
|
|
|
|
# Hidden option to mark a project as MCUboot
|
|
config MCUBOOT
|
|
default y
|
|
bool
|
|
select MPU_ALLOW_FLASH_WRITE if ARM_MPU
|
|
select USE_CODE_PARTITION if HAS_FLASH_LOAD_OFFSET
|
|
|
|
config BOOT_USE_MBEDTLS
|
|
bool
|
|
# Hidden option
|
|
default n
|
|
help
|
|
Use mbedTLS for crypto primitives.
|
|
|
|
config BOOT_USE_TINYCRYPT
|
|
bool
|
|
# Hidden option
|
|
default n
|
|
# When building for ECDSA, we use our own copy of mbedTLS, so the
|
|
# Zephyr one must not be enabled or the MBEDTLS_CONFIG_FILE macros
|
|
# will collide.
|
|
depends on ! MBEDTLS
|
|
help
|
|
Use TinyCrypt for crypto primitives.
|
|
|
|
config BOOT_USE_CC310
|
|
bool
|
|
# Hidden option
|
|
default n
|
|
# When building for ECDSA, we use our own copy of mbedTLS, so the
|
|
# Zephyr one must not be enabled or the MBEDTLS_CONFIG_FILE macros
|
|
# will collide.
|
|
depends on ! MBEDTLS
|
|
help
|
|
Use cc310 for crypto primitives.
|
|
|
|
config BOOT_USE_NRF_CC310_BL
|
|
bool
|
|
default n
|
|
|
|
config NRFXLIB_CRYPTO
|
|
bool
|
|
default n
|
|
|
|
config NRF_CC310_BL
|
|
bool
|
|
default n
|
|
|
|
menu "MCUBoot settings"
|
|
|
|
choice
|
|
prompt "Signature type"
|
|
default BOOT_SIGNATURE_TYPE_RSA
|
|
|
|
config BOOT_SIGNATURE_TYPE_RSA
|
|
bool "RSA signatures"
|
|
select BOOT_USE_MBEDTLS
|
|
select MBEDTLS
|
|
|
|
if BOOT_SIGNATURE_TYPE_RSA
|
|
config BOOT_SIGNATURE_TYPE_RSA_LEN
|
|
int "RSA signature length"
|
|
range 2048 3072
|
|
default 2048
|
|
endif
|
|
|
|
config BOOT_SIGNATURE_TYPE_ECDSA_P256
|
|
bool "Elliptic curve digital signatures with curve P-256"
|
|
|
|
config BOOT_SIGNATURE_TYPE_ED25519
|
|
bool "Edwards curve digital signatures using ed25519"
|
|
select BOOT_USE_MBEDTLS
|
|
select MBEDTLS
|
|
|
|
if BOOT_SIGNATURE_TYPE_ECDSA_P256
|
|
choice
|
|
prompt "Ecdsa implementation"
|
|
default BOOT_TINYCRYPT
|
|
config BOOT_TINYCRYPT
|
|
bool "Use tinycrypt"
|
|
select BOOT_USE_TINYCRYPT
|
|
config BOOT_CC310
|
|
bool "Use CC310"
|
|
select BOOT_USE_NRF_CC310_BL if HAS_HW_NRF_CC310
|
|
select NRF_CC310_BL if HAS_HW_NRF_CC310
|
|
select NRFXLIB_CRYPTO if SOC_FAMILY_NRF
|
|
select BOOT_USE_CC310
|
|
endchoice
|
|
endif
|
|
endchoice
|
|
|
|
config BOOT_SIGNATURE_KEY_FILE
|
|
string "PEM key file"
|
|
default ""
|
|
help
|
|
The key file will be parsed by imgtool's getpub command and a .c source
|
|
with the public key information will be written in a format expected by
|
|
MCUboot.
|
|
|
|
config MBEDTLS_CFG_FILE
|
|
default "mcuboot-mbedtls-cfg.h"
|
|
|
|
config BOOT_VALIDATE_SLOT0
|
|
bool "Validate image in the primary slot on every boot"
|
|
default y
|
|
help
|
|
If y, the bootloader attempts to validate the signature of the
|
|
primary slot every boot. This adds the signature check time to
|
|
every boot, but can mitigate against some changes that are
|
|
able to modify the flash image itself.
|
|
|
|
config BOOT_UPGRADE_ONLY
|
|
bool "Overwrite image updates instead of swapping"
|
|
default n
|
|
help
|
|
If y, overwrite the primary slot with the upgrade image instead
|
|
of swapping them. This prevents the fallback recovery, but
|
|
uses a much simpler code path.
|
|
|
|
config BOOT_BOOTSTRAP
|
|
bool "Boostrap erased the primary slot from the secondary slot"
|
|
default n
|
|
help
|
|
If y, enables bootstraping support. Bootstrapping allows an erased
|
|
primary slot to be initialized from a valid image in the secondary slot.
|
|
If unsure, leave at the default value.
|
|
|
|
config BOOT_ENCRYPT_RSA
|
|
bool "Support for encrypted upgrade images"
|
|
default n
|
|
help
|
|
If y, images in the secondary slot can be encrypted and are decrypted
|
|
on the fly when upgrading to the primary slot, as well as encrypted
|
|
back when swapping from the primary slot to the secondary slot.
|
|
|
|
config BOOT_MAX_IMG_SECTORS
|
|
int "Maximum number of sectors per image slot"
|
|
default 128
|
|
help
|
|
This option controls the maximum number of sectors that each of
|
|
the two image areas can contain. Smaller values reduce MCUboot's
|
|
memory usage; larger values allow it to support larger images.
|
|
If unsure, leave at the default value.
|
|
|
|
config BOOT_ERASE_PROGRESSIVELY
|
|
bool "Erase flash progressively when receiving new firmware"
|
|
default y if SOC_NRF52840
|
|
help
|
|
If enabled, flash is erased as necessary when receiving new firmware,
|
|
instead of erasing the whole image slot at once. This is necessary
|
|
on some hardware that has long erase times, to prevent long wait
|
|
times at the beginning of the DFU process.
|
|
|
|
config BOOT_WAIT_FOR_USB_DFU
|
|
bool "Wait for a prescribed duration to see if USB DFU is invoked"
|
|
default n
|
|
select USB
|
|
select USB_DFU_CLASS
|
|
select IMG_MANAGER
|
|
help
|
|
If y, MCUboot waits for a prescribed duration of time to allow
|
|
for USB DFU to be invoked. Please note DFU always updates the
|
|
slot1 image.
|
|
|
|
config ZEPHYR_TRY_MASS_ERASE
|
|
bool "Try to mass erase flash when flashing MCUboot image"
|
|
default y
|
|
help
|
|
If y, attempt to configure the Zephyr build system's "flash"
|
|
target to mass-erase the flash device before flashing the
|
|
MCUboot image. This ensures the scratch and other partitions
|
|
are in a consistent state.
|
|
|
|
This is not available for all targets.
|
|
|
|
module = MCUBOOT
|
|
module-str = MCUBoot bootloader
|
|
source "subsys/logging/Kconfig.template.log_config"
|
|
|
|
menuconfig MCUBOOT_SERIAL
|
|
bool "MCUboot serial recovery"
|
|
default n
|
|
select REBOOT
|
|
select GPIO
|
|
select SERIAL
|
|
select UART_INTERRUPT_DRIVEN
|
|
select BASE64
|
|
select TINYCBOR
|
|
help
|
|
If y, enables a serial-port based update mode. This allows
|
|
MCUboot itself to load update images into flash over a UART.
|
|
If unsure, leave at the default value.
|
|
|
|
if MCUBOOT_SERIAL
|
|
|
|
choice
|
|
prompt "Serial device"
|
|
default BOOT_SERIAL_UART if !BOARD_NRF52840_PCA10059
|
|
default BOOT_SERIAL_CDC_ACM if BOARD_NRF52840_PCA10059
|
|
|
|
config BOOT_SERIAL_UART
|
|
bool "UART"
|
|
# SERIAL and UART_INTERRUPT_DRIVEN already selected
|
|
|
|
config BOOT_SERIAL_CDC_ACM
|
|
bool "CDC ACM"
|
|
select USB
|
|
select USB_DEVICE_STACK
|
|
select USB_CDC_ACM
|
|
|
|
endchoice
|
|
|
|
config BOOT_MAX_LINE_INPUT_LEN
|
|
int "Maximum command line length"
|
|
default 512
|
|
help
|
|
Maximum length of commands transported over the serial port.
|
|
|
|
config BOOT_SERIAL_DETECT_PORT
|
|
string "GPIO device to trigger serial recovery mode"
|
|
default GPIO_0 if SOC_FAMILY_NRF
|
|
help
|
|
Zephyr GPIO device which contains the pin used to trigger
|
|
serial recovery mode.
|
|
|
|
config BOOT_SERIAL_DETECT_PIN
|
|
int "Pin to trigger serial recovery mode"
|
|
default 6 if BOARD_NRF9160_PCA10090
|
|
default 11 if BOARD_NRF52840_PCA10056
|
|
default 13 if BOARD_NRF52_PCA10040
|
|
help
|
|
Pin on the serial detect port which triggers serial recovery mode.
|
|
|
|
config BOOT_SERIAL_DETECT_PIN_VAL
|
|
int "Serial detect pin trigger value"
|
|
default 0
|
|
range 0 1
|
|
help
|
|
Logic value of the detect pin which triggers serial recovery
|
|
mode.
|
|
|
|
# Workaround for not being able to have commas in macro arguments
|
|
DT_CHOSEN_Z_CONSOLE := zephyr,console
|
|
|
|
config RECOVERY_UART_DEV_NAME
|
|
string "UART Device Name for Recovery UART"
|
|
default "$(dt_chosen_label,$(DT_CHOSEN_Z_CONSOLE))" if HAS_DTS
|
|
default "UART_0"
|
|
depends on BOOT_SERIAL_UART
|
|
help
|
|
This option specifies the name of UART device to be used for
|
|
serial recovery.
|
|
|
|
endif # MCUBOOT_SERIAL
|
|
|
|
endmenu
|
|
|
|
config MCUBOOT_DEVICE_SETTINGS
|
|
# Hidden selector for device-specific settings
|
|
bool
|
|
default y
|
|
# CPU options
|
|
select MCUBOOT_DEVICE_CPU_CORTEX_M0 if CPU_CORTEX_M0
|
|
# Enable flash page layout if available
|
|
select FLASH_PAGE_LAYOUT if FLASH_HAS_PAGE_LAYOUT
|
|
# Enable flash_map module as flash I/O back-end
|
|
select FLASH_MAP
|
|
|
|
config MCUBOOT_DEVICE_CPU_CORTEX_M0
|
|
# Hidden selector for Cortex-M0 settings
|
|
bool
|
|
default n
|
|
select SW_VECTOR_RELAY if !CPU_CORTEX_M0_HAS_VECTOR_TABLE_REMAP
|
|
|
|
comment "Zephyr configuration options"
|
|
|
|
# Disabling MULTITHREADING provides a code size advantage, but
|
|
# it requires peripheral drivers (particularly a flash driver)
|
|
# that works properly with the option enabled.
|
|
#
|
|
# If you know for sure that your hardware will work, you can default
|
|
# it to n here. Otherwise, having it on by default makes the most
|
|
# hardware work.
|
|
config MULTITHREADING
|
|
default n if SOC_FAMILY_NRF
|
|
default y
|
|
|
|
config UPDATEABLE_IMAGE_NUMBER
|
|
int "Number of updateable images"
|
|
default 1
|
|
help
|
|
Enables support of multi image update.
|
|
|
|
source "$ZEPHYR_BASE/Kconfig.zephyr"
|