zephyr/scripts/Makefile.xt-run
Andrew Boie a95d524328 xt-run: don't leave dead emulator processes lying around
A ctrl-c in the script wouldn't terminate the child process.
Only do the pid trick if we're communicating with sanitycheck over
pipes.

Change-Id: I79da7362958b5fac00defd74d4b709076085575b
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 11:39:02 -08:00

33 lines
1.1 KiB
Makefile

#
# 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
endif
run: zephyr
@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}'
# Run the emulator in the background and leave a PID file for
# sanitycheck
ifneq ($(QEMU_PIPE),)
# Use the existing interface that we set up for QEMU:
# 1) A pair of pipe for console input and output, named
# $(QEMU_PIPE).in and $(QEMU_PIPE).out. The extensions are implicit
# in QEMU's -seral pipe:.... argument.
# 2) A PID file so that sanitycheck can kill the emulator
${Q} ${XTRUN} ${XTRUN_FLAGS} ${XTRUN_EXTRA_FLAGS} ${KERNEL_ELF_NAME} \
< ${QEMU_PIPE}.in > ${QEMU_PIPE}.out & echo $$! > qemu.pid
# Wait until the emulator terminates (for any reason)
$(Q) cat qemu.pid | xargs $(srctree)/scripts/waitpid
else
${Q} ${XTRUN} ${XTRUN_FLAGS} ${XTRUN_EXTRA_FLAGS} ${KERNEL_ELF_NAME}
endif
.PHONY: run