Skip to content

Commit 063432a

Browse files
committed
sysbuild: Allow to build multicore XIP config
Since multicore application uses multiple secondary apps, they cannot hold the same name (`mcuboot_secondary_app`) and the build system must be adjusted to generate secondary application name, based on the primary application name (i.e. `<application>_secondary_app). Keep the old name (`mcuboot_secondary_app`) for the main (default) image to keep the backward compatibility with existing tests and documentation. Ref: NCSDK-NONE Signed-off-by: Tomasz Chyrowicz <[email protected]>
1 parent 72aaada commit 063432a

File tree

6 files changed

+252
-137
lines changed

6 files changed

+252
-137
lines changed

cmake/sysbuild/modules/ncs_sysbuild_extensions.cmake

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,85 @@
55

66
include_guard(GLOBAL)
77

8+
# Usage:
9+
# UpdateableImage_Add(APPLICATION <name>
10+
# GROUP <name>
11+
# )
12+
#
13+
# This function includes an image inside a list that will be used to trigger
14+
# bootloader-dependent build and packaging logic.
15+
#
16+
# APPLICATION <name>: Name of the application.
17+
# GROUP <name>: Application group (i.e. VARIANT)
18+
function(UpdateableImage_Add)
19+
cmake_parse_arguments(VIMAGE "" "APPLICATION;GROUP" "" ${ARGN})
20+
21+
if(VIMAGE_GROUP)
22+
set(group ${VIMAGE_GROUP})
23+
else()
24+
set(group "DEFAULT")
25+
endif()
26+
27+
# Update list of avilable groups
28+
get_property(
29+
groups GLOBAL PROPERTY sysbuild_updateable_groups
30+
)
31+
list(APPEND groups ${group})
32+
list(REMOVE_DUPLICATES groups)
33+
set_property(
34+
GLOBAL PROPERTY sysbuild_updateable_groups ${groups}
35+
)
36+
37+
# Append the image name
38+
set_property(
39+
GLOBAL
40+
APPEND PROPERTY sysbuild_updateable_${group} ${VIMAGE_APPLICATION}
41+
)
42+
endfunction()
43+
44+
# Usage:
45+
# UpdateableImage_Get(<outvar> [ALL|GROUP <group>])
46+
#
47+
# This function returns a list of images, assigned to the specified group.
48+
#
49+
# <outvar>: Name of variable to set.
50+
# ALL: Get images from all groups.
51+
# GROUP <group>: Image update group.
52+
# Use "DEFAULT" to get the default group (including DEFAULT_IMAGE).
53+
function(UpdateableImage_Get outvar)
54+
set(all_images)
55+
set(group)
56+
57+
cmake_parse_arguments(VGRP "ALL" "GROUP" "" ${ARGN})
58+
if(VGRP_GROUP)
59+
list(APPEND group ${VGRP_GROUP})
60+
endif()
61+
62+
if(VGRP_ALL)
63+
get_property(
64+
group GLOBAL PROPERTY sysbuild_updateable_groups
65+
)
66+
list(APPEND group "DEFAULT")
67+
list(REMOVE_DUPLICATES group)
68+
endif()
69+
70+
foreach(image_group ${group})
71+
get_property(
72+
images GLOBAL PROPERTY sysbuild_updateable_${image_group}
73+
)
74+
if(images)
75+
list(APPEND all_images "${images}")
76+
endif()
77+
78+
# Include the DEFAULT_IMAGE if the DEFAULT group is used.
79+
if(${image_group} STREQUAL "DEFAULT")
80+
list(APPEND all_images ${DEFAULT_IMAGE})
81+
endif()
82+
endforeach()
83+
84+
set(${outvar} "${all_images}" PARENT_SCOPE)
85+
endfunction()
86+
887
# Usage:
988
# ExternalNcsVariantProject_Add(APPLICATION <name>
1089
# VARIANT <name>

doc/mcuboot/readme-ncs.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ See the `MCUboot output build files`_ page for a list of all these files.
2626

2727
.. note::
2828
When you use MCUboot in the direct-xip mode, enable the ``SB_CONFIG_MCUBOOT_BUILD_DIRECT_XIP_VARIANT`` sysbuild Kconfig option to let the build system generate an additional set of files for the second application slot.
29-
These files are identical to the ones listed on the `MCUboot output build files`_ page, but they are placed in the :file:`mcuboot_secondary_app` folder.
29+
These files are identical to the ones listed on the `MCUboot output build files`_ page, but they are placed in the :file:`mcuboot_secondary_app` folder for the main application, while the files for the remaining applications are located in the respective :file:`<application>_secondary_app` folder.
3030
For example, :file:`mcuboot_secondary_app/zephyr/zephyr.signed.bin` is created and placed in the second slot on the target device when the :file:`zephyr.signed.bin` file is placed in the first slot.
31+
Similarly, the :file:`ipc_radio_secondary_app/zephyr/zephyr.signed.bin` file is created and placed in the second slot on the target device when the :file:`ipc_radio/zephyr/zephyr.signed.bin` file is placed in the first slot.
3132
For more information about the direct-xip mode, see the *Equal slots (direct-xip)* section in the :doc:`Bootloader documentation <design>`.

0 commit comments

Comments
 (0)