Skip to content

Commit 86dda45

Browse files
committed
cmake: create domains.yaml
Support creation of domains.yaml to support `west <build|flash|debug> --domain` when working with sysbuild multi image. Each Zephyr based image is added to list of domain that can be handled by the Zephyr west extension commands. Signed-off-by: Torsten Rasmussen <[email protected]>
1 parent f655493 commit 86dda45

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

share/sysbuild/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,13 @@ ExternalZephyrProject_Add(
3636
SOURCE_DIR ${APP_DIR}
3737
MAIN_APP
3838
)
39+
list(APPEND IMAGES "${app_name}")
40+
set(DEFAULT_IMAGE "${app_name}")
3941

4042
add_subdirectory(bootloader)
4143

4244
# This allows for board and app specific images to be included.
4345
include(${BOARD_DIR}/sysbuild.cmake OPTIONAL)
4446
include(${APP_DIR}/sysbuild.cmake OPTIONAL)
47+
48+
include(cmake/domains.cmake)

share/sysbuild/bootloader/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@ if(SB_CONFIG_BOOTLOADER_MCUBOOT)
88
APPLICATION mcuboot
99
SOURCE_DIR ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/zephyr/
1010
)
11+
# MCUBoot default configuration is to perform a full chip erase.
12+
# Placing MCUBoot first in list to ensure it is flashed before other images.
13+
set(IMAGES "mcuboot" ${IMAGES} PARENT_SCOPE)
1114
endif()

share/sysbuild/cmake/domains.cmake

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright (c) 2021 Nordic Semiconductor
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
set(domains_yaml "default: ${DEFAULT_IMAGE}")
6+
set(domains_yaml "${domains_yaml}\nbuild_dir: ${CMAKE_BINARY_DIR}")
7+
set(domains_yaml "${domains_yaml}\ndomains:")
8+
foreach(image ${IMAGES})
9+
set(domains_yaml "${domains_yaml}\n - name: ${image}")
10+
set(domains_yaml "${domains_yaml}\n build_dir: $<TARGET_PROPERTY:${image},_EP_BINARY_DIR>")
11+
endforeach()
12+
file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/domains.yaml CONTENT "${domains_yaml}")

0 commit comments

Comments
 (0)