Ports/riscv64/OpenOCD

OpenOCD (docs) is a tool for debugging, in-system programming and boundary-scan testing for embedded target devices. It is particularly useful for low-level debugging of bootloaders, Linux kernel, etc. with (GDB)

Here are the steps to setup debugging HiFive Unleashed with OpenOCD.


 * 1) Connect HiFive Unleashed and PC with USB and power it on. This interface provides UART0 (/dev/ttyUSB1) and JTAG interfaces by FTDI FT2232H (link).
 * 2) Run (see simple config below and do not forget to add user to the plugdev group):  OpenOCD will listen port 3333 for GDB connection.
 * 3) Run GDB compiled with riscv64 target support.
 * 4) Attach GDB to the OpenOCD:
 * 5) Now one could set breakpoints, investigate memory, disassemble memory regions, etc. It is possible to load an ELF file with debug information to import symbols and place breakpoints to symbols.

Example of the simple hifive-u.cfg: