summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMazen NEIFER <mazen@nestwave.com>2017-01-27 10:28:41 +0100
committerAndrew Boie <andrew.p.boie@intel.com>2017-01-30 09:04:11 -0800
commit0a223aee5a8457bc810089976836ff095fba02b9 (patch)
treefecc1e8fafabaae0a033baf7fd08126394210a7c
parent7f6b82a0ff60a5112467404124b30fa20f51830f (diff)
Xtensa port: Changed simulation support with xt-run/xtsc-run to be qemu like.
Change-Id: I1626a5cd75d17bc4f72d4a638484f87956f9e703 Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
-rw-r--r--scripts/Makefile.toolchain.xcc28
-rw-r--r--scripts/Makefile.xt-run38
-rw-r--r--scripts/Makefile.xtsc-run51
3 files changed, 93 insertions, 24 deletions
diff --git a/scripts/Makefile.toolchain.xcc b/scripts/Makefile.toolchain.xcc
index a5e2c1038..1ee806f6c 100644
--- a/scripts/Makefile.toolchain.xcc
+++ b/scripts/Makefile.toolchain.xcc
@@ -71,6 +71,10 @@ KBUILD_CPPFLAGS += -I$(XTENSA_TOOLS_PATH)/lib/xcc/include \
-I${XTENSA_BUILD}/xtensa-elf/include \
-D'__builtin_unreachable()=while(1);'
+# Support for Xtensa simulator from Cadence Design Systems, Inc.
+XTRUN=${CROSS_COMPILE}run
+XTRUN_FLAGS += --cycle_limit=${XTENSA_ISS_CYCLES_LIMIT}
+
export CROSS_COMPILE XTENSA_CORE XTENSA_SYSTEM LIB_INCLUDE_DIR
endif
@@ -80,27 +84,3 @@ prepare2:
"${XTENSA_BUILD}"' && \
exit 1 \
)
-
-xt-run:all xt-core
- ${Q}${CROSS_COMPILE}run --cycle_limit=${XTENSA_ISS_CYCLES_LIMIT} zephyr.elf
-
-xtsc-run:all xt-core
- ${Q}test -f ${XTSC_INC} || ( \
- echo '*** Error: $@ requires valid XTSC include file in \
- "$${CONFIG_XTENSA_XTSC_INC}"' && \
- exit 1 \
- )
- ${Q}sed -e 's@\(-core_program=\).*@\1${CURDIR}/zephyr.elf@' \
- < ${XTSC_INC} > ${XTSC_INC_FILE}
- ${Q}cd ${XTSC_WORK_DIR} && \
- $(dir ${CROSS_COMPILE})xtsc-run \
- $(if ${XTSC_TRACE},-set_core_parm=SimClients="trace \
- ${CURDIR}/${XTSC_TRACE}") \
- -include=${CURDIR}/${XTSC_INC_FILE} \
- $(if ${XTSC_DEBUG},-xxdebug \
- )
-
-xt-core:
- ${Q}echo "***** Running simulation for Xtensa core \"${XTENSA_CORE}\" *****"
-
-.PHONY: xt-run, xtsc-run, xt-core
diff --git a/scripts/Makefile.xt-run b/scripts/Makefile.xt-run
new file mode 100644
index 000000000..7935e82ee
--- /dev/null
+++ b/scripts/Makefile.xt-run
@@ -0,0 +1,38 @@
+#
+# Copyright (c) 2017 Intel Corporation
+# Copyright (c) 2016 Cadence Design Systems, Inc.
+# SPDX-License-Identifier: Apache-2.0
+#
+
+
+# Abstraction of 'run' goal with xt-run
+
+ifneq (${QEMU_PTY},)
+ # By default xt-sim uses pty, do nothing
+else
+# We use QEMU_PIPE in order to avoid unnecessary changes in other scripts
+# We are anyway emulating a QEMU behavior
+ifneq (${QEMU_PIPE},)
+ # Send console output to a pipe, used for running automated sanity tests
+ XTRUN_FLAGS += > ${QEMU_PIPE}
+endif
+endif
+
+xt-run:run
+run:zephyr
+ ${Q}echo "***** Running simulation for Xtensa core \"${XTENSA_CORE}\" *****"
+ $(if ${QEMU_PIPE},,@echo "To exit from XT-RUN enter: 'CTRL+c'")
+ @echo '[XT-RUN] CPU: ${XTENSA_CORE}'
+ifneq (${QEMU_PIPE},)
+# Create a named pipe
+ mkfifo ${QEMU_PIPE}
+endif
+# Run cycle accurate simulation
+# Ignore errors in order to be able to remove the named pipe at simulation end
+ -${Q}${XTRUN} ${KERNEL_ELF_NAME} ${XTRUN_FLAGS} ${XTRUN_EXTRA_FLAGS}
+ifneq (${QEMU_PIPE},)
+# Remove the named pipe
+ ${RM} ${QEMU_PIPE}
+endif
+
+.PHONY: run xt-run
diff --git a/scripts/Makefile.xtsc-run b/scripts/Makefile.xtsc-run
new file mode 100644
index 000000000..5adcd45f4
--- /dev/null
+++ b/scripts/Makefile.xtsc-run
@@ -0,0 +1,51 @@
+#
+# Copyright (c) 2017 Intel Corporation
+# Copyright (c) 2016 Cadence Design Systems, Inc.
+# SPDX-License-Identifier: Apache-2.0
+#
+
+
+# Abstraction of 'run' goal with xtsc-run
+
+ifneq (${QEMU_PTY},)
+ # By default xt-sim uses pty, do nothing
+else
+# We use QEMU_PIPE in order to avoid unnecessary changes in other scripts
+# We are anyway emulating a QEMU behavior
+ifneq (${QEMU_PIPE},)
+ # Send console output to a pipe, used for running automated sanity tests
+ XTRUN_FLAGS += > ${QEMU_PIPE}
+endif
+endif
+
+xtsc-run:run
+run:zephyr
+ ${Q}echo "***** Running simulation for Xtensa core \"${XTENSA_CORE}\" *****"
+ $(if ${QEMU_PIPE},,@echo "To exit from XTSC-RUN enter: 'CTRL+c'")
+ @echo '[XTSC-RUN] CPU: ${XTENSA_CORE}'
+ ${Q}test -f ${XTSC_INC} || ( \
+ echo '*** Error: $@ requires valid XTSC include file in \
+ "$${CONFIG_XTENSA_XTSC_INC}"' && \
+ exit 1 \
+ )
+ ${Q}sed -e 's@\(-core_program=\).*@\1${CURDIR}/zephyr.elf@' \
+ < ${XTSC_INC} > ${XTSC_INC_FILE}
+ifneq (${QEMU_PIPE},)
+# Create a named pipe
+ mkfifo ${QEMU_PIPE}
+endif
+# Run cycle accurate simulation with SystemC extension
+# Ignore errors in order to be able to remove the named pipe at simulation end
+ -${Q}cd ${XTSC_WORK_DIR} && \
+ $(dir ${CROSS_COMPILE})xtsc-run \
+ $(if ${XTSC_TRACE},-set_core_parm=SimClients="trace \
+ ${CURDIR}/${XTSC_TRACE}") \
+ -include=${CURDIR}/${XTSC_INC_FILE} \
+ $(if ${XTSC_DEBUG},-xxdebug \
+ )
+ifneq (${QEMU_PIPE},)
+# Remove the named pipe
+ ${RM} ${QEMU_PIPE}
+endif
+
+.PHONY: run xtsc-run