jtag/drivers/jlink: Use correct command errors
[openocd.git] / tcl / target / xilinx_zynqmp.cfg
blob9734a18376d13f92ab7919174e2d643ae0e6f2ec
1 # SPDX-License-Identifier: GPL-2.0-or-later
4 # target configuration for
5 # Xilinx ZynqMP (UltraScale+ / A53)
7 if { [info exists CHIPNAME] } {
8     set _CHIPNAME $CHIPNAME
9 } else {
10     set _CHIPNAME uscale
14 # DAP tap (Quard core A53)
16 if { [info exists DAP_TAPID] } {
17     set _DAP_TAPID $DAP_TAPID
18 } else {
19     set _DAP_TAPID 0x5ba00477
22 jtag newtap $_CHIPNAME tap -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_DAP_TAPID
23 dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.tap
26 # PS tap (UltraScale+)
28 if { [info exists PS_TAPID] } {
29     set _PS_TAPID $PS_TAPID
30     jtag newtap $_CHIPNAME ps -irlen 12 -ircapture 0x1 -irmask 0x03 -expected-id $_PS_TAPID
31 } else {
32     # FPGA Programmable logic. Values take from Table 39-1 in UG1085:
33     jtag newtap $_CHIPNAME ps -irlen 12 -ircapture 0x1 -irmask 0x03 -ignore-version \
34         -expected-id 0x04711093 \
35         -expected-id 0x04710093 \
36         -expected-id 0x04721093 \
37         -expected-id 0x04720093 \
38         -expected-id 0x04739093 \
39         -expected-id 0x04730093 \
40         -expected-id 0x04738093 \
41         -expected-id 0x04740093 \
42         -expected-id 0x04750093 \
43         -expected-id 0x04759093 \
44         -expected-id 0x04758093
47 set jtag_configured 0
49 jtag configure $_CHIPNAME.ps -event setup {
50     global _CHIPNAME
51     global jtag_configured
53     if { $jtag_configured == 0 } {
54         # add the DAP tap to the chain
55         # See https://forums.xilinx.com/t5/UltraScale-Architecture/JTAG-Chain-Configuration-for-Zynq-UltraScale-MPSoC/td-p/758924
56         irscan $_CHIPNAME.ps 0x824
57         drscan $_CHIPNAME.ps 32 0x00000003
58         runtest 100
60         # setup event will be re-entered through jtag arp_init
61         # break the recursion
62         set jtag_configured 1
63         # re-initialized the jtag chain
64         jtag arp_init
65     }
68 set _TARGETNAME $_CHIPNAME.a53
69 set _CTINAME $_CHIPNAME.cti
70 set _smp_command ""
72 set DBGBASE {0x80410000 0x80510000 0x80610000 0x80710000}
73 set CTIBASE {0x80420000 0x80520000 0x80620000 0x80720000}
74 set _cores 4
76 for { set _core 0 } { $_core < $_cores } { incr _core } {
78     cti create $_CTINAME.$_core -dap $_CHIPNAME.dap -ap-num 1 \
79         -baseaddr [lindex $CTIBASE $_core]
81     set _command "target create $_TARGETNAME.$_core aarch64 -dap $_CHIPNAME.dap \
82         -dbgbase [lindex $DBGBASE $_core] -cti $_CTINAME.$_core"
84     if { $_core != 0 } {
85         # non-boot core examination may fail
86         set _command "$_command -defer-examine"
87         set _smp_command "$_smp_command $_TARGETNAME.$_core"
88     } else {
89         set _command "$_command -rtos hwthread"
90         set _smp_command "target smp $_TARGETNAME.$_core"
91     }
93     eval $_command
96 target create uscale.axi mem_ap -dap uscale.dap -ap-num 0
98 eval $_smp_command
99 targets $_TARGETNAME.0
101 proc core_up { args } {
102     global _TARGETNAME
103     foreach core $args {
104         $_TARGETNAME.$core arp_examine
105     }