aboutsummaryrefslogtreecommitdiffstats
path: root/elf.py
diff options
context:
space:
mode:
authors-ol <s+removethis@s-ol.nu>2021-07-06 10:03:57 +0000
committers-ol <s+removethis@s-ol.nu>2021-07-06 10:04:36 +0000
commit912b5df8aef99aa00848d2a87bb5e5cebc7ff6b2 (patch)
tree3c62b2a7db782bd6c142a2fdb37d232f31f16eb1 /elf.py
parentupdate ex.subv to work with new pipeline (diff)
downloadsubv-912b5df8aef99aa00848d2a87bb5e5cebc7ff6b2.tar.gz
subv-912b5df8aef99aa00848d2a87bb5e5cebc7ff6b2.zip
fix and finish new pipeline
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