8 RISC-V Debug Support Version 0.14.0-DRAFT
instead of the “RISC-V Debug Specification 0.14.0-DRAFT”.
A single DM can debug up to 2
20
harts.
3.1 Debug Module Interface (DMI)
Debug Modules are slaves to a bus called the Debug Module Interface (DMI). The master of the
bus is the Debug Transport Module(s). The Debug Module Interface can be a trivial bus with
one master and one slave (see A.3), or use a more full-featured bus like TileLink or the AMBA
Advanced Peripheral Bus. The details are left to the system designer.
The DMI uses between 7 and 32 address bits. It supports read and write operations. The bottom
of the address space is used for the first (and usually only) DM. Extra space can be used for custom
debug devices, other cores, additional DMs, etc. If there are additional DMs on this DMI, the base
address of the next DM in the DMI address space is given in nextdm.
The Debug Module is controlled via register accesses to its DMI address space.
3.2 Reset Control
There are two methods that allow a debugger to reset harts. ndmreset resets all the harts in the
system, as well as all other parts of the system except for the Debug Modules, Debug Transport
Modules, and Debug Module Interface. Exactly what is affected by this reset is implementation
dependent, but it must be possible to debug programs from the first instruction executed. hartreset
resets all the currently selected harts. In this case an implementation may reset more harts than
just the ones that are selected. The debugger can discover which other harts are reset (if any) by
selecting them and checking anyhavereset and allhavereset.
To perform either of these resets, the debugger first asserts the bit, and then clears it. The actual
reset may start as soon as the bit is asserted, but may start an arbitrarily long time after the bit
is deasserted. The reset itself may also take an arbitrarily long time. While the reset is on-going,
harts are either in the running state, indicating it’s possible to perform some abstract commands
during this time, or in the unavailable state, indicating it’s not possible to perform any abstract
commands during this time. Once a hart’s reset is complete, havereset becomes set. When a hart
comes out of reset and haltreq or resethaltreq are set, the hart will immediately enter Debug Mode
(halted state). Otherwise, if the hart was initially running it will execute normally (running state)
and if the hart was initially halted it should now be running but may be halted.
There is no general, reliable way for the debugger to know when reset has actually begun.
The Debug Module’s own state and registers should only be reset at power-up and while dmactive
in dmcontrol is 0. If there is another mechanism to reset the DM, this mechanism must also reset
all the harts accessible to the DM.
Due to clock and power domain crossing issues, it might not be possible to perform arbitrary DMI