Mazen NEIFER | ffd4eb9 | 2017-01-27 10:28:41 +0100 | [diff] [blame] | 1 | # |
| 2 | # Copyright (c) 2017 Intel Corporation |
| 3 | # Copyright (c) 2016 Cadence Design Systems, Inc. |
| 4 | # SPDX-License-Identifier: Apache-2.0 |
| 5 | # |
| 6 | |
Mazen NEIFER | ffd4eb9 | 2017-01-27 10:28:41 +0100 | [diff] [blame] | 7 | # Abstraction of 'run' goal with xt-run |
Mazen NEIFER | ffd4eb9 | 2017-01-27 10:28:41 +0100 | [diff] [blame] | 8 | ifneq (${QEMU_PTY},) |
Andrew Boie | a95d524 | 2017-02-06 10:35:35 -0800 | [diff] [blame] | 9 | # By default xt-sim uses pty, do nothing |
Mazen NEIFER | ffd4eb9 | 2017-01-27 10:28:41 +0100 | [diff] [blame] | 10 | endif |
| 11 | |
Andrew Boie | 495d922 | 2017-02-03 00:57:25 -0800 | [diff] [blame] | 12 | run: zephyr |
Andrew Boie | 11ee791 | 2017-04-11 15:10:00 -0700 | [diff] [blame] | 13 | @echo "**** Running simulation for Xtensa core \"${CONFIG_SOC}\" ****" |
Mazen NEIFER | ffd4eb9 | 2017-01-27 10:28:41 +0100 | [diff] [blame] | 14 | $(if ${QEMU_PIPE},,@echo "To exit from XT-RUN enter: 'CTRL+c'") |
Andrew Boie | 11ee791 | 2017-04-11 15:10:00 -0700 | [diff] [blame] | 15 | @echo '[XT-RUN] CPU: ${CONFIG_SOC}' |
Andrew Boie | 495d922 | 2017-02-03 00:57:25 -0800 | [diff] [blame] | 16 | # Run the emulator in the background and leave a PID file for |
| 17 | # sanitycheck |
Andrew Boie | a95d524 | 2017-02-06 10:35:35 -0800 | [diff] [blame] | 18 | ifneq ($(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 Nashif | 7708ff8 | 2017-05-11 08:38:54 -0400 | [diff] [blame] | 24 | ${Q} ${XTRUN} ${XTRUN_FLAGS} ${XTRUN_EXTRA_FLAGS} ${O}/${KERNEL_ELF_NAME} \ |
Andrew Boie | a95d524 | 2017-02-06 10:35:35 -0800 | [diff] [blame] | 25 | < ${QEMU_PIPE}.in > ${QEMU_PIPE}.out & echo $$! > qemu.pid |
Andrew Boie | 495d922 | 2017-02-03 00:57:25 -0800 | [diff] [blame] | 26 | # Wait until the emulator terminates (for any reason) |
| 27 | $(Q) cat qemu.pid | xargs $(srctree)/scripts/waitpid |
Andrew Boie | a95d524 | 2017-02-06 10:35:35 -0800 | [diff] [blame] | 28 | else |
Anas Nashif | 7708ff8 | 2017-05-11 08:38:54 -0400 | [diff] [blame] | 29 | ${Q} ${XTRUN} ${XTRUN_FLAGS} ${XTRUN_EXTRA_FLAGS} ${O}/${KERNEL_ELF_NAME} |
Andrew Boie | a95d524 | 2017-02-06 10:35:35 -0800 | [diff] [blame] | 30 | endif |
Mazen NEIFER | ffd4eb9 | 2017-01-27 10:28:41 +0100 | [diff] [blame] | 31 | |
Andrew Boie | 495d922 | 2017-02-03 00:57:25 -0800 | [diff] [blame] | 32 | .PHONY: run |