blob: 3e2cb15c30641f7a9b49130cfd55c74f44c0b3a2 [file] [log] [blame]
Mazen NEIFERffd4eb92017-01-27 10:28:41 +01001#
2# Copyright (c) 2017 Intel Corporation
3# Copyright (c) 2016 Cadence Design Systems, Inc.
4# SPDX-License-Identifier: Apache-2.0
5#
6
Mazen NEIFERffd4eb92017-01-27 10:28:41 +01007# Abstraction of 'run' goal with xt-run
Mazen NEIFERffd4eb92017-01-27 10:28:41 +01008ifneq (${QEMU_PTY},)
Andrew Boiea95d5242017-02-06 10:35:35 -08009# By default xt-sim uses pty, do nothing
Mazen NEIFERffd4eb92017-01-27 10:28:41 +010010endif
11
Andrew Boie495d9222017-02-03 00:57:25 -080012run: zephyr
Andrew Boie11ee7912017-04-11 15:10:00 -070013 @echo "**** Running simulation for Xtensa core \"${CONFIG_SOC}\" ****"
Mazen NEIFERffd4eb92017-01-27 10:28:41 +010014 $(if ${QEMU_PIPE},,@echo "To exit from XT-RUN enter: 'CTRL+c'")
Andrew Boie11ee7912017-04-11 15:10:00 -070015 @echo '[XT-RUN] CPU: ${CONFIG_SOC}'
Andrew Boie495d9222017-02-03 00:57:25 -080016 # Run the emulator in the background and leave a PID file for
17 # sanitycheck
Andrew Boiea95d5242017-02-06 10:35:35 -080018ifneq ($(QEMU_PIPE),)
19 # Use the existing interface that we set up for QEMU:
20 # 1) A pair of pipe for console input and output, named
21 # $(QEMU_PIPE).in and $(QEMU_PIPE).out. The extensions are implicit
22 # in QEMU's -seral pipe:.... argument.
23 # 2) A PID file so that sanitycheck can kill the emulator
Anas Nashif7708ff82017-05-11 08:38:54 -040024 ${Q} ${XTRUN} ${XTRUN_FLAGS} ${XTRUN_EXTRA_FLAGS} ${O}/${KERNEL_ELF_NAME} \
Andrew Boiea95d5242017-02-06 10:35:35 -080025 < ${QEMU_PIPE}.in > ${QEMU_PIPE}.out & echo $$! > qemu.pid
Andrew Boie495d9222017-02-03 00:57:25 -080026 # Wait until the emulator terminates (for any reason)
27 $(Q) cat qemu.pid | xargs $(srctree)/scripts/waitpid
Andrew Boiea95d5242017-02-06 10:35:35 -080028else
Anas Nashif7708ff82017-05-11 08:38:54 -040029 ${Q} ${XTRUN} ${XTRUN_FLAGS} ${XTRUN_EXTRA_FLAGS} ${O}/${KERNEL_ELF_NAME}
Andrew Boiea95d5242017-02-06 10:35:35 -080030endif
Mazen NEIFERffd4eb92017-01-27 10:28:41 +010031
Andrew Boie495d9222017-02-03 00:57:25 -080032.PHONY: run