cmake: emu: Add arm fvp emulator

Add arm fvp emulator in order to use ninja run or west build -t run.
Add armfvp in order to run twister.

Set env ARMFVP_BIN_PATH before using it,
e.g. export ARMFVP_BIN_PATH=<path/to/fvp/dir>
NOTE: ARMFVP_BIN_PATH is the dir path.

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
This commit is contained in:
Jaxson Han 2021-02-24 10:23:46 +08:00 committed by Anas Nashif
commit 8af11d40d0
3 changed files with 27 additions and 2 deletions

22
cmake/emu/armfvp.cmake Normal file
View file

@ -0,0 +1,22 @@
# Copyright (c) 2021 Arm Limited (or its affiliates). All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(armfvp_bin_path $ENV{ARMFVP_BIN_PATH})
find_program(
ARMFVP
PATHS ${armfvp_bin_path}
NO_DEFAULT_PATH
NAMES ${ARMFVP_BIN_NAME}
)
add_custom_target(run
COMMAND
${ARMFVP}
${ARMFVP_FLAGS}
-a ${APPLICATION_BINARY_DIR}/zephyr/${KERNEL_ELF_NAME}
DEPENDS ${ARMFVP} ${logical_target_for_zephyr_elf}
WORKING_DIRECTORY ${APPLICATION_BINARY_DIR}
COMMENT "FVP: ${ARMFVP}"
USES_TERMINAL
)

View file

@ -1810,7 +1810,7 @@ class TestInstance(DisablePyTestCollectionMixin):
target_ready = bool(self.testcase.type == "unit" or \
self.platform.type == "native" or \
self.platform.simulation in ["mdb-nsim", "nsim", "renode", "qemu", "tsim"] or \
self.platform.simulation in ["mdb-nsim", "nsim", "renode", "qemu", "tsim", "armfvp"] or \
filter == 'runnable')
if self.platform.simulation == "nsim":
@ -2268,6 +2268,9 @@ class ProjectBuilder(FilterBuilder):
instance.handler = BinaryHandler(instance, "nsim")
instance.handler.pid_fn = os.path.join(instance.build_dir, "mdb.pid")
instance.handler.call_west_flash = True
elif instance.platform.simulation == "armfvp":
instance.handler = BinaryHandler(instance, "armfvp")
instance.handler.call_make_run = True
if instance.handler:
instance.handler.args = args

View file

@ -20,7 +20,7 @@ mapping:
enum: ["mcu", "qemu", "sim", "unit", "native"]
"simulation":
type: str
enum: ["qemu", "simics", "xt-sim", "renode", "nsim", "mdb-nsim", "tsim"]
enum: ["qemu", "simics", "xt-sim", "renode", "nsim", "mdb-nsim", "tsim", "armfvp"]
"arch":
type: str
"toolchain":