Skip to content

Commit d56658b

Browse files
committed
util: fpga runner: use new bootstrap-elf command
Signed-off-by: Alice Ziuziakowska <a.ziuziakowska@lowrisc.org>
1 parent ae6e168 commit d56658b

1 file changed

Lines changed: 2 additions & 24 deletions

File tree

util/fpga_runner.py

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
import serial
1313
import serial.tools.list_ports
14-
from elftools.elf.elffile import ELFFile
1514

1615
FTDI_PID: int = 0x6010
1716
BAUD_RATE: int = 1_000_000
@@ -71,39 +70,18 @@ async def bootstrap(uart: serial.Serial | None) -> None:
7170
await set_pin(0, True)
7271

7372

74-
def get_load_addr(elf: Path) -> int:
75-
try:
76-
with elf.open("rb") as f:
77-
elf = ELFFile(f)
78-
load_addrs = [
79-
seg["p_paddr"] for seg in elf.iter_segments() if seg["p_type"] == "PT_LOAD"
80-
]
81-
if not load_addrs:
82-
print(f"[{RUNNER}] no PT_LOAD segments found in ELF file {elf}")
83-
sys.exit(1)
84-
return min(load_addrs)
85-
except OSError as e:
86-
print(f"[{RUNNER}] error opening ELF file {elf}: {e}")
87-
sys.exit(1)
88-
89-
9073
async def load_fpga_binary(path: Path, uart: serial.Serial | None) -> None:
91-
load_address = get_load_addr(path)
92-
9374
await bootstrap(uart)
9475

9576
command = [
9677
"ftditool",
9778
"--pid",
9879
hex(FTDI_PID),
99-
"bootstrap",
100-
"--addr",
101-
hex(load_address),
102-
"--skip-erase",
80+
"bootstrap-elf",
81+
str(path),
10382
"--ftdi",
10483
FTDI_DEVICE_DESC,
10584
]
106-
command.append(str(path.with_suffix(".bin")))
10785

10886
p = await asyncio.create_subprocess_exec(*command)
10987
if await p.wait() != 0:

0 commit comments

Comments
 (0)