MicroBlaze V features a debug interface to support software debugging tools (commonly known as background debug mode (BDM) debuggers) such as the AMD Vitis™ System Debugger tool.
The debug interface is designed to be connected to the MicroBlaze Debug Module (MDM) V core, which interfaces with the JTAG port of AMD Adaptive Computing FPGAs or with a memory-mapped AXI4-Lite interface.
The debug functionality is implemented according to the definition in RISC-V External Debug Support, Version 1.0, and is compatible with any third-party tools following this standard.
Multiple MicroBlaze V processors can be interfaced with a single MDM V core to enable multiprocessor debugging. Each processor represents a single RISC-V hardware thread (hart).
To download programs, set software breakpoints and disassemble code, ensure that the instruction and data memory ranges overlap, and use the same physical memory.
Debug registers are accessed using the debug interface, and are not
directly visible to software running on the processor. The debug interface can either
use JTAG serial access or AXI4-Lite parallel access,
controlled by the parameter C_DEBUG_INTERFACE.
See the MicroBlaze Debug Module V (MDM V) LogiCORE IP Product Guide (PG428) for a detailed description of the MDM V features.
The debugging features enabled by setting C_DEBUG_ENABLED to 1 include:
- A configurable number of hardware triggers and unlimited software breakpoints
- External control that enables debug tools to stop, reset, and single step the processor
- Ability to read from and write to: memory, general purpose registers, floating-point registers, and control and status registers
- Support for multiple processors (RISC-V harts)
- Configurable number of hardware performance counters (event and latency counters)
- RISC-V N-Trace based program trace with configurable embedded trace buffer size
- RISC-V N-Trace based external trace with Trace Funnel and Trace PIB sink provided by the MDM V
- Non-intrusive profiling support with configurable profiling buffer size
- Cross trigger support between multiple processors (RISC-V harts), and external trigger inputs and outputs provided by the MDM V, using the RISC-V Halt Groups, Resume Groups, and External Triggers functionality.
When the debugger attempts to stop the processor with a halt request and the processor is waiting for an ongoing LMB, AXI4, or AXI4-Stream access to complete, the access is forced to complete after 8192 clock cycles. This ensures that the debugger can always stop the processor. Read accesses update the destination register with the current interface data value in this case.
Trace and Profiling Register Access
Both program trace and non-intrusive profiling registers are memory-mapped, and can be accessed through either of two interfaces:
- The Debug Interface with access from MDM V, using the RISC-V
System Bus.
In this case, MDM V determines the System Bus base address for each connected processor, with the first processor starting at 0x8000, the second at 0x10000, and so on, giving each processor a 32 KB area. With external trace, the MDM V uses the first 32 KB area for the Trace Funnel and Trace PIB Sink registers.
- The Slave AXI Interface (S_AXI) with access from any AXI4 Master, but normally from the MDM V AXI4 master port, using the RISC-V System
Bus.
In this case, the base address is assigned in the AMD Vivado™ Block Design, typically to 0x44A00000 with automatic address assignment. It is recommended to set the base addresses for subsequent processors in a multiprocessor design to 0x44A08000, and so on, to give each processor a 32 KB area.
To use the Debug Interface, the Slave AXI Interface cannot be enabled, and the Embedded Trace Interface must be selected in the MDM V.
It is recommended to use the Debug Interface, which requires no additional connections between the MDM V and the processor, unless the MDM V AXI4 master port is used for memory access.
Secure Debug
Secure debug provides functionality to configure Physical Memory
Protection entries where debugging is inhibited. Each bit in the parameter C_PMP_DEBUG_INHIBIT defines if a particular entry
inhibits debugging. The input signal Dbg_Inhibit
must also be set to activate secure debug.
When inhibit is activated for an address region, the following occurs:
- Halt is delayed until the instruction to be executed is outside the region. At this time, a normal halt occurs.
- An EBREAK instruction executed within the region has no effect when the ebreakm, ebreaks, or ebreaku bit corresponding to the current privilege mode is set in dcsr to enter debug mode.
- An address match trigger within the region is ignored.
- The Instructions-retired counter does not increment within the region.
- Hardware Performance Monitor counters do not increment within the region, except when configured with event class 2, 3 or 5.
- Executing a load or store instruction in debug mode using an address within the region using an abstract command results in a bus error (3) without performing the access.