Important | |
---|---|
The latest version of GDB for OpenRISC 1000 implements the GDB Remote Serial Protocol, which is the preferred mechanism for connecting to remote targets [2]. However the protocol described here is retained for backward compatibility. It is used here as a tutorial vehicle to illustrate how a custom debugging protocol can be used within GDB |
To facilitate remote debugging by GDB, the OpenRISC defines a software protocol describing JTAG accesses, suitable for transport over TCP/IP via a socket interface.
Note | |
---|---|
This protocol pre-dates the GDB Remote Serial Protocol (see Section 2.7). At some future date the OpenRISC 1000 Remote JTAG Protocol will be replaced by the RSP. |
The OpenRISC 1000 Remote JTAG Protocol is a simple message send/acknowledge protocol. The JTAG request is packaged as a 32 bit command, 32-bit length and series of 32-bit data words. The JTAG response is packaged as a 32-bit status and optionally a number of 32-bit data words. The commands available are:
OR1K_JTAG_COMMAND_READ
(1). Read a single
JTAG register. A 32-bit address is provided in the request. The
response includes 64-bits of read data.
OR1K_JTAG_COMMAND_WRITE
(2). Write a single
JTAG register. A 32-bit address is provided in the
request and 64-bit data to be written.
OR1K_JTAG_COMMAND_READ_BLOCK
(3). Read
multiple 32-bit JTAG registers. A 32-bit address of the first
register and number of registers to be read is provided in the
request. The response includes the number of registers read and
32-bits of data for each one read.
OR1K_JTAG_COMMAND_WRITE_BLOCK
(4). Write
multiple 32-bit JTAG registers. A 32-bit address of the first
register and number of registers to be written is provided in the
request followed by 32-bits of data to be written for each
register.
OR1K_JTAG_COMMAND_CHAIN
(5). Select the scan
chain. A 32-bit scan chain number is provided in the request.
Where the Mohor version of the JTAG interface is being used,
addresses for read/write accesses to the REGISTER
scan chain are ignored—there is only one control register.
Note | |
---|---|
There is apparently a contradiction in this protocol. Provision is made for individual registers to be read/written as 64 bits, whereas block read/writes (provided for communication efficiency) are only 32-bits. |
Figure 3.1 shows the structures of all five requests and their corresponding (successful) responses. Note that if a request fails, the response will only contain the status word.
The client side of this protocol (issuing the requests) is implemented by the GDB port for OpenRISC 1000.
Server side applications may implement this protocol to drive either physical hardware (via its JTAG port) or simulations, which include the JTAG functionality. Examples of the former include USB JTAG connectors, such as those produced by ORSoC™ AB. An example of the latter is the OpenRISC 1000 Architectural Simulator, Or1ksim (see Section 3.4).