sanitycheck: Add TSIM3 support

TSIM3 is a LEON processor and system simulator.

This commit allows using TSIM sanitycheck and the make run target.

TSIM parameters can be further specified in the board configuration
using TSIM and TSIM_SYS.

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
This commit is contained in:
Martin Åberg 2020-10-19 18:21:52 +02:00 committed by Andrew Boie
commit c107714214
3 changed files with 22 additions and 2 deletions

13
cmake/emu/tsim.cmake Normal file
View file

@ -0,0 +1,13 @@
# SPDX-License-Identifier: Apache-2.0
set(TSIM_FLAGS -e run -e exit)
add_custom_target(run
COMMAND
${TSIM}
${TSIM_SYS}
${TSIM_FLAGS}
${APPLICATION_BINARY_DIR}/zephyr/${KERNEL_ELF_NAME}
WORKING_DIRECTORY ${APPLICATION_BINARY_DIR}
USES_TERMINAL
)

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"]
enum: ["qemu", "simics", "xt-sim", "renode", "nsim", "mdb-nsim", "tsim"]
"arch":
type: str
"toolchain":

View file

@ -1662,7 +1662,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"] or \
self.platform.simulation in ["mdb-nsim", "nsim", "renode", "qemu", "tsim"] or \
filter == 'runnable')
if self.platform.simulation == "nsim":
@ -1677,6 +1677,10 @@ class TestInstance(DisablePyTestCollectionMixin):
if not find_executable("renode"):
target_ready = False
if self.platform.simulation == "tsim":
if not find_executable("tsim-leon3"):
target_ready = False
testcase_runnable = self.testcase_runnable(self.testcase, fixtures)
return testcase_runnable and target_ready
@ -2063,6 +2067,9 @@ class ProjectBuilder(FilterBuilder):
instance.handler = BinaryHandler(instance, "renode")
instance.handler.pid_fn = os.path.join(instance.build_dir, "renode.pid")
instance.handler.call_make_run = True
elif instance.platform.simulation == "tsim":
instance.handler = BinaryHandler(instance, "tsim")
instance.handler.call_make_run = True
elif self.device_testing:
instance.handler = DeviceHandler(instance, "device")
elif instance.platform.simulation == "nsim":