sysbuild: Import image devicetrees

Make the image devicetrees available to sysbuild for advanced use cases.

This is done by calling `zephyr_dt_import` on each image target. The DT
target properties are all expected to be prefixed with `DT_`, so there
should be no conflicts.

Thus, the DT contents of a given `<image>` can be retrieved using e.g.:

    dt_nodelabel(<var> NODELABEL <label> TARGET <image>)

as noted in `extensions.cmake`.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
This commit is contained in:
Grzegorz Swiderski 2025-05-20 16:41:02 +02:00 committed by Benjamin Cabé
commit da197fe9ef
2 changed files with 5 additions and 0 deletions

View file

@ -3816,6 +3816,10 @@ endfunction()
# alias at the beginning of a path interchangeably with the full
# path to the aliased node in these functions. The usage comments
# will make this clear in each case.
#
# - These methods are also available to sysbuild. To retrieve the DT
# information of some <image>, after its CMake configuration step,
# the dt_* function call must include a "TARGET <image>" argument.
# Usage:
# dt_nodelabel(<var> NODELABEL <label> [REQUIRED] [TARGET <target>])

View file

@ -523,6 +523,7 @@ function(ExternalZephyrProject_Cmake)
endif()
load_cache(IMAGE ${ZCMAKE_APPLICATION} BINARY_DIR ${BINARY_DIR})
import_kconfig(CONFIG_ ${BINARY_DIR}/zephyr/.config TARGET ${ZCMAKE_APPLICATION})
zephyr_dt_import(EDT_PICKLE_FILE ${BINARY_DIR}/zephyr/edt.pickle TARGET ${ZCMAKE_APPLICATION})
# This custom target informs CMake how the BYPRODUCTS are generated if a target
# depends directly on the BYPRODUCT instead of depending on the image target.