view calypso-jtag/ft2232d-unbuf-poc.cfg @ 155:804a5b0797c6

fc-simtool: grcard2-set-puk[12] commands implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 07 Feb 2021 02:34:33 +0000
parents 240221552ecf
children
line wrap: on
line source

# 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
}