Skip to content

Conversation

@craigjb
Copy link
Contributor

@craigjb craigjb commented Sep 3, 2024

Change

This change adds TunneledJtagDtm in architecture::riscv::dtm::jtag_dtm that allows access to a RISC-V target through a JTAG tunnel with a configurable instruction and data register width. Additionally, this change adds attached_tunneled and attach_auto in RiscvInterfaceBuilder to allow Session to use a tunnel if configured on the Target.

The JTAG tunnel is configurable in YAML for a variant like this:

  # config for Xilinx BSCANE2
  jtag:
    riscv_tunnel:
      ir_id: 0x23
      ir_width: 6

I've tested it with a VexRiscv soft-core running on a Xilinx XC7A200T using a Digilent HS3 probe.

Background

It's common to use a JTAG tunnel to access RISC-V soft-cores running on FPGAs. A tunnel allows using the same cable for configuring the FPGA and debug access to the soft-core within. The simple protocol was originally created by SiFive, but is now used by many (including VexRiscv).

OpenOCD supports tunneled JTAG access to RISC-V with the riscv use_bscan_tunnel command (docs on this page).

A tunneled scan looks like this:

  1. Scan configured instruction (RiscvJtagTunnel::ir_id)
  2. Scan data register with:
    1. Select IR (0) or DR (1): 1 bit
    2. Width of tunneled scan: 7 bits
    3. Tunneled scan bits: width + 1 bits
    4. Set tunnel to idle: 3 zero bits

Copy link
Contributor

@bugadani bugadani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@bugadani bugadani added this pull request to the merge queue Sep 5, 2024
Merged via the queue into probe-rs:master with commit c110c2c Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants