tcl/target: add SPDX tag
[fw/openocd] / tcl / target / hi3798.cfg
1 # SPDX-License-Identifier: GPL-2.0-or-later
2
3 # Hisilicon Hi3798 Target
4
5 if { [info exists CHIPNAME] } {
6   set _CHIPNAME $CHIPNAME
7 } else {
8   set _CHIPNAME hi3798
9 }
10
11 #
12 # Main DAP
13 #
14 if { [info exists DAP_TAPID] } {
15    set _DAP_TAPID $DAP_TAPID
16 } else {
17    set _DAP_TAPID 0x5ba00477
18 }
19
20 # declare the one JTAG tap to access the DAP
21 jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_DAP_TAPID -ignore-version -enable
22 dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu
23 # declare the 4 main application cores
24 set _TARGETNAME $_CHIPNAME.cpu
25 set _smp_command ""
26
27 set $_TARGETNAME.cti(0) 0x80020000
28 set $_TARGETNAME.cti(1) 0x80120000
29 set $_TARGETNAME.cti(2) 0x80220000
30 set $_TARGETNAME.cti(3) 0x80320000
31
32 set _cores 4
33 for { set _core 0 } { $_core < $_cores } { incr _core 1 } {
34
35     cti create cti$_core -dap $_CHIPNAME.dap -baseaddr [set $_TARGETNAME.cti($_core)] -ap-num 0
36
37     set _command "target create ${_TARGETNAME}$_core aarch64 \
38                          -dap $_CHIPNAME.dap -coreid $_core -cti cti$_core"
39
40     if { $_core != 0 } {
41         # non-boot core examination may fail
42         #set _command "$_command -defer-examine"
43         set _smp_command "$_smp_command ${_TARGETNAME}$_core"
44     } else {
45         # uncomment when "hawt" rtos is merged
46         # set _command "$_command -rtos hawt"
47         set _smp_command "target smp ${_TARGETNAME}$_core"
48     }
49
50     eval $_command
51 }
52
53 eval $_smp_command