Jonathan Neuschäfer (j.neuschaefer@gmx.net) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14964
-gerrit
commit 55486e1fe0de53378ce4927e1b14550b45bc0b54 Author: Jonathan Neuschäfer j.neuschaefer@gmx.net Date: Wed May 25 07:42:37 2016 +0200
util/riscvtools: Add script that turns coreboot.rom into an ELF
This is required because the current version of SPIKE doesn't support loading flat files yet.
Change-Id: If745d78712ca8108b5dcc21591201bc2d3f70b86 Signed-off-by: Jonathan Neuschäfer j.neuschaefer@gmx.net --- util/riscvtools/make-spike-elf.sh | 27 +++++++++++++++++++++++++++ util/riscvtools/spike-elf.ld | 11 +++++++++++ 2 files changed, 38 insertions(+)
diff --git a/util/riscvtools/make-spike-elf.sh b/util/riscvtools/make-spike-elf.sh new file mode 100755 index 0000000..4241c54 --- /dev/null +++ b/util/riscvtools/make-spike-elf.sh @@ -0,0 +1,27 @@ +#!/bin/sh +# +# This script is based on: +# https://docs.google.com/document/d/1Pvf9Yxorcd3sbgs8WcomcTl3J4bmX6e1UE0ROCef... + +set -e + +usage() { + echo "This script converts a flat file into an ELF, that can be passed" + echo "to SPIKE, the RISC-V reference emulator." + echo "" + echo "Usage: $0 coreboot.rom coreboot.elf" +} + +if [ $# -ne 2 ]; then + usage + exit 1 +fi + +FLAT_FILE="$1" +OBJECT_FILE=$(mktemp /tmp/coreboot-spike.XXXXXX.o) +ELF_FILE="$2" +TOOL_PATH="$(dirname "$0")" + +objcopy -I binary -O elf32-i386 --binary-architecture i386 "$FLAT_FILE" "$OBJECT_FILE" +ld -m elf_i386 "$OBJECT_FILE" -T "$TOOL_PATH/spike-elf.ld" -o "$ELF_FILE" +rm "$OBJECT_FILE" diff --git a/util/riscvtools/spike-elf.ld b/util/riscvtools/spike-elf.ld new file mode 100644 index 0000000..c103136 --- /dev/null +++ b/util/riscvtools/spike-elf.ld @@ -0,0 +1,11 @@ +/* See make-spike-elf.sh */ + +ENTRY(_start); +SECTIONS +{ + _start = 0x0000; + . = 0x0000; + .data : { + *(.data) + } +}