tcl/target/ti_k3: Rename R5 targets to be more descriptive
[fw/openocd] / tcl / target / ti_k3.cfg
index 325ee00042a02242e2744f49998d4475e980449f..6c2c2e1dadafe553f60041c13941eac1423aa555 100644 (file)
@@ -27,11 +27,11 @@ if { [info exists V8_SMP_DEBUG] } {
 
 # Common Definitions
 
-# CM3 the very first processor - all current SoCs have it.
+# System Controller is the very first processor - all current SoCs have it.
 set CM3_CTIBASE                {0x3C016000}
 
-# M3 power-ap unlock offsets
-set _m3_ap_unlock_offsets {0xf0 0x44}
+# sysctrl power-ap unlock offsets
+set _sysctrl_ap_unlock_offsets {0xf0 0x44}
 
 # All the ARMV8s are the next processors.
 #                 CL0,CORE0  CL0,CORE1  CL1,CORE0  CL1,CORE1
@@ -42,14 +42,15 @@ set ARMV8_CTIBASE {0x90420000 0x90520000 0x90820000 0x90920000}
 #              (0)MCU 0   (1)MCU 1   (2)MAIN_0_0 (3)MAIN_0_1 (4)MAIN_1_0 (5)MAIN_1_1
 set R5_DBGBASE {0x9d010000 0x9d012000 0x9d410000 0x9d412000 0x9d510000 0x9d512000}
 set R5_CTIBASE {0x9d018000 0x9d019000 0x9d418000 0x9d419000 0x9d518000 0x9d519000}
+set R5_NAMES {mcu_r5.0 mcu_r5.1 main0_r5.0 main0_r5.1 main1_r5.0 main1_r5.1}
 
-# Finally an M4F
+# Finally an General Purpose(GP) MCU
 set CM4_CTIBASE                {0x20001000}
 
-# M4 may be present on some very few SoCs
-set _mcu_m4_cores 0
-# M4 power-ap unlock offsets
-set _m4_ap_unlock_offsets {0xf0 0x60}
+# General Purpose MCU (M4) may be present on some very few SoCs
+set _gp_mcu_cores 0
+# General Purpose MCU power-ap unlock offsets
+set _gp_mcu_ap_unlock_offsets {0xf0 0x60}
 
 # Set configuration overrides for each SOC
 switch $_soc {
@@ -64,14 +65,12 @@ switch $_soc {
                # AM654 has 1 cluster of 2 R5s cores.
                set _r5_cores 2
                set _mcu_r5_cores 2
-               set _mcu_base_core_id 0
                set _main0_r5_cores 0
-               set _main0_base_core_id 0
                set _main1_r5_cores 0
-               set _main1_base_core_id 0
+               set R5_NAMES {mcu_r5.0 mcu_r5.1}
 
-               # M3 power-ap unlock offsets
-               set _m3_ap_unlock_offsets {0xf0 0x50}
+               # Sysctrl power-ap unlock offsets
+               set _sysctrl_ap_unlock_offsets {0xf0 0x50}
        }
        am642 {
                set _CHIPNAME am642
@@ -86,16 +85,14 @@ switch $_soc {
                # AM642 has 2 cluster of 2 R5s cores.
                set _r5_cores 4
                set _mcu_r5_cores 0
-               set _mcu_base_core_id 0
                set _main0_r5_cores 2
-               set _main0_base_core_id 0
                set _main1_r5_cores 2
-               set _main1_base_core_id 2
+               set R5_NAMES {main0_r5.0 main0_r5.1 main1_r5.0 main1_r5.1}
                set R5_DBGBASE {0x9d410000 0x9d412000 0x9d510000 0x9d512000}
                set R5_CTIBASE {0x9d418000 0x9d419000 0x9d518000 0x9d519000}
 
                # M4 processor
-               set _mcu_m4_cores 1
+               set _gp_mcu_cores 1
        }
        j721e {
                set _CHIPNAME j721e
@@ -107,11 +104,8 @@ switch $_soc {
                # J721E has 3 clusters of 2 R5 cores each.
                set _r5_cores 6
                set _mcu_r5_cores 2
-               set _mcu_base_core_id 0
                set _main0_r5_cores 2
-               set _main0_base_core_id 2
                set _main1_r5_cores 2
-               set _main1_base_core_id 4
        }
        j7200 {
                set _CHIPNAME j7200
@@ -124,11 +118,8 @@ switch $_soc {
                # J7200 has 2 clusters of 2 R5 cores each.
                set _r5_cores 4
                set _mcu_r5_cores 2
-               set _mcu_base_core_id 0
                set _main0_r5_cores 2
-               set _main0_base_core_id 2
                set _main1_r5_cores 0
-               set _main1_base_core_id 0
                set R5_DBGBASE {0x9d010000 0x9d012000 0x9d110000 0x9d112000}
                set R5_CTIBASE {0x9d018000 0x9d019000 0x9d118000 0x9d119000}
 
@@ -147,18 +138,24 @@ set _TARGETNAME $_CHIPNAME.cpu
 
 set _CTINAME $_CHIPNAME.cti
 
-# M3 is always present
-cti create $_CTINAME.m3 -dap $_CHIPNAME.dap -ap-num 7 -baseaddr [lindex $CM3_CTIBASE 0]
-target create $_TARGETNAME.m3 cortex_m -dap $_CHIPNAME.dap -ap-num 7 -defer-examine
-$_TARGETNAME.m3 configure -event reset-assert { }
+# sysctrl is always present
+cti create $_CTINAME.sysctrl -dap $_CHIPNAME.dap -ap-num 7 -baseaddr [lindex $CM3_CTIBASE 0]
+target create $_TARGETNAME.sysctrl cortex_m -dap $_CHIPNAME.dap -ap-num 7 -defer-examine
+$_TARGETNAME.sysctrl configure -event reset-assert { }
 
-proc m3_up {} {
-       # To access M3, we need to enable the JTAG access for the same.
+proc sysctrl_up {} {
+       # To access sysctrl, we need to enable the JTAG access for the same.
        # Ensure Power-AP unlocked
-       $::_CHIPNAME.dap apreg 3 [lindex $::_m3_ap_unlock_offsets 0] 0x00190000
-       $::_CHIPNAME.dap apreg 3 [lindex $::_m3_ap_unlock_offsets 1] 0x00102098
+       $::_CHIPNAME.dap apreg 3 [lindex $::_sysctrl_ap_unlock_offsets 0] 0x00190000
+       $::_CHIPNAME.dap apreg 3 [lindex $::_sysctrl_ap_unlock_offsets 1] 0x00102098
 
-       $::_TARGETNAME.m3 arp_examine
+       $::_TARGETNAME.sysctrl arp_examine
+}
+
+$_TARGETNAME.sysctrl configure -event gdb-attach {
+       sysctrl_up
+       # gdb-attach default rule
+       halt 1000
 }
 
 set _v8_smp_targets ""
@@ -202,20 +199,20 @@ if { $_v8_smp_debug == 0 } {
 }
 
 for { set _core 0 } { $_core < $_r5_cores } { incr _core } {
-       cti create $_CTINAME.r5.$_core -dap $_CHIPNAME.dap -ap-num 1 \
+       set _r5_name [lindex $R5_NAMES $_core]
+       cti create $_CTINAME.$_r5_name -dap $_CHIPNAME.dap -ap-num 1 \
                -baseaddr [lindex $R5_CTIBASE $_core]
 
        # inactive core examination will fail - wait till startup of additional core
-       target create $_TARGETNAME.r5.$_core cortex_r4 -dap $_CHIPNAME.dap \
+       target create $_TARGETNAME.$_r5_name cortex_r4 -dap $_CHIPNAME.dap \
                -dbgbase [lindex $R5_DBGBASE $_core] -ap-num 1 -defer-examine
 }
 
 if { $_mcu_r5_cores != 0 } {
        proc mcu_r5_up { args } {
                foreach { _core } [set args] {
-                       set _core [expr {$_core + $::_mcu_base_core_id}]
-                       $::_TARGETNAME.r5.$_core arp_examine
-                       $::_TARGETNAME.r5.$_core cortex_r4 dbginit
+                       $::_TARGETNAME.mcu_r5.$_core arp_examine
+                       $::_TARGETNAME.mcu_r5.$_core cortex_r4 dbginit
                }
        }
 }
@@ -223,9 +220,8 @@ if { $_mcu_r5_cores != 0 } {
 if { $_main0_r5_cores != 0 } {
        proc main0_r5_up { args } {
                foreach { _core } [set args] {
-                       set _core [expr {$_core + $::_main0_base_core_id}]
-                       $::_TARGETNAME.r5.$_core arp_examine
-                       $::_TARGETNAME.r5.$_core cortex_r4 dbginit
+                       $::_TARGETNAME.main0_r5.$_core arp_examine
+                       $::_TARGETNAME.main0_r5.$_core cortex_r4 dbginit
                }
        }
 }
@@ -233,24 +229,29 @@ if { $_main0_r5_cores != 0 } {
 if { $_main1_r5_cores != 0 } {
        proc main1_r5_up { args } {
                foreach { _core } [set args] {
-                       set _core [expr {$_core + $::_main1_base_core_id}]
-                       $::_TARGETNAME.r5.$_core arp_examine
-                       $::_TARGETNAME.r5.$_core cortex_r4 dbginit
+                       $::_TARGETNAME.main1_r5.$_core arp_examine
+                       $::_TARGETNAME.main1_r5.$_core cortex_r4 dbginit
                }
        }
 }
 
-if { $_mcu_m4_cores != 0 } {
-       cti create $_CTINAME.m4 -dap $_CHIPNAME.dap -ap-num 8 -baseaddr [lindex $CM4_CTIBASE 0]
-       target create $_TARGETNAME.m4 cortex_m -dap $_CHIPNAME.dap -ap-num 8 -defer-examine
-       $_TARGETNAME.m4 configure -event reset-assert { }
+if { $_gp_mcu_cores != 0 } {
+       cti create $_CTINAME.gp_mcu -dap $_CHIPNAME.dap -ap-num 8 -baseaddr [lindex $CM4_CTIBASE 0]
+       target create $_TARGETNAME.gp_mcu cortex_m -dap $_CHIPNAME.dap -ap-num 8 -defer-examine
+       $_TARGETNAME.gp_mcu configure -event reset-assert { }
 
-       proc m4_up {} {
-               # To access M4, we need to enable the JTAG access for the same.
+       proc gp_mcu_up {} {
+               # To access GP MCU, we need to enable the JTAG access for the same.
                # Ensure Power-AP unlocked
-               $::_CHIPNAME.dap apreg 3 [lindex $::_m4_ap_unlock_offsets 0] 0x00190000
-               $::_CHIPNAME.dap apreg 3 [lindex $::_m4_ap_unlock_offsets 1] 0x00102098
+               $::_CHIPNAME.dap apreg 3 [lindex $::_gp_mcu_ap_unlock_offsets 0] 0x00190000
+               $::_CHIPNAME.dap apreg 3 [lindex $::_gp_mcu_ap_unlock_offsets 1] 0x00102098
+
+               $::_TARGETNAME.gp_mcu arp_examine
+       }
 
-               $::_TARGETNAME.m4 arp_examine
+       $_TARGETNAME.gp_mcu configure -event gdb-attach {
+               gp_mcu_up
+               # gdb-attach default rule
+               halt 1000
        }
 }