Skip to content

Commit 11d7bd1

Browse files
hakonfamSebastianBoe
authored andcommitted
bootloader: force multi image mcuboot when b0 enabled
To support updateable mcuboot, mcuboot needs to be built with multi image support. Force this configuration when b0 is enabled. Signed-off-by: Håkon Øye Amundsen <[email protected]>
1 parent dbe74ff commit 11d7bd1

File tree

2 files changed

+25
-8
lines changed

2 files changed

+25
-8
lines changed

subsys/bootloader/image/CMakeLists.txt

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44
# SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
55
#
66

7+
function(add_overlay_config image overlay_file)
8+
set(old_conf ${${image}OVERLAY_CONFIG})
9+
string(FIND "${old_conf}" "${overlay_file}" found)
10+
if (${found} EQUAL -1)
11+
set(${image}OVERLAY_CONFIG
12+
"${old_conf} ${overlay_file}"
13+
CACHE STRING "" FORCE)
14+
endif()
15+
endfunction()
16+
717
# This CMakeLists.txt is executed by the root application only when
818
# B0 (SECURE_BOOT) is enabled. First, figure out what image will be
919
# booted by B0, and set the required properties for that image to be
@@ -12,6 +22,11 @@
1222
if (CONFIG_BOOTLOADER_MCUBOOT)
1323
set(image_to_boot mcuboot_)
1424

25+
add_overlay_config(
26+
mcuboot_
27+
${CMAKE_CURRENT_SOURCE_DIR}/multi_image_mcuboot.conf
28+
)
29+
1530
# Partition S1 is only enabled when MCUBoot is enabled.
1631
set(s1_addr $<TARGET_PROPERTY:partition_manager,PM_S1_ADDRESS>)
1732

@@ -27,14 +42,15 @@ but MCUboot is not being built.")
2742
endif()
2843
endif()
2944

30-
# Include a kconfig file which enables CONFIG_FW_INFO in the image
31-
# which is booted by B0.
32-
set(old_conf ${${image_to_boot}OVERLAY_CONFIG})
33-
string(FIND "${old_conf}" "${CMAKE_CURRENT_SOURCE_DIR}/fw_info.conf" found)
34-
if (${found} EQUAL -1)
35-
set(${image_to_boot}OVERLAY_CONFIG
36-
"${old_conf} ${CMAKE_CURRENT_SOURCE_DIR}/fw_info.conf"
37-
CACHE STRING "" FORCE)
45+
if (image_to_boot)
46+
# Include a kconfig file which enables CONFIG_FW_INFO in the image
47+
# which is booted by B0.
48+
add_overlay_config(
49+
${image_to_boot}
50+
${CMAKE_CURRENT_SOURCE_DIR}/fw_info.conf
51+
)
52+
else()
53+
assert(CONFIG_FW_INFO "CONFIG_FW_INFO must be set")
3854
endif()
3955

4056
# Partition S0 will always contain the image to be booted by B0.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_UPDATEABLE_IMAGE_NUMBER=2

0 commit comments

Comments
 (0)