The complete project should include:
- Arduino sketch
- OpenOCD integration
- Python API
- Arduino shield with common connectors etc.
In particular the shield should have:
- Level shifters between the 5V of Arduino and the voltage of the target chip
- Some standard connectors (at least the 20 pin and the 10 pin)
- Power supply and ground lines
- Some jumpers for configuration (for example to bypass level shifters or to choose connector)
If the target chip that I want to debug works at 5V like the Arduino then the shield could actually be optional, but some wires must be used in place of the JTAG connectors.
I have started a project on GitHub called JTAGduino, that up to now contains the Arduino sketch and a Python API to access basic functionality. It should already be possible to use it to send some JTAG sequences to a 5V target chip.
I decided that inside the Arduino I should keep just some basic code to manage and drive the pins, and let the host PC do the “JTAG” logic of knowing the TAP state and fill Instruction Register and Data Register. By looking at OpenOCD source code it seems like it’s a common design choice.
The default mapping of Arduino pins to JTAG pins is that pins 2, 3, 4, 5 and 6 are used for TCK, TMS, TDI, TDO and TRST. The default speed is the maximum one, with TCK moving at 1MHz.
The next step would be to fork the OpenOCD repository and add the “JTAGduino” driver.