Skip to content

Commit 19965f8

Browse files
stephanosioioannisg
authored andcommitted
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 <[email protected]>
1 parent 95bdbe3 commit 19965f8

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

boards/arm/qemu_cortex_r5/board.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ set(QEMU_FLAGS_${ARCH}
1414
)
1515

1616
set(QEMU_KERNEL_OPTION
17-
"-device;loader,file=$<TARGET_FILE:zephyr_final>,cpu-num=4"
17+
"-device;loader,file=\$<TARGET_FILE:\${logical_target_for_zephyr_elf}>,cpu-num=4"
1818
"-device;loader,addr=0xff5e023c,data=0x80008fde,data-len=4"
1919
"-device;loader,addr=0xff9a0000,data=0x80000218,data-len=4"
2020
)

cmake/emu/qemu.cmake

+2
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,8 @@ if(DEFINED QEMU_KERNEL_FILE)
298298
set(QEMU_KERNEL_OPTION "-kernel;${QEMU_KERNEL_FILE}")
299299
elseif(NOT DEFINED QEMU_KERNEL_OPTION)
300300
set(QEMU_KERNEL_OPTION "-kernel;$<TARGET_FILE:${logical_target_for_zephyr_elf}>")
301+
elseif(DEFINED QEMU_KERNEL_OPTION)
302+
string(CONFIGURE "${QEMU_KERNEL_OPTION}" QEMU_KERNEL_OPTION)
301303
endif()
302304

303305
foreach(target ${qemu_targets})

0 commit comments

Comments
 (0)