Skip to content

Commit

Permalink
cmake: qemu: Support delayed expansion of QEMU_KERNEL_OPTION
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
stephanosio committed Apr 1, 2020
1 parent d82356b commit e77b825
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion boards/arm/qemu_cortex_r5/board.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
2 changes: 2 additions & 0 deletions cmake/emu/qemu.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down

0 comments on commit e77b825

Please sign in to comment.