3 # This script is based on:
4 # https://docs.google.com/document/d/1Pvf9Yxorcd3sbgs8WcomcTl3J4bmX6e1UE0ROCefR88
9 echo "This script converts a flat file into an ELF, that can be passed"
10 echo "to SPIKE, the RISC-V reference emulator."
12 echo "Usage: $0 coreboot.rom coreboot.elf"
21 OBJECT_FILE
=$
(mktemp
/tmp
/coreboot-spike.XXXXXX
)
23 TOOL_PATH
="$(dirname "$0")"
24 XGCC_BIN
="$TOOL_PATH/../crossgcc/xgcc/bin"
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" \