2019-03-09 16:51:33 +00:00
|
|
|
# Script from
|
|
|
|
# https://www.suse.com/c/debugging-raspberry-pi-3-with-jtag/
|
2019-03-10 12:40:28 +00:00
|
|
|
# with minor adaptions.
|
2019-03-09 16:51:33 +00:00
|
|
|
|
|
|
|
transport select jtag
|
|
|
|
|
|
|
|
# we need to enable srst even though we don't connect it
|
|
|
|
reset_config trst_and_srst
|
|
|
|
|
|
|
|
adapter_khz 1000
|
|
|
|
jtag_ntrst_delay 500
|
|
|
|
|
|
|
|
if { [info exists CHIPNAME] } {
|
|
|
|
set _CHIPNAME $CHIPNAME
|
|
|
|
} else {
|
2019-10-27 21:13:20 +00:00
|
|
|
set _CHIPNAME rpi4
|
2019-03-09 16:51:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Main DAP
|
|
|
|
#
|
|
|
|
if { [info exists DAP_TAPID] } {
|
|
|
|
set _DAP_TAPID $DAP_TAPID
|
|
|
|
} else {
|
|
|
|
set _DAP_TAPID 0x4ba00477
|
|
|
|
}
|
|
|
|
|
|
|
|
jtag newtap $_CHIPNAME tap -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_DAP_TAPID -enable
|
|
|
|
dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.tap
|
|
|
|
|
|
|
|
set _TARGETNAME $_CHIPNAME.core
|
|
|
|
set _CTINAME $_CHIPNAME.cti
|
|
|
|
|
2019-10-27 21:13:20 +00:00
|
|
|
set DBGBASE {0x80410000 0x80510000 0x80610000 0x80710000}
|
|
|
|
set CTIBASE {0x80420000 0x80520000 0x80620000 0x80720000}
|
2019-03-09 16:51:33 +00:00
|
|
|
set _cores 4
|
|
|
|
|
|
|
|
for { set _core 0 } { $_core < $_cores } { incr _core } {
|
|
|
|
|
|
|
|
cti create $_CTINAME.$_core -dap $_CHIPNAME.dap -ap-num 0 \
|
|
|
|
-ctibase [lindex $CTIBASE $_core]
|
|
|
|
|
|
|
|
target create $_TARGETNAME$_core aarch64 \
|
|
|
|
-dap $_CHIPNAME.dap -coreid $_core \
|
|
|
|
-dbgbase [lindex $DBGBASE $_core] -cti $_CTINAME.$_core
|
|
|
|
|
|
|
|
$_TARGETNAME$_core configure -event reset-assert-post "aarch64 dbginit"
|
|
|
|
$_TARGETNAME$_core configure -event gdb-attach { halt }
|
|
|
|
}
|