From 52ef9a2bfa9ecaff54b1d8199c70b99f23f6712f Mon Sep 17 00:00:00 2001
From: Angus Gratton <gus@projectgus.com>
Date: Sun, 12 Oct 2014 13:16:10 +1100
Subject: [PATCH] swd: Add dumps for some common openocd/swd interactions

---
 swd/ftdi_openocd/init.sr                    | Bin 0 -> 1344 bytes
 swd/ftdi_openocd/init_noreply.sr            | Bin 0 -> 754 bytes
 swd/ftdi_openocd/init_wait_fault.sr         | Bin 0 -> 12691 bytes
 swd/ftdi_openocd/init_write_0xabbabeeb.sr   | Bin 0 -> 1543 bytes
 swd/notes.txt                               |  53 ++++++++++++++++++++++++++++
 swd/notes.txt~                              |   9 +++++
 swd/stlink_openocd/init.sr                  | Bin 0 -> 1419 bytes
 swd/stlink_openocd/init_write_0xabbabeeb.sr | Bin 0 -> 5004 bytes
 swd/stlink_openocd/wait_retry.sr            | Bin 0 -> 11320 bytes
 9 files changed, 62 insertions(+)
 create mode 100644 swd/ftdi_openocd/init.sr
 create mode 100644 swd/ftdi_openocd/init_noreply.sr
 create mode 100644 swd/ftdi_openocd/init_wait_fault.sr
 create mode 100644 swd/ftdi_openocd/init_write_0xabbabeeb.sr
 create mode 100644 swd/notes.txt
 create mode 100644 swd/notes.txt~
 create mode 100644 swd/stlink_openocd/init.sr
 create mode 100644 swd/stlink_openocd/init_write_0xabbabeeb.sr
 create mode 100644 swd/stlink_openocd/wait_retry.sr

diff --git a/swd/ftdi_openocd/init.sr b/swd/ftdi_openocd/init.sr
new file mode 100644
index 0000000000000000000000000000000000000000..be7073f4529415b28fe44ed75f7d718a4ee08a63
GIT binary patch
diff --git a/swd/ftdi_openocd/init_noreply.sr b/swd/ftdi_openocd/init_noreply.sr
new file mode 100644
index 0000000000000000000000000000000000000000..d5408527e48179d4a9d141bcd3157432fae59c2e
GIT binary patch
diff --git a/swd/ftdi_openocd/init_wait_fault.sr b/swd/ftdi_openocd/init_wait_fault.sr
new file mode 100644
index 0000000000000000000000000000000000000000..abf10903c96f36f24fc9ae9888a395b4131bf136
GIT binary patch
diff --git a/swd/ftdi_openocd/init_write_0xabbabeeb.sr b/swd/ftdi_openocd/init_write_0xabbabeeb.sr
new file mode 100644
index 0000000000000000000000000000000000000000..8052e7e50edab984cb10a5ae729d463615e66f93
GIT binary patch
diff --git a/swd/notes.txt b/swd/notes.txt
new file mode 100644
index 0000000..35fac28
--- /dev/null
+++ b/swd/notes.txt
@@ -0,0 +1,53 @@
+Different SWD sessions showing different types of behaviour:
+
+* ftdi_openocd/
+
+Using an FTDI-based adapter via "openocd ftdi resistor hack". Openocd
+0.9.0 development version. Device under test is Nordic
+nrf51822. Command line:
+
+openocd -f interface/ftdi/olimex-arm-usb-tiny-h.cfg -f interface/ftdi/swd-resistor-hack.cfg -f target/nrf51.cfg
+
+** ftdi_openocd/init.sr - Initialising device, IDCODE read, etc.
+   Openocd args: -c "init; exit"
+
+** ftdi_openocd/init_noreply.sr - Initialising when no device is connected (ie all responses are 1s.)
+   Openocd args: -c "init; exit"
+
+** ftdi_openocd/init_write_0xabbabeeb.sr - Initialise, write 20 bytes of 0xabbabeeb at start of RAM.
+   Openocd args: -c "init; halt; mww 0x20000000 0xabbabeeb 20; exit"
+
+** ftdi_openocd/init_wait_fault.sr - Initialise, attempt to write
+   flash fill of 0xabbabeeb via async loader. This causes SWD WAIT
+   states in "overrun" mode, so the first WAIT causes all subsequent
+   responses to be FAULT until openocd clears the sticky error bit.
+
+   For this capture openocd was patched with this change (known to induce SWD WAITs):
+   http://openocd.zylin.com/#/c/2204/
+
+   Openocd args: -c "init; reset halt; flash fillw 0 0xabbabeeb 2048; exit"
+
+
+* stlink_openocd/
+
+Using an STLINK-V2 adapter via Openocd 0.9.0 development
+version. Device under test is Nordic nrf51822. Command line:
+
+openocd -f interface/stlink-v2.cfg -c 'transport select hla_swd' -f target/nrf51.cfg
+
+** stlink_openocd/init.sr - Intiliasing device, IDCODE read, etc.
+   Openocd args: -c "init; exit"
+
+** stlink_openocd/init_write_0xabbabeeb.sr - Initialise, write 20
+   bytes of 0xabbabeeb at start of RAM.
+   Openocd args: -c "init; halt; mww 0x20000000 0xabbabeeb 20; exit"
+
+** stlink_openocd/wait_retry.sr - Capture showing an SWD WAIT with
+   overrun mode not enabled (in contrast to ftdi_openocd/wait_retry.sr),
+   adapter immediately retries and gets an OK response.
+
+   For this capture openocd was patched with this change (known to induce SWD WAITs):
+   http://openocd.zylin.com/#/c/2204/
+
+   Openocd args: -c "init; reset halt; flash fillw 0 0xabbabeeb 2048; exit"
+
diff --git a/swd/notes.txt~ b/swd/notes.txt~
new file mode 100644
index 0000000..73fbd28
--- /dev/null
+++ b/swd/notes.txt~
@@ -0,0 +1,9 @@
+Different SWD sessions showing different types of behaviour:
+
+* ftdi_openocd/
+
+Using an FTDI-based adapter via "openocd ftdi resistor hack". openocd
+0.9.0 development version. Device under test is Nordic
+nrf51822. Command line:
+
+src/openocd -f interface/ftdi/olimex-arm-usb-tiny-h.cfg -f interface/ftdi/swd-resistor-hack.cfg -f target/nrf51.cfg
diff --git a/swd/stlink_openocd/init.sr b/swd/stlink_openocd/init.sr
new file mode 100644
index 0000000000000000000000000000000000000000..092ac3de598e5aae14c267166c9519afb7b9da09
GIT binary patch
diff --git a/swd/stlink_openocd/init_write_0xabbabeeb.sr b/swd/stlink_openocd/init_write_0xabbabeeb.sr
new file mode 100644
index 0000000000000000000000000000000000000000..f83c309bc8465432aa0951284e812636c06ca81c
GIT binary patch
diff --git a/swd/stlink_openocd/wait_retry.sr b/swd/stlink_openocd/wait_retry.sr
new file mode 100644
index 0000000000000000000000000000000000000000..da114bb401a9dbee65e2cc7f8fefa9a89c8c7b7e
GIT binary patch
-- 
2.1.0

