cmake: qemu: Support delayed expansion of QEMU_KERNEL_OPTION

This commit allows the `QEMU_KERNEL_OPTION` variable, which can be
overridden by the `board.cmake`, to contain references to the variables
that are not available at the time of `board.cmake` inclusion, by
expanding its escpaed variable references in `cmake/emu/qemu.cmake`
which is included nearby the end of the root `CMakeLists.txt`.

With this change, the `board.cmake` can escape variable references as
follows and allow them to be expanded later:

set(QEMU_KERNEL_OPTION "-device;loader,file=\$<TARGET_FILE:$\{...}>")

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit is contained in:
Stephanos Ioannidis 2020-03-24 11:55:15 +09:00 committed by Ioannis Glaropoulos
commit 19965f8173
2 changed files with 3 additions and 1 deletions

View file

@ -14,7 +14,7 @@ set(QEMU_FLAGS_${ARCH}
)
set(QEMU_KERNEL_OPTION
"-device;loader,file=$<TARGET_FILE:zephyr_final>,cpu-num=4"
"-device;loader,file=\$<TARGET_FILE:\${logical_target_for_zephyr_elf}>,cpu-num=4"
"-device;loader,addr=0xff5e023c,data=0x80008fde,data-len=4"
"-device;loader,addr=0xff9a0000,data=0x80000218,data-len=4"
)

View file

@ -298,6 +298,8 @@ if(DEFINED QEMU_KERNEL_FILE)
set(QEMU_KERNEL_OPTION "-kernel;${QEMU_KERNEL_FILE}")
elseif(NOT DEFINED QEMU_KERNEL_OPTION)
set(QEMU_KERNEL_OPTION "-kernel;$<TARGET_FILE:${logical_target_for_zephyr_elf}>")
elseif(DEFINED QEMU_KERNEL_OPTION)
string(CONFIGURE "${QEMU_KERNEL_OPTION}" QEMU_KERNEL_OPTION)
endif()
foreach(target ${qemu_targets})