1# Copyright (c) 2023-2024 Nordic Semiconductor 2# 3# SPDX-License-Identifier: Apache-2.0 4 5# This sysbuild CMake file sets the sysbuild controlled settings as properties 6# on Zephyr MCUboot / bootloader image. 7 8set(bootmodes CONFIG_SINGLE_APPLICATION_SLOT 9 CONFIG_BOOT_SWAP_USING_SCRATCH 10 CONFIG_BOOT_UPGRADE_ONLY 11 CONFIG_BOOT_SWAP_USING_MOVE 12 CONFIG_BOOT_DIRECT_XIP 13 CONFIG_BOOT_RAM_LOAD 14 CONFIG_BOOT_FIRMWARE_LOADER) 15 16if(SB_CONFIG_MCUBOOT_MODE_SINGLE_APP) 17 set(bootmode CONFIG_SINGLE_APPLICATION_SLOT) 18elseif(SB_CONFIG_MCUBOOT_MODE_SWAP_WITHOUT_SCRATCH) 19 set(bootmode CONFIG_BOOT_SWAP_USING_MOVE) 20elseif(SB_CONFIG_MCUBOOT_MODE_SWAP_SCRATCH) 21 set(bootmode CONFIG_BOOT_SWAP_USING_SCRATCH) 22elseif(SB_CONFIG_MCUBOOT_MODE_OVERWRITE_ONLY) 23 set(bootmode CONFIG_BOOT_UPGRADE_ONLY) 24elseif(SB_CONFIG_MCUBOOT_MODE_DIRECT_XIP OR SB_CONFIG_MCUBOOT_MODE_DIRECT_XIP_WITH_REVERT) 25 set(bootmode CONFIG_BOOT_DIRECT_XIP) 26elseif(SB_CONFIG_MCUBOOT_MODE_RAM_LOAD) 27 set(bootmode CONFIG_BOOT_RAM_LOAD) 28elseif(SB_CONFIG_MCUBOOT_MODE_FIRMWARE_UPDATER) 29 set(bootmode CONFIG_BOOT_FIRMWARE_LOADER) 30endif() 31 32foreach(loopbootmode ${bootmodes}) 33 if("${loopbootmode}" STREQUAL "${bootmode}") 34 set_config_bool(${ZCMAKE_APPLICATION} ${loopbootmode} y) 35 else() 36 set_config_bool(${ZCMAKE_APPLICATION} ${loopbootmode} n) 37 endif() 38endforeach() 39 40if(SB_CONFIG_MCUBOOT_MODE_DIRECT_XIP_WITH_REVERT) 41 set_config_bool(${ZCMAKE_APPLICATION} CONFIG_BOOT_DIRECT_XIP_REVERT y) 42else() 43 set_config_bool(${ZCMAKE_APPLICATION} CONFIG_BOOT_DIRECT_XIP_REVERT n) 44endif() 45 46set(keytypes CONFIG_BOOT_SIGNATURE_TYPE_NONE 47 CONFIG_BOOT_SIGNATURE_TYPE_RSA 48 CONFIG_BOOT_SIGNATURE_TYPE_ECDSA_P256 49 CONFIG_BOOT_SIGNATURE_TYPE_ED25519) 50 51if(SB_CONFIG_BOOT_SIGNATURE_TYPE_NONE) 52 set(keytype CONFIG_BOOT_SIGNATURE_TYPE_NONE) 53elseif(SB_CONFIG_BOOT_SIGNATURE_TYPE_RSA) 54 set(keytype CONFIG_BOOT_SIGNATURE_TYPE_RSA) 55elseif(SB_CONFIG_BOOT_SIGNATURE_TYPE_ECDSA_P256) 56 set(keytype CONFIG_BOOT_SIGNATURE_TYPE_ECDSA_P256) 57elseif(SB_CONFIG_BOOT_SIGNATURE_TYPE_ED25519) 58 set(keytype CONFIG_BOOT_SIGNATURE_TYPE_ED25519) 59endif() 60 61foreach(loopkeytype ${keytypes}) 62 if("${loopkeytype}" STREQUAL "${keytype}") 63 set_config_bool(${ZCMAKE_APPLICATION} ${loopkeytype} y) 64 else() 65 set_config_bool(${ZCMAKE_APPLICATION} ${loopkeytype} n) 66 endif() 67endforeach() 68