On 24 February 2016 at 17:38, Phillip Pearson <p...@myelin.nz> wrote: > Weird coincidence... I was just looking at implementing JTAG support in the > OpenOCD CMSIS-DAP driver last night. You want to look at the code in > interface/Common/src/DAP.c and interface/Common/inc/DAP.h in the CMSIS-DAP > code on https://github.com/mbedmicro/CMSIS-DAP -- there's a whole lot of > high level JTAG stuff that's specific to ARM processors, but if you want low > level JTAG access, there's these two: > > The DAP_SWJ_Sequence function (DAP command id 0x12, CMD_DAP_SWJ_SEQ in > cmsis_dap_usb.c) will clock a sequence of bits out TMS (=SWDIO) so you can > change TAP states. > > The DAP_JTAG_Sequence function (DAP command id 0x14, CMD_DAP_SWJ_SEQ in > cmsis_dap_usb.c) will clock a sequence of bits out TDI and collect the > response from TDO, while holding TMS high or low as specified in the info > argument. > > Then in cmsis_dap_execute_command you'll need to implement the missing JTAG > commands. I've done JTAG_TLR_RESET, and JTAG_PATHMOVE is pretty easy, so if > you want to avoid duplicating effort you could start on JTAG_SCAN, which is > the most complex one. If you look at the other JTAG interfaces (ulink.c, > usbprog.c etc) there'll be a ton of code to work from. > > You should be able to get it working without changing anything in the > jtag_interface struct... just change the cmsis_dap_transport line to include > jtag and it'll become user selectable from config using 'transport select > jtag'. > > static const char * const cmsis_dap_transport[] = { "swd", "jtag", NULL }; > > Cheers, > Phil >
It has been a while but when we worked on the CMSIS-DAP support we tested both JTAG and SWD support. But for whatever reason we needed to make other changes to OpenOCD so only SWD support was initially merged. If I recall the details CMSIS-DAP operates at the ADIv5 layer so from OpenOCD's point of view we still use the swd driver mode but change the actual adapter to JTAG mode. We should not need to implement the full jtag_interface. Try setting cmsis_dap_usg::swd_mode to false as a start. Cheers Spen ------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 _______________________________________________ OpenOCD-devel mailing list OpenOCD-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openocd-devel