From 0f70c6c325785517f35bbbb9316801bef7a79d8b Mon Sep 17 00:00:00 2001 From: Manuel Wick Date: Sat, 30 Jan 2021 22:46:50 +0100 Subject: remote_bitbang: Add SWD support This adds new command characters to make SWD work with the new split jtag and swd operations of bitbang. 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 Documentation has been updated accordingly. The new commands will be used by an adapted version of the jtag-openocd applet of the "Glasgow Debug Tool" (https://github.com/glasgowEmbedded/Glasgow). It has been tested against an stm32f103 and an at91samd21 target. contrib/remote/bitbang/remote_bitbang_sysfsgpio.c has also been adapted to support SWD via the new command set. Some limited testing has been done using a Raspberry Pi 2 with an stm32f103 and an at91samd21 target attached. Change-Id: I8e998a2cb36905142cb16e534483094cd99e8fa7 Signed-off-by: Manuel Wick Signed-off-by: David Ryskalczyk Reviewed-on: https://review.openocd.org/c/openocd/+/6044 Tested-by: jenkins Reviewed-by: Tomas Vanek Reviewed-by: Antonio Borneo --- doc/manual/jtag/drivers/remote_bitbang.txt | 36 +++++++++++++++++++++++------- doc/openocd.texi | 6 ++--- 2 files changed, 31 insertions(+), 11 deletions(-) (limited to 'doc') diff --git a/doc/manual/jtag/drivers/remote_bitbang.txt b/doc/manual/jtag/drivers/remote_bitbang.txt index f394d73..7c8eee2 100644 --- a/doc/manual/jtag/drivers/remote_bitbang.txt +++ b/doc/manual/jtag/drivers/remote_bitbang.txt @@ -1,15 +1,19 @@ /** @remote_bitbangpage OpenOCD Developer's Guide -The remote_bitbang JTAG driver is used to drive JTAG from a remote process. The -remote_bitbang driver communicates via TCP or UNIX sockets with some remote -process using an ASCII encoding of the bitbang interface. The remote process -presumably then drives the JTAG however it pleases. The remote process should -act as a server, listening for connections from the openocd remote_bitbang -driver. +The remote_bitbang JTAG+SWD driver is used to drive JTAG and/or SWD from a +remote process. The remote_bitbang driver communicates via TCP or UNIX +sockets with some remote process using an ASCII encoding of the bitbang +interface. The remote process presumably then drives the JTAG/SWD however +it pleases. The remote process should act as a server, listening for +connections from the openocd remote_bitbang driver. The remote bitbang driver is useful for debugging software running on processors which are being simulated. +There also is an implementation of the server-side protocol for the +Glasgow Debug Tool (https://github.com/glasgowEmbedded/Glasgow) through +the jtag-openocd applet. + The bitbang interface consists of the following functions. blink on @@ -24,11 +28,20 @@ write tck tms tdi reset trst srst Set the value of trst, srst. +swdio_drive + Set the output enable of the bidirectional swdio (tms) pin + +swdio_read + Sample the value of swdio (tms). + +swd_write + Set the value of swclk (tck) and swdio (tms). + An additional function, quit, is added to the remote_bitbang interface to indicate there will be no more requests and the connection with the remote driver should be closed. -These five functions are encoded in ASCII by assigning a single character to +These eight functions are encoded in ASCII by assigning a single character to each possible request. The assignments are: B - Blink on @@ -47,7 +60,14 @@ each possible request. The assignments are: s - Reset 0 1 t - Reset 1 0 u - Reset 1 1 + 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 read response is encoded in ASCII as either digit 0 or 1. +The read responses are encoded in ASCII as either digit 0 or 1. */ diff --git a/doc/openocd.texi b/doc/openocd.texi index c14ee9c..de990c5 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -2810,9 +2810,9 @@ If not specified, default 0xFFFF is used. @end deffn @deffn {Interface Driver} {remote_bitbang} -Drive JTAG from a remote process. This sets up a UNIX or TCP socket connection -with a remote process and sends ASCII encoded bitbang requests to that process -instead of directly driving JTAG. +Drive JTAG and SWD from a remote process. This sets up a UNIX or TCP socket +connection with a remote process and sends ASCII encoded bitbang requests to +that process instead of directly driving JTAG and SWD. The remote_bitbang driver is useful for debugging software running on processors which are being simulated. -- cgit v1.1