glasgow icon indicating copy to clipboard operation
glasgow copied to clipboard

applet.interface.jtag_openocd: Add SWD support

Open mwick83 opened this issue 4 years ago • 6 comments

This adds handling of new command characters to make SWD work.

The command characters are as follows: O - SWDIO drive 1 o - SWDIO drive 0 c - SWDIO read request d - SWD write 0 0 e - SWD write 0 1 f - SWD write 1 0 g - SWD write 1 1

The new commands will be emitted by an updated version of openocd (http://openocd.zylin.com/#/c/6044/)

It has been tested against an stm32f103 and an at91samd21 target connected to a glasgow revC1.

mwick83 avatar Jan 30 '21 22:01 mwick83

I'm not sure whether the approach of adding TMS tristate into the generic JTAG code is the right one, so I can't merge this right away; this PR will have to wait until I have more time to consider it.

Sure, no need to rush anything. My newborn just arrived, so my free time is quite limited now as well ;-) I wasn't too happy with putting the tristating into the JTAG bus as well, but it didn't seem too good to replicate everything in there for an JTAGSWDBus implementation. The same can be said for adding SWD into an applet that is called "jtag-openocd".

mwick83 avatar Feb 12 '21 09:02 mwick83

@mwick83 Hi Manuel! Would you like to get this patch to completion in both openocd and Glasgow? I have more bandwidth to spend on Glasgow these days, and I think this is a very nice feature and it would be wonderful to have it.

whitequark avatar Jul 23 '23 20:07 whitequark

@whitequark Hi Cathrine, I would also love to see this feature integrated and I would love to work on it, but to be honest, time doesn't currently permit it. So, if you do have bandwidth to work on it, feel free to use the patches as a startingpoint.

On the openocd side, I think there is at least rebasing needed. As far as I can remember their bitbang implementation has been improved with regard to network performance.

Performance was also one of my main concerns initially. Communication with the target was pretty slow. But I wanted to get initial support out the door first.

mwick83 avatar Jul 24 '23 07:07 mwick83

Oh, when I'm back from holidays, I could defenitly spin up some real hardware tests, if needed.

mwick83 avatar Jul 24 '23 08:07 mwick83

Cool, thank you!

whitequark avatar Jul 24 '23 08:07 whitequark

This should now be upstream in openocd.

whitequark avatar Dec 17 '23 10:12 whitequark

Having carefully reviewed this, I think a separate swd-openocd applet probably makes the most sense.

whitequark avatar Mar 06 '24 01:03 whitequark

I propose to replace this PR with https://github.com/GlasgowEmbedded/glasgow/pull/531.

whitequark avatar Mar 06 '24 04:03 whitequark

I propose to replace this PR with #531.

Sure, sounds sensible. I guess it is a rather rare case to switch between JTAG and SWD on-the-fly. I can't think of a real use case.

mwick83 avatar Mar 06 '24 16:03 mwick83

Thanks for chiming in!

whitequark avatar Mar 06 '24 18:03 whitequark