aboutsummaryrefslogtreecommitdiffstats
path: root/elf.py
diff options
context:
space:
mode:
Diffstat (limited to 'elf.py')
-rwxr-xr-xelf.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/elf.py b/elf.py
index 0db1138..776dd91 100755
--- a/elf.py
+++ b/elf.py
@@ -6,7 +6,7 @@ import subv
Takes a packed & surveyed hex stream (with section headers) and packs it into a
simulatable ELF file that can be run as a kernel:
- qemu-system-riscv32 -nographic -machine sifive_u -nographic -kernel out.elf
+ qemu-system-riscv32 -nographic -machine sifive_u -bios none -kernel out.elf
sifive-u has lots of memory mapped peripherals, see
https://github.com/qemu/qemu/blob/master/hw/riscv/sifive_u.c#L66-L83
@@ -71,9 +71,9 @@ def write_program_header(segment, c, start):
flags = 5 if segment["name"] == "code" else 6
if offset % align != start % align:
- print("{:02x} {:02x}".format(offset, offset % align))
- print("{:02x} {:02x}".format(start, start % align))
- raise ValueError("improper alignment")
+ extra = "\n{:02x} {:02x}".format(offset, offset % align)
+ extra += "\n{:02x} {:02x}".format(start, start % align)
+ raise ValueError("improper alignment:" + extra)
c += wi(0x1, 4) # p_type
c += wi(offset, 4) # p_offset