此文对RISC-V Debug协议做一个简单的介绍,具体的内容,大家可以查看协议本身内容。
https://github.com/riscv/riscv-debug-spec/blob/master/riscv-debug-stable.pdf
介绍是按目录结构进行的。
1 Introduction
- All hart registers (including CSRs) can be read/written.
- Memory can be accessed either from the hart’s point of view, through the system bus directly, or both.
- RV32, RV64, and future RV128 are all supported.
- Any hart in the hardware platform can be independently debugged.
- A debugger can discover almost everything it needs to know itself, without user configuration.
- Each hart can be debugged from the very first instruction executed.
- A RISC-V hart can be halted when a software breakpoint instruction is executed.
- Hardware single-step can execute one instruction at a time.
- Debug functionality is independent of the debug transport used.
- The debugger does not need to know anything about the microarchitecture of the harts it is debugging.
- Arbitrary subsets of harts can be halted and resumed simultaneously. (Optional)
- Arbitrary instructions can be executed on a halted hart. That means no new debug functionality is needed when a core has additional or custom instructions or state, as long as there exist programs that can move that state into GPRs. (Optional)
- Registers can be accessed without halting. (Optional)
- A running hart can be directed to execute a short sequence of instructions, with little overhead. (Optional)
- A system bus master allows memory access without involving any hart. (Optional)
- A RISC-V hart can be halted when a trigger matches the PC, read/write address/data, or an instruction opcode. (Optional)
- Harts can be grouped, and harts in the same group will all halt when any of them halts. These groups can also react to or notify external triggers. (Optional)
RISC-V Debug协议主要支持的特性就上面17点,有些是必须实现的,有些事可选的。
2 System Overview
系统总体框架:

重要的内容有:
- The user interacts with the Debug Host (e.g. laptop), which is running a debugger (e.g. gdb). (软件层面)
- The debugger communicates with a Debug Translator (e.g. OpenOCD, which may include a hardware driver) to communicate with Debug Transport Hardware (e.g. Olimex USB-JTAG adapter). (OpenOCD为软件,Olimex USB-JTAG adapter为硬件驱动)
- The Debug Transport Hardware connects the Debug Host to the Platform’s Debug Transport Module (DTM). (硬件底层接收模块,例如JTAG信号的接收和处理)
- The DTM provides access to one or more Debug Modules (DMs) using the Debug Module Interface (DMI). (接口,例如JTAG2TileLink,JTAG2AHB,一边是DTM的硬件接口,接收host的信号,一边是驱动DM模块的总线接口,驱动DM模块的总线接口由系统自行决定,可以是ABH、AXI4、TileLink或者其他简单的接口)

本文详细介绍了RISC-V的调试协议,包括必须实现的特性如读写寄存器、硬件断点、单步执行等,以及可选功能如组别调试、外部触发响应等。调试流程涉及Debug Host、Debug Translator、Debug Transport Hardware和Debug Module,通过抽象命令进行内存访问和寄存器操作。同时,文章提到了Program Buffer用于执行任意指令,以及System Bus Access以绕过CPU直接访问内存。此外,文章还概述了不同调试模式和状态,以及Debug Module Registers的相关信息。
最低0.47元/天 解锁文章
9651

被折叠的 条评论
为什么被折叠?



