changeset 61:3940292ad76f

calypso-jtag: finally got some breakthrough
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 23 Jun 2019 01:08:01 +0000
parents f362a4c18f6f
children 240221552ecf
files calypso-jtag/brute.cfg calypso-jtag/with-reset.cfg
diffstat 2 files changed, 147 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/calypso-jtag/brute.cfg	Sun Jun 23 01:08:01 2019 +0000
@@ -0,0 +1,86 @@
+# The Calypso target is connected to an unbuffered FT2232D adapter
+# acting as the JTAG interface following Mother Mychaela's method,
+# ADBUS7 is wired to the reset pin on TI's 14-pin connector.
+#
+# This OpenOCD config is a proof of concept, demonstrating our ability
+# to (1) halt an already-running Calypso through the scan chain without
+# doing a reset, (2) perform a reset (Iota nTESTRESET) without a halt,
+# i.e., reset and let run, and (3) perform a reset with a built-in halt,
+# halting the Calypso at the reset vector before it executes even one
+# instruction, with all hardware in its pristine state directly out of
+# superdeep reset.  This proof of concept is done in a "brute force" way,
+# bypassing most of OpenOCD's infrastructure and using our own ad hoc
+# Tcl procedures instead.
+
+interface ftdi
+ftdi_vid_pid 0x0403 0x7151
+
+ftdi_layout_init 0x0088 0x008b
+ftdi_layout_signal XDS_RESET -data 0x0080 -oe 0x0080
+
+transport select jtag
+adapter_khz 6000
+
+# Reset like the one produced by TI's original XDS510/560 adapters
+proc xds_reset {} {
+	ftdi_set_signal XDS_RESET 0
+	sleep 50
+	ftdi_set_signal XDS_RESET 1
+	sleep 10
+}
+
+if { [info exists CHIPNAME] } {
+	set  _CHIPNAME $CHIPNAME
+} else {
+	set  _CHIPNAME calypso
+}
+
+if { [info exists CPUTAPID] } {
+	set _CPUTAPID $CPUTAPID
+} else {
+	set _CPUTAPID 0x3100e02f
+}
+
+jtag newtap $_CHIPNAME dsp -irlen 8
+jtag newtap $_CHIPNAME arm -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
+
+set _TARGETNAME $_CHIPNAME.arm
+target create $_TARGETNAME arm7tdmi -endian little -chain-position $_TARGETNAME
+
+arm7_9 dbgrq enable
+
+proc calypso_magic {} {
+	irscan calypso.arm 0x0b -endstate DRPAUSE
+	drscan calypso.arm 2 2 -endstate RUN/IDLE
+}
+
+proc enable_halt {} {
+	poll off
+	calypso_magic
+	poll on
+}
+
+# watchdog disable with minimal finger strokes to make it in time
+proc wd {} {
+	calypso.arm mwh 0xFFFFF804 0xF5
+	calypso.arm mwh 0xFFFFF804 0xA0
+}
+
+proc reset_run {} {
+	poll off
+	xds_reset
+	jtag arp_init
+	calypso.arm arp_examine
+	poll on
+}
+
+proc reset_halt {} {
+	poll off
+	xds_reset
+	jtag arp_init
+	calypso.arm arp_examine
+	calypso_magic
+	halt
+	wd
+	poll on
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/calypso-jtag/with-reset.cfg	Sun Jun 23 01:08:01 2019 +0000
@@ -0,0 +1,61 @@
+# The Calypso target is connected to an unbuffered FT2232D adapter
+# acting as the JTAG interface following Mother Mychaela's method,
+# ADBUS7 is wired to the reset pin on TI's 14-pin connector.
+#
+# This config is an attempt (unsuccessful) to get OpenOCD's reset
+# infrastructure (including reset halt) to work with the very different
+# way of doing things on the Calypso.
+
+interface ftdi
+ftdi_vid_pid 0x0403 0x7151
+
+ftdi_layout_init 0x0088 0x008b
+ftdi_layout_signal XDS_RESET -data 0x0080 -oe 0x0080
+
+transport select jtag
+adapter_khz 6000
+
+# Reset like the one produced by TI's original XDS510/560 adapters
+proc init_reset { mode } {
+	ftdi_set_signal XDS_RESET 0
+	sleep 50
+	ftdi_set_signal XDS_RESET 1
+	sleep 10
+	jtag arp_init
+}
+
+if { [info exists CHIPNAME] } {
+	set  _CHIPNAME $CHIPNAME
+} else {
+	set  _CHIPNAME calypso
+}
+
+if { [info exists CPUTAPID] } {
+	set _CPUTAPID $CPUTAPID
+} else {
+	set _CPUTAPID 0x3100e02f
+}
+
+jtag newtap $_CHIPNAME dsp -irlen 8
+jtag newtap $_CHIPNAME arm -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
+
+set _TARGETNAME $_CHIPNAME.arm
+target create $_TARGETNAME arm7tdmi -endian little -chain-position $_TARGETNAME
+
+arm7_9 dbgrq enable
+
+proc calypso_magic {} {
+	irscan calypso.arm 0x0b -endstate DRPAUSE
+	drscan calypso.arm 2 2 -endstate RUN/IDLE
+}
+
+# watchdog disable with minimal finger strokes to make it in time
+proc wd {} {
+	calypso.arm mwh 0xFFFFF804 0xF5
+	calypso.arm mwh 0xFFFFF804 0xA0
+}
+
+$_TARGETNAME configure -event examine-start calypso_magic
+
+# deliberately empty procedure here, as init_reset already did the job
+$_TARGETNAME configure -event reset-assert { }