Skip to content

Commit 4380fe1

Browse files
midnightveilIvan-Velickovic
authored andcommitted
Add Cheshire (+bitstream FPGA image support) to MQ
Signed-off-by: julia <git.ts@trainwit.ch>
1 parent b89b95e commit 4380fe1

5 files changed

Lines changed: 119 additions & 11 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ Options:
9595
single image file; x86 currently expects two, the kernel and the root task.
9696
- `-w` _TIME_ Number of seconds to wait between each attempt to acquire the lock (default 8)
9797
- `-t` _RETRIES_ Number of retries to perform for acquiring the lock (default -1)
98+
- `--bitstream` _FILE_ Optional bitstream file to load to the FPGA.
9899

99100

100101
`mq sem dumpall|-signal|-wait|-cancel|-info `_<system>_` [-f] [-w `_retry-time_` ] [-t `_retry-count_` ] [-k `_LOCK_\__KEY_` ] [-T` _timeout_`]`

scripts/enqueue

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ EnqueueUsage() {
4242
echo " -s TEXT Specifies which machine this job is for"
4343
echo " -f FILE [+] Files to use as the job image"
4444
echo " -w TIME Number of seconds to wait between each attempt to acquire the lock (default 8)"
45-
echo " -t RETRIES Number of retries to preform for acquiring the lock (default -1)"
45+
echo " --bitstream FILE Optional bitstream to load to the FPGA"
4646
echo
4747
}
4848

@@ -78,6 +78,15 @@ Enqueue() {
7878
# that it is a dtb later
7979
dtbflag="-b $1"
8080
;;
81+
--bitstream)
82+
shift
83+
if ! [ -f "$1" ]; then
84+
echo "bitstream file \"$1\" either does not exist, or is not considered a valid file"
85+
exit -1
86+
fi
87+
88+
bitstreamflag="--bitstream $1"
89+
;;
8190
-l)
8291
shift
8392
logfile="$1"
@@ -245,7 +254,8 @@ Enqueue() {
245254
# parameters '-b' and 'my.dtb'
246255
# 'linux' is deliberately not in quotes so it will not create an empty
247256
# parameter if the flag is not set
248-
SystemRunImage "${system}" "${completion}" "${completion_timeout}" "${errortxt}" "${logfile}" "${keep_alive}" ${linux} ${dtbflag} $files
257+
# Ditto for 'bitstreamflag'
258+
SystemRunImage "${system}" "${completion}" "${completion_timeout}" "${errortxt}" "${logfile}" "${keep_alive}" ${linux} ${dtbflag} ${bitstreamflag} $files
249259
ret=$?
250260
fi
251261

scripts/runner

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,17 @@ RebootConsoleRunTwoFiles() {
7777
return 1
7878
fi
7979
fi
80+
if [ ! -z "${bitstream}" ]; then
81+
bitstreamfile=$(RemoteCommandOn ${HOST} "mktemp")
82+
bitstreamflag="--bitstream $bitstreamfile"
83+
if ! scp "${bitstream}" "${HOST}:${bitstreamfile}"; then
84+
echo "Failed to copy bitstream file"
85+
RemoteCommandOn ${HOST} rm -f "${kernelfile}" "${rootserverfile}" "${logfile}" "${dtbfile}" "${bitstreamfile}"
86+
return 1
87+
fi
88+
fi
8089

81-
ssh -tt -oLogLevel=quiet ${HOST} "stty isig -echoctl -echo; /tftpboot/${machine}/reboot $linux $dtbflag -l '${logfile}' -c '${completion}' -t '${completion_timeout}' -e '${errortxt}' -k '${kernelfile}' -u '${rootserverfile}' ${ka_flag}"
90+
ssh -tt -oLogLevel=quiet ${HOST} "stty isig -echoctl -echo; /tftpboot/${machine}/reboot $linux $dtbflag $bitstreamflag -l '${logfile}' -c '${completion}' -t '${completion_timeout}' -e '${errortxt}' -k '${kernelfile}' -u '${rootserverfile}' ${ka_flag}"
8291
ret=$?
8392
if [ "${output}" != "" ]; then
8493
scp "${HOST}:${logfile}" "${output}"
@@ -87,12 +96,15 @@ RebootConsoleRunTwoFiles() {
8796
if [ ! -z "${dtb}" ]; then
8897
RemoteCommandOn ${HOST} rm -f "${dtbfile}"
8998
fi
99+
if [ ! -z "${bitstream}" ]; then
100+
RemoteCommandOn ${HOST} rm -f "${bitstreamfile}"
101+
fi
90102
return $ret
91103
fi
92104
if [ "${output}" = "" ]; then
93-
"/tftpboot/${machine}/reboot" $linux $dtbflag -t "${completion_timeout}" -c "${completion}" -e "${errortxt}" -k "${kernel}" -u "${rootserver}" ${ka_flag}
105+
"/tftpboot/${machine}/reboot" $linux $dtbflag $bitstreamflag -t "${completion_timeout}" -c "${completion}" -e "${errortxt}" -k "${kernel}" -u "${rootserver}" ${ka_flag}
94106
else
95-
"/tftpboot/${machine}/reboot" $linux $dtbflag -t "${completion_timeout}" -c "${completion}" -e "${errortxt}" -l "${output}" -k "${kernel}" -u "${rootserver}" ${ka_flag}
107+
"/tftpboot/${machine}/reboot" $linux $dtbflag $bitstreamflag -t "${completion_timeout}" -c "${completion}" -e "${errortxt}" -l "${output}" -k "${kernel}" -u "${rootserver}" ${ka_flag}
96108
fi
97109
}
98110

@@ -106,6 +118,11 @@ RebootConsoleRunOneFile() {
106118
dtb="$1"
107119
shift
108120
}
121+
[ "$1" = '--bitstream' ] && {
122+
shift
123+
bitstream="$1"
124+
shift
125+
}
109126
completion=$1
110127
completion_timeout=$2
111128
errortxt=$3
@@ -134,13 +151,21 @@ RebootConsoleRunOneFile() {
134151
if [ ! -z "${dtb}" ]; then
135152
dtbfile=$(RemoteCommandOn ${HOST} "mktemp")
136153
dtbflag="-b $dtbfile"
137-
if ! scp "${dtb}" "${HOST}:${kernelfile}"; then
154+
if ! scp "${dtb}" "${HOST}:${dtbfile}"; then
138155
echo "Failed to copy dtb file"
139156
RemoteCommandOn ${HOST} rm -f "${dtbfile}" "${kernelfile}" "${logfile}"
140157
fi
141158
fi
159+
if [ ! -z "${bitstream}" ]; then
160+
bitstreamfile=$(RemoteCommandOn ${HOST} "mktemp")
161+
bitstreamflag="--bitstream $bitstreamfile"
162+
if ! scp "${bitstream}" "${HOST}:${bitstreamfile}"; then
163+
echo "Failed to copy bitstream file"
164+
RemoteCommandOn ${HOST} rm -f "${bitstreamfile} ${dtbfile}" "${kernelfile}" "${logfile}"
165+
fi
166+
fi
142167

143-
ssh -tt -oLogLevel=quiet ${HOST} "stty isig -echoctl -echo; /tftpboot/${machine}/reboot $linux $dtbflag -l '${logfile}' -c '${completion}' -t '${completion_timeout}' -e '${errortxt}' -k '${kernelfile}' ${ka_flag}"
168+
ssh -tt -oLogLevel=quiet ${HOST} "stty isig -echoctl -echo; /tftpboot/${machine}/reboot $linux $dtbflag $bitstreamflag -l '${logfile}' -c '${completion}' -t '${completion_timeout}' -e '${errortxt}' -k '${kernelfile}' ${ka_flag}"
144169
ret=$?
145170
if [ "${output}" != "" ]; then
146171
scp "${HOST}:${logfile}" "${output}"
@@ -149,11 +174,14 @@ RebootConsoleRunOneFile() {
149174
if [ ! -z "${dtb}" ]; then
150175
RemoteCommandOn ${HOST} rm -f "${dtbfile}"
151176
fi
177+
if [ ! -z "${bitstream}" ]; then
178+
RemoteCommandOn ${HOST} rm -f "${bitstreamfile}"
179+
fi
152180
return $ret
153181
fi
154182
if [ "${output}" = "" ]; then
155-
"/tftpboot/${machine}/reboot" $linux $dtbflag -t "${completion_timeout}" -c "${completion}" -e "${errortxt}" -k "${kernel}" ${ka_flag}
183+
"/tftpboot/${machine}/reboot" $linux $dtbflag $bitstreamflag -t "${completion_timeout}" -c "${completion}" -e "${errortxt}" -k "${kernel}" ${ka_flag}
156184
else
157-
"/tftpboot/${machine}/reboot" $linux $dtbflag -t "${completion_timeout}" -c "${completion}" -e "${errortxt}" -l "${output}" -k "${kernel}" ${ka_flag}
185+
"/tftpboot/${machine}/reboot" $linux $dtbflag $bitstreamflag -t "${completion_timeout}" -c "${completion}" -e "${errortxt}" -l "${output}" -k "${kernel}" ${ka_flag}
158186
fi
159187
}

scripts/system

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,19 @@ SystemRunImage() {
140140
shift 2
141141
kernel="$7"
142142
}
143+
144+
[ $kernel = "--bitstream" ] && {
145+
bitstreamflag="$7 $8"
146+
shift 2
147+
kernel="$7"
148+
}
149+
143150
system_name="$("SystemName_${system}")"
144151

145152
if [ "$("SystemNumFiles_${system}" $linux)" -eq 2 ]; then
146153
rootserver="$8"
147-
RebootConsoleRunTwoFiles $linux $dtbflag "${completion}" "${completion_timeout}" "${errortxt}" "${logfile}" "${keep_alive}" "${kernel}" "${rootserver}" "${system_name}"
154+
RebootConsoleRunTwoFiles $linux $dtbflag $bitstreamflag "${completion}" "${completion_timeout}" "${errortxt}" "${logfile}" "${keep_alive}" "${kernel}" "${rootserver}" "${system_name}"
148155
else
149-
RebootConsoleRunOneFile $linux $dtbflag "${completion}" "${completion_timeout}" "${errortxt}" "${logfile}" "${keep_alive}" "${kernel}" "${system_name}"
156+
RebootConsoleRunOneFile $linux $dtbflag $bitstreamflag "${completion}" "${completion_timeout}" "${errortxt}" "${logfile}" "${keep_alive}" "${kernel}" "${system_name}"
150157
fi
151158
}

scripts/systems/cheshire1

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/sh
2+
#
3+
# Copyright 2025 UNSW, Sydney
4+
#
5+
# SPDX-License-Identifier: GPL-2.0-only
6+
7+
if [ "${SCRIPT_PATH}" = "" ]; then
8+
echo "This script should not be called directly! Please use mq.sh"
9+
exit -1
10+
fi
11+
12+
SystemNumFiles_cheshire1() {
13+
echo 1
14+
}
15+
16+
SystemName_cheshire1() {
17+
echo "cheshire1"
18+
}
19+
20+
SystemPowerOff_cheshire1() {
21+
RebootShutdown cheshire1
22+
}
23+
24+
Arch_cheshire1() {
25+
echo "riscv"
26+
}
27+
28+
ISA_cheshire1() {
29+
echo "rv64imafdcsuh"
30+
}
31+
32+
SOC_cheshire1() {
33+
echo "PULP Platform Cheshire"
34+
}
35+
36+
CPU_cheshire1() {
37+
echo "CVA6"
38+
}
39+
40+
Cores_cheshire1() {
41+
echo "1"
42+
}
43+
44+
RAM_cheshire1() {
45+
echo "1GB"
46+
}
47+
48+
MaxCLK_cheshire1() {
49+
echo "50MHz"
50+
}
51+
52+
Sel4Plat_cheshire1() {
53+
echo "cheshire"
54+
}
55+
56+
PXELinux_cheshire1() {
57+
echo "no"
58+
}
59+
60+
DTB_cheshire1() {
61+
echo "no"
62+
}

0 commit comments

Comments
 (0)