#!/bin/sh

qemu=qemu-system-riscv32

# select the program
elf=hello-world-riscv.elf

# Set the target machine
machine=spike
cpu=sifive-e31

# Map stdio to a multiplexed character device so we can use it
# for the monitor and semihosting output

chardev=stdio,mux=on,id=stdio0

# Point the semihosting driver at our new chardev

semi=enable=on,chardev=stdio0,arg="test-file"

# Point the monitor at the new chardev too

mon=chardev=stdio0,mode=readline

# Disable the serial port

serial=chardev:stdio0

$qemu -chardev $chardev -semihosting-config $semi -mon $mon -serial $serial -machine $machine -cpu $cpu -kernel $elf -nographic "$@"
