cmake: support multiple entries in board.cmake
Currently there is no way to support running a board on multiple emulation platforms nor to choose a desired emulation platform for the simulation to be run on. This commit introduces a new SUPPORTED_EMU_PLATFORMS list, which defines available emulation platforms for a given board. Fixes #12375. Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
This commit is contained in:
parent
6aa783ed6a
commit
94428044e2
|
@ -1603,8 +1603,17 @@ if(HEX_FILES_TO_MERGE)
|
|||
message(VERBOSE "Merging hex files: ${HEX_FILES_TO_MERGE}")
|
||||
endif()
|
||||
|
||||
if(EMU_PLATFORM)
|
||||
include(${ZEPHYR_BASE}/cmake/emu/${EMU_PLATFORM}.cmake)
|
||||
if(SUPPORTED_EMU_PLATFORMS)
|
||||
list(GET SUPPORTED_EMU_PLATFORMS 0 default_emu)
|
||||
add_custom_target(run DEPENDS run_${default_emu})
|
||||
|
||||
foreach(EMU_PLATFORM ${SUPPORTED_EMU_PLATFORMS})
|
||||
include(${ZEPHYR_BASE}/cmake/emu/${EMU_PLATFORM}.cmake)
|
||||
endforeach()
|
||||
|
||||
if(TARGET debugserver_${default_emu})
|
||||
add_custom_target(debugserver DEPENDS debugserver_${default_emu})
|
||||
endif()
|
||||
else()
|
||||
add_custom_target(run
|
||||
COMMAND
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
set(EMU_PLATFORM nsim)
|
||||
set(SUPPORTED_EMU_PLATFORMS nsim)
|
||||
|
||||
if(NOT (CONFIG_SOC_NSIM_HS_SMP OR CONFIG_SOC_NSIM_HS6X_SMP))
|
||||
board_set_flasher_ifnset(arc-nsim)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
set(EMU_PLATFORM qemu)
|
||||
set(SUPPORTED_EMU_PLATFORMS qemu)
|
||||
|
||||
set(QEMU_CPU_TYPE_${ARCH} arc)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set(EMU_PLATFORM qemu)
|
||||
set(SUPPORTED_EMU_PLATFORMS qemu)
|
||||
|
||||
set(QEMU_CPU_TYPE_${ARCH} cortex-m3)
|
||||
set(QEMU_FLAGS_${ARCH}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set(EMU_PLATFORM qemu)
|
||||
set(SUPPORTED_EMU_PLATFORMS qemu)
|
||||
|
||||
set(QEMU_CPU_TYPE_${ARCH} cortex-m33)
|
||||
set(QEMU_FLAGS_${ARCH}
|
||||
|
|
|
@ -9,35 +9,31 @@
|
|||
#
|
||||
# $ west build -b mps3_an547 samples/hello°world -DEMU_PLATFORM=qemu -t run
|
||||
|
||||
if(NOT DEFINED EMU_PLATFORM)
|
||||
set(EMU_PLATFORM qemu)
|
||||
endif()
|
||||
set(SUPPORTED_EMU_PLATFORMS qemu armfvp)
|
||||
|
||||
if (EMU_PLATFORM STREQUAL "qemu")
|
||||
# QEMU settings
|
||||
set(QEMU_CPU_TYPE_${ARCH} cortex-m55)
|
||||
set(QEMU_FLAGS_${ARCH}
|
||||
-cpu ${QEMU_CPU_TYPE_${ARCH}}
|
||||
-machine mps3-an547
|
||||
-nographic
|
||||
-vga none
|
||||
)
|
||||
board_set_debugger_ifnset(qemu)
|
||||
else()
|
||||
# FVP settings
|
||||
set(ARMFVP_BIN_NAME FVP_Corstone_SSE-300_Ethos-U55)
|
||||
# QEMU settings
|
||||
set(QEMU_CPU_TYPE_${ARCH} cortex-m55)
|
||||
set(QEMU_FLAGS_${ARCH}
|
||||
-cpu ${QEMU_CPU_TYPE_${ARCH}}
|
||||
-machine mps3-an547
|
||||
-nographic
|
||||
-vga none
|
||||
)
|
||||
board_set_debugger_ifnset(qemu)
|
||||
|
||||
# FVP Parameters
|
||||
# -C indicate a config option in the form of:
|
||||
# instance.parameter=value
|
||||
# Run the FVP with --list-params to list all options
|
||||
set(ARMFVP_FLAGS
|
||||
-C mps3_board.uart0.out_file=-
|
||||
-C mps3_board.uart0.unbuffered_output=1
|
||||
-C mps3_board.uart1.out_file=-
|
||||
-C mps3_board.uart1.unbuffered_output=1
|
||||
-C mps3_board.uart2.out_file=-
|
||||
-C mps3_board.uart2.unbuffered_output=1
|
||||
-C mps3_board.visualisation.disable-visualisation=1
|
||||
)
|
||||
endif()
|
||||
# FVP settings
|
||||
set(ARMFVP_BIN_NAME FVP_Corstone_SSE-300_Ethos-U55)
|
||||
|
||||
# FVP Parameters
|
||||
# -C indicate a config option in the form of:
|
||||
# instance.parameter=value
|
||||
# Run the FVP with --list-params to list all options
|
||||
set(ARMFVP_FLAGS
|
||||
-C mps3_board.uart0.out_file=-
|
||||
-C mps3_board.uart0.unbuffered_output=1
|
||||
-C mps3_board.uart1.out_file=-
|
||||
-C mps3_board.uart1.unbuffered_output=1
|
||||
-C mps3_board.uart2.out_file=-
|
||||
-C mps3_board.uart2.unbuffered_output=1
|
||||
-C mps3_board.visualisation.disable-visualisation=1
|
||||
)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set(EMU_PLATFORM qemu)
|
||||
set(SUPPORTED_EMU_PLATFORMS qemu)
|
||||
|
||||
set(QEMU_CPU_TYPE_${ARCH} cortex-m0)
|
||||
set(QEMU_FLAGS_${ARCH}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set(EMU_PLATFORM qemu)
|
||||
set(SUPPORTED_EMU_PLATFORMS qemu)
|
||||
|
||||
set(QEMU_CPU_TYPE_${ARCH} cortex-m3)
|
||||
set(QEMU_FLAGS_${ARCH}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set(EMU_PLATFORM qemu)
|
||||
set(SUPPORTED_EMU_PLATFORMS qemu)
|
||||
set(QEMU_ARCH xilinx-aarch64)
|
||||
|
||||
set(QEMU_CPU_TYPE_${ARCH} cortex-r5)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Copyright (c) 2021 Carlo Caione <ccaione@baylibre.com>
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set(EMU_PLATFORM armfvp)
|
||||
set(SUPPORTED_EMU_PLATFORMS armfvp)
|
||||
set(ARMFVP_BIN_NAME FVP_Base_RevC-2xAEMvA)
|
||||
|
||||
set(ARMFVP_FLAGS
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Copyright (c) 2021 Arm Limited (or its affiliates). All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set(EMU_PLATFORM armfvp)
|
||||
set(SUPPORTED_EMU_PLATFORMS armfvp)
|
||||
set(ARMFVP_BIN_NAME FVP_BaseR_AEMv8R)
|
||||
|
||||
set(ARMFVP_FLAGS
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Copyright (c) 2019 Carlo Caione <ccaione@baylibre.com>
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set(EMU_PLATFORM qemu)
|
||||
set(SUPPORTED_EMU_PLATFORMS qemu)
|
||||
set(QEMU_ARCH aarch64)
|
||||
|
||||
set(QEMU_CPU_TYPE_${ARCH} cortex-a53)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set(EMU_PLATFORM qemu)
|
||||
set(SUPPORTED_EMU_PLATFORMS qemu)
|
||||
|
||||
set(QEMU_CPU_TYPE_${ARCH} nios2)
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set(EMU_PLATFORM native)
|
||||
set(SUPPORTED_EMU_PLATFORMS native)
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set(EMU_PLATFORM native)
|
||||
set(SUPPORTED_EMU_PLATFORMS native)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set(EMU_PLATFORM qemu)
|
||||
set(SUPPORTED_EMU_PLATFORMS qemu)
|
||||
|
||||
set(QEMU_CPU_TYPE_${ARCH} riscv32)
|
||||
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
set(EMU_PLATFORM renode)
|
||||
set(SUPPORTED_EMU_PLATFORMS renode)
|
||||
set(RENODE_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/support/it8xxx2_evb.resc)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set(EMU_PLATFORM renode)
|
||||
set(SUPPORTED_EMU_PLATFORMS renode)
|
||||
set(RENODE_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/support/m2gl025_miv.resc)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set(EMU_PLATFORM qemu)
|
||||
set(SUPPORTED_EMU_PLATFORMS qemu)
|
||||
|
||||
set(QEMU_binary_suffix riscv32)
|
||||
set(QEMU_CPU_TYPE_${ARCH} riscv32)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set(EMU_PLATFORM qemu)
|
||||
set(SUPPORTED_EMU_PLATFORMS qemu)
|
||||
|
||||
set(QEMU_binary_suffix riscv64)
|
||||
set(QEMU_CPU_TYPE_${ARCH} riscv64)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set(EMU_PLATFORM tsim)
|
||||
set(SUPPORTED_EMU_PLATFORMS tsim)
|
||||
|
||||
find_program(TSIM tsim-leon3)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set(EMU_PLATFORM tsim)
|
||||
set(SUPPORTED_EMU_PLATFORMS tsim)
|
||||
|
||||
find_program(TSIM tsim-leon3)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set(EMU_PLATFORM qemu)
|
||||
set(SUPPORTED_EMU_PLATFORMS qemu)
|
||||
|
||||
set(QEMU_binary_suffix sparc)
|
||||
set(QEMU_CPU_TYPE_${ARCH} leon3)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set(EMU_PLATFORM qemu)
|
||||
set(SUPPORTED_EMU_PLATFORMS qemu)
|
||||
|
||||
if(NOT CONFIG_REBOOT)
|
||||
set(REBOOT_FLAG -no-reboot)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set(EMU_PLATFORM qemu)
|
||||
set(SUPPORTED_EMU_PLATFORMS qemu)
|
||||
|
||||
set(QEMU_CPU_TYPE_${ARCH} sample_controller)
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ else()
|
|||
)
|
||||
endif()
|
||||
|
||||
add_custom_target(run
|
||||
add_custom_target(run_armfvp
|
||||
COMMAND
|
||||
${ARMFVP}
|
||||
${ARMFVP_FLAGS}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
add_custom_target(run
|
||||
add_custom_target(run_native
|
||||
COMMAND
|
||||
${APPLICATION_BINARY_DIR}/zephyr/${KERNEL_EXE_NAME}
|
||||
DEPENDS ${logical_target_for_zephyr_elf}
|
||||
|
|
|
@ -34,7 +34,7 @@ else()
|
|||
endif()
|
||||
|
||||
string(REPLACE ";" " " MDB_COMMAND "${MDB_OPTIONS}")
|
||||
add_custom_target(run
|
||||
add_custom_target(run_nsim
|
||||
COMMAND
|
||||
${MDB_OPTIONS}
|
||||
${APPLICATION_BINARY_DIR}/zephyr/${KERNEL_ELF_NAME}
|
||||
|
@ -49,7 +49,7 @@ find_program(
|
|||
nsimdrv
|
||||
)
|
||||
|
||||
add_custom_target(run
|
||||
add_custom_target(run_nsim
|
||||
COMMAND
|
||||
${NSIM}
|
||||
-propsfile
|
||||
|
@ -61,7 +61,7 @@ add_custom_target(run
|
|||
USES_TERMINAL
|
||||
)
|
||||
|
||||
add_custom_target(debugserver
|
||||
add_custom_target(debugserver_nsim
|
||||
COMMAND
|
||||
${NSIM}
|
||||
-propsfile
|
||||
|
|
|
@ -37,8 +37,8 @@ if(CONFIG_QEMU_UEFI_BOOT)
|
|||
endif()
|
||||
|
||||
set(qemu_targets
|
||||
run
|
||||
debugserver
|
||||
run_qemu
|
||||
debugserver_qemu
|
||||
)
|
||||
|
||||
set(QEMU_FLAGS -pidfile)
|
||||
|
@ -340,7 +340,7 @@ set(env_qemu $ENV{QEMU_EXTRA_FLAGS})
|
|||
separate_arguments(env_qemu)
|
||||
list(APPEND QEMU_EXTRA_FLAGS ${env_qemu})
|
||||
|
||||
list(APPEND MORE_FLAGS_FOR_debugserver -s -S)
|
||||
list(APPEND MORE_FLAGS_FOR_debugserver_qemu -s -S)
|
||||
|
||||
# Architectures can define QEMU_KERNEL_FILE to use a specific output
|
||||
# file to pass to qemu (and a "qemu_kernel_target" target to generate
|
||||
|
|
|
@ -11,7 +11,7 @@ set(RENODE_FLAGS
|
|||
--pid-file renode.pid
|
||||
)
|
||||
|
||||
add_custom_target(run
|
||||
add_custom_target(run_renode
|
||||
COMMAND
|
||||
${RENODE}
|
||||
${RENODE_FLAGS}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
set(TSIM_FLAGS -e run -e exit)
|
||||
|
||||
add_custom_target(run
|
||||
add_custom_target(run_tsim
|
||||
COMMAND
|
||||
${TSIM}
|
||||
${TSIM_SYS}
|
||||
|
|
|
@ -141,7 +141,7 @@ foreach(target flash debug debugserver attach)
|
|||
set(comment "Debugging ${BOARD}")
|
||||
elseif(target STREQUAL debugserver)
|
||||
set(comment "Debugging ${BOARD}")
|
||||
if(EMU_PLATFORM)
|
||||
if(SUPPORTED_EMU_PLATFORMS)
|
||||
# cmake/qemu/CMakeLists.txt will add a debugserver target for
|
||||
# emulation platforms, so we don't add one here
|
||||
continue()
|
||||
|
|
Loading…
Reference in a new issue