1# Copyright (c) 2022 Nordic Semiconductor
2#
3# SPDX-License-Identifier: Apache-2.0
4
5# Include MCUboot if enabled.
6if(SB_CONFIG_BOOTLOADER_MCUBOOT)
7  set(image mcuboot)
8  ExternalZephyrProject_Add(
9    APPLICATION ${image}
10    SOURCE_DIR ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/zephyr/
11    APP_TYPE BOOTLOADER
12  )
13  # MCUBoot default configuration is to perform a full chip erase.
14  # Placing MCUBoot first in list to ensure it is flashed before other images.
15  sysbuild_add_dependencies(FLASH ${DEFAULT_IMAGE} ${image})
16
17  set_config_string(${image} CONFIG_BOOT_SIGNATURE_KEY_FILE "${SB_CONFIG_BOOT_SIGNATURE_KEY_FILE}")
18  set_config_bool(${image} CONFIG_BOOT_ENCRYPT_IMAGE "${SB_CONFIG_BOOT_ENCRYPTION}")
19  if(SB_CONFIG_BOOT_ENCRYPTION)
20    set_config_string(${image} CONFIG_BOOT_ENCRYPTION_KEY_FILE "${SB_CONFIG_BOOT_ENCRYPTION_KEY_FILE}")
21  endif()
22endif()
23