tcl/target: add SPDX tag
[fw/openocd] / tcl / target / bluefield.cfg
1 # SPDX-License-Identifier: GPL-2.0-or-later
2
3 # BlueField SoC Target
4
5 set _CHIPNAME bluefield
6
7 # Specify the target device
8 #rshim device /dev/rshim0/rshim
9
10 # Main DAP
11 if { [info exists DAP_TAPID] } {
12    set _DAP_TAPID $DAP_TAPID
13 } else {
14    set _DAP_TAPID 0x4ba00477
15 }
16
17 adapter speed 1500
18
19 swd newdap $_CHIPNAME cpu -expected-id $_DAP_TAPID
20 dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu
21
22 # Initialize the target name and command variable.
23 set _TARGETNAME $_CHIPNAME.cpu
24 set _smp_command ""
25
26 # CTI relative address
27 set $_TARGETNAME.cti(0) 0xC4020000
28 set $_TARGETNAME.cti(1) 0xC4120000
29 set $_TARGETNAME.cti(2) 0xC8020000
30 set $_TARGETNAME.cti(3) 0xC8120000
31 set $_TARGETNAME.cti(4) 0xCC020000
32 set $_TARGETNAME.cti(5) 0xCC120000
33 set $_TARGETNAME.cti(6) 0xD0020000
34 set $_TARGETNAME.cti(7) 0xD0120000
35 set $_TARGETNAME.cti(8) 0xD4020000
36 set $_TARGETNAME.cti(9) 0xD4120000
37 set $_TARGETNAME.cti(10) 0xD8020000
38 set $_TARGETNAME.cti(11) 0xD8120000
39 set $_TARGETNAME.cti(12) 0xDC020000
40 set $_TARGETNAME.cti(13) 0xDC120000
41 set $_TARGETNAME.cti(14) 0xE0020000
42 set $_TARGETNAME.cti(15) 0xE0120000
43
44 # Create debug targets for a number of cores starting from core '_core_start'.
45 # Adjust the numbers according to board configuration.
46 set _core_start 0
47 set _cores 16
48
49 # Create each core
50 for { set _core $_core_start } { $_core < $_core_start + $_cores } { incr _core 1 } {
51     cti create cti$_core -dap $_CHIPNAME.dap -baseaddr [set $_TARGETNAME.cti($_core)] -ap-num 0
52
53     set _command "target create ${_TARGETNAME}$_core aarch64 \
54                          -dap $_CHIPNAME.dap -coreid $_core -cti cti$_core"
55
56     if { $_core != $_core_start } {
57         set _smp_command "$_smp_command ${_TARGETNAME}$_core"
58     } else {
59         set _smp_command "target smp ${_TARGETNAME}$_core"
60     }
61
62     eval $_command
63 }
64
65 # Configure SMP
66 if { $_cores > 1 } {
67     eval $_smp_command
68 }
69
70 # Make sure the default target is the boot core
71 targets ${_TARGETNAME}0
72
73 proc core_up { args } {
74         global _TARGETNAME
75
76         # Examine remaining cores
77         foreach _core $args {
78                 ${_TARGETNAME}$_core arp_examine
79         }
80 }