GDB and OpenOCD and DAP
I'm currently trying to get an overview of how GDB is able to remotely debug an Arm microcontroller.
From what I understand the following sequence takes place:
GDB client -> OpenOCD server -> JTAG converter -> Debug access port -> Coresight Debug Components (e.g. Breakpoint unit)
The Coresight TRM provides a good overview of how registers are exposed through the DAP - http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0314h/Cihbhhde.html
If a DAPLink is used as the JTAG/SW converter, it provides the CMSIS-DAP commands, a standard interface for accessing the DAP. I can see how this can be used to read the registers of coresight debug components.
I am unsure of how GDB and OpenOCD fit together. Does GDB receive the ROM table and send its commands to OpenOCD, such as set breakpoint? Or does GDB just have general knowledge of the Arm architecture, and OpenOCD deals with the low level details of accessing of debug registers?
Thanks
Posted Feb 11, 2019, 10:32 PM UTC
Correct. The GDB remote serial protocol -- which is what GDB uses to communicate with OpenOCD -- operates at a relatively high level. Implementing those commands in terms of DAP operations is the job of OpenOCD.