Skip to content

Commit 5d8a2ea

Browse files
FlyGoatkeith-packard
authored andcommitted
scripts: Wire up MIPS semihosting for tests
Signed-off-by: Jiaxun Yang <[email protected]>
1 parent f3c1303 commit 5d8a2ea

File tree

2 files changed

+49
-11
lines changed

2 files changed

+49
-11
lines changed

scripts/do-mips-zephyr-configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@
3333
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
3434
# OF THE POSSIBILITY OF SUCH DAMAGE.
3535
#
36-
exec "$(dirname "$0")"/do-configure mips-zephyr-elf -Dtests=true -Dtests-enable-posix-io=false "$@"
36+
exec "$(dirname "$0")"/do-configure mips-zephyr-elf -Dtests=true -Dposix-console=true "$@"

scripts/run-mips

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,24 +46,62 @@ if file "$elf" | grep -q LSB; then
4646
qemu="qemu-system-mipsel"
4747
fi
4848

49-
# Disable monitor
49+
cpu=24Kf
5050

51-
mon=none
51+
# Map stdio to a multiplexed character device so we can use it
52+
# for the monitor and semihosting output
5253

53-
# Point serial port at new chardev
54+
chardev=stdio,mux=on,id=stdio0
5455

55-
serial=stdio
56+
# Point the semihosting driver at our new chardev
5657

57-
cpu=24Kf
58+
cmdline="program-name"
59+
input=""
60+
done=0
61+
62+
while [ "$done" != "1" ]; do
63+
case "$1" in
64+
--)
65+
shift
66+
done=1
67+
;;
68+
-s|"")
69+
done=1
70+
;;
71+
*)
72+
cmdline="$cmdline $1"
73+
case "$input" in
74+
"")
75+
input="$1"
76+
;;
77+
*)
78+
input="$input $1"
79+
;;
80+
esac
81+
shift
82+
;;
83+
esac
84+
done
85+
86+
semi=enable=on,chardev=stdio0,arg="$cmdline"
87+
88+
# Point the monitor at the new chardev too
89+
90+
mon=none
91+
92+
# Disable the serial port
93+
94+
serial=none
5895

59-
"$dir"/monitor-e9 $qemu \
60-
-chardev stdio,id=con,mux=on \
96+
echo "$input" | $qemu \
97+
-chardev $chardev \
98+
-semihosting-config "$semi" \
6199
-machine malta \
62100
-cpu $cpu \
63101
-serial null \
64102
-serial null \
65-
-serial chardev:con \
66-
-mon chardev=con,mode=readline \
103+
-serial "$serial" \
104+
-monitor "$mon" \
67105
-net none \
68106
-nographic \
69-
-kernel "$elf" "$@" < /dev/null
107+
-kernel "$elf" "$@"

0 commit comments

Comments
 (0)