Debian Codegraph @

util/riscv/make-spike-elf.sh

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. sh
2 #
3 # This script is based on:
4 # https://docs.google.com/document/d/1Pvf9Yxorcd3sbgs8WcomcTl3J4bmX6e1UE0ROCefR88
5
6 set -e
7
8 usagescip-shell shell coreboot 25.09+dfsg-1 usage().() {
9 echoscip-shell system . . echo. "This script converts a flat file into an ELF, that can be passed"
10 echoscip-shell system . . echo. "to SPIKE, the RISC-V reference emulator."
11 echoscip-shell system . . echo. ""
12 echoscip-shell system . . echo. "Usage: $0 coreboot.rom coreboot.elf"
13 }
14
15 if [scip-shell system . . `[`. $# -ne 2 ]; then
16 usagescip-shell shell coreboot 25.09+dfsg-1 usage().
17 exit 1
18 fi
19
20 FLAT_FILE="$1"
21 OBJECT_FILE=$(mktempscip-shell system . . mktemp. /tmp/coreboot-spike.XXXXXXscip-shell filesystem . . `/tmp/coreboot-spike.XXXXXX`.)
22 ELF_FILE="$2"
23 TOOL_PATH="$(dirnamescip-shell system . . dirname. "$0")"
24 XGCC_BIN="$TOOL_PATH/../crossgcc/xgcc/bin"
25
26 "$XGCC_BIN/riscv64-elf-objcopy" -I binary -O elf64-littleriscv \
27 -B riscv "$FLAT_FILE" "$OBJECT_FILE"
28 "$XGCC_BIN/riscv64-elf-ld" "$OBJECT_FILE" -T "$TOOL_PATH/spike-elf.ld" \
29 -o "$ELF_FILE"
30 rmscip-shell system . . rm. "$OBJECT_FILE"