aboutsummaryrefslogtreecommitdiff
path: root/scripts/gen-rv64-fw
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2025-08-10 21:37:15 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2025-08-10 21:37:15 +0300
commit82c77b22605d691884be4c4e1e6bae8d66598d02 (patch)
tree040a9e97c12abc14b2ecda6bd16662b6908c083e /scripts/gen-rv64-fw
parent489beadf61d05f40dd4ac40e4e5290502f7ad078 (diff)
downloadgran-82c77b22605d691884be4c4e1e6bae8d66598d02.tar.gz
gran-82c77b22605d691884be4c4e1e6bae8d66598d02.zip
make tests actually useful
+ Apparently quite a few components are currently broken, didn't even remember
Diffstat (limited to 'scripts/gen-rv64-fw')
-rwxr-xr-xscripts/gen-rv64-fw23
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/gen-rv64-fw b/scripts/gen-rv64-fw
new file mode 100755
index 0000000..831071d
--- /dev/null
+++ b/scripts/gen-rv64-fw
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+BUILD=build
+NAME=
+
+while getopts "d:o:" opt; do
+ case "$opt" in
+ d) BUILD="$OPTARG";;
+ o) NAME="$OPTARG";;
+ *) echo "unrecognised option -$OPTARG" >&2; exit 1;
+ esac
+done
+
+shift $((OPTIND - 1))
+
+# might try to figure out how to support llvm as well in tests, but good enough
+# for now
+riscv64-unknown-elf-gcc -O2 -Wall -Wextra -ffreestanding -nostdlib \
+ -march=rv64i -mabi=lp64 -fno-delete-null-pointer-checks \
+ -o "${BUILD}/${NAME}.elf" "${@}"
+
+riscv64-unknown-elf-objcopy -Obinary "${BUILD}/${NAME}.elf" "${BUILD}/${NAME}.bin"
+xxd -i "${BUILD}/${NAME}.bin" > "${BUILD}/${NAME}"