riscv back

This commit is contained in:
Yaossg 2024-12-24 21:31:12 +08:00
parent 92f4b4f561
commit 2b9ed2e2a4
4 changed files with 58 additions and 13 deletions

17
run.sh
View file

@ -1,6 +1,17 @@
if [ $(uname -m) != "riscv64" ]; then
function compile_and_run() {
riscv64-linux-gnu-gcc-12 -static $1.s -o $1.elf
qemu-riscv64 $1.elf
}
else
function compile_and_run() {
gcc $1.s -o $1.elf
./$1.elf
}
fi
gcc boot.c -o boot.elf &&
./boot.elf < $1 > $1.s &&
riscv64-linux-gnu-gcc-12 -static $1.s -o $1.elf &&
qemu-riscv64 $1.elf
compile_and_run $1
echo $?
rm $1.s $1.elf boot.elf 2> /dev/null
rm $1.s $1.s.elf boot.elf 2> /dev/null