Closed dhand-galois closed 4 years ago
This work has already started on the feature/debugbridge branch of firesim.
Currently, I am able to connect to the FireSim hosted CPU via OpenOCD & gdb to debug the running program, step through instructions, set breakpoints, load/dump memory and registers, and control execution. Everything seems to work.
I chose to expose the DMI interface directly to the host: a request channel (op, data, and add) and a response channel. On the host side, I am using a slightly modified version of the jtagvpi interface created for the GFE verilator simulator. It converts the DMI interface into a JTAG interface that OpenOCD can manipulate via a tcp socket.
@charlie-bluespec is it OK to include variants of sim_dmi.c
and sim_socket.c
from the GFE project in the firesim repo here? Should we add any attribution?
OpenOCD didn't require any additional changes beyond what was included for the GFE project.
Using this does require having the riscv toolchain available on the F1 instance. I am going to package that up and put it in our S3 bucket, but if this will be used in combination with FETT, we should probably also include it in the AMI CC @rtadros-Galois ?
Transfer rate is limited to 30KB/sec for unknown reasons, but that does not hamper interactive debugging at all. I am relying on FireSim to load the memory on boot and modified the bootrom so the core can detect when the debugger is activated - rather than jump to main memory, it'll enter a wfi
loop.
I don't think we have a plan to include GDB support to the running instances in production. But I don't mind including it in the AMI for developers to debug. When you're done with the GDB work, give me another nudge and we'll check if it is not already included in nix. I know that riscv{32,64}-unknown-elf-gdb
is already in the FETT Nix.
Resolved with #114
@rtadros-Galois having gdb already is great. Is the GFE version of openocd
also included? If so, we'd only need some way to make these two files available (here and here) to the TA1 teams while using FETT and add an option to pass +debug_enable
to FireSim-f1
to enable the debugger connection.
For more details on how it works in the standalone sims, see these instructions. The run_gdb.sh
script referenced there just runs riscv64-unknown-elf-gdb -x init.gdb <elf_file>
. And DEBUG_ENABLE=1
passes +debug_enable
to FireSim-f1
. So there isn't much setup required.
Opened DARPA-SSITH-Demonstrators/SSITH-FETT-Target#444
And yes, openocd is already included.
@dhand-galois's work was merged. I suggest that this issue should be closed as a consequence.
This issue will track progress on adding debugger support for the Chisel P1 and P2 processors running on FireSim.