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