2018-06-08 16:48:27 -05:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
# Copyright (C) 2019-2021 Texas Instruments Incorporated - http://www.ti.com/
|
|
|
|
#
|
|
|
|
# Texas Instruments K3 devices:
|
2023-10-17 15:50:49 -05:00
|
|
|
# * AM243: https://www.ti.com/lit/pdf/spruim2
|
|
|
|
# Has 4 R5 Cores, M4F and an M3
|
2023-10-17 16:00:27 -05:00
|
|
|
# * AM263: https://www.ti.com/lit/pdf/spruj17
|
|
|
|
# Has 4 R5 Cores and an M3
|
2023-10-17 16:07:41 -05:00
|
|
|
# * AM273: https://www.ti.com/lit/pdf/spruiu0
|
|
|
|
# Has 2 R5 Cores and an M3
|
2023-10-17 15:47:12 -05:00
|
|
|
# * AM625: https://www.ti.com/lit/pdf/spruiv7a
|
|
|
|
# Has 4 ARMV8 Cores and 1 R5 Core and an M4F
|
|
|
|
# * AM62A7: https://www.ti.com/lit/pdf/spruj16a
|
|
|
|
# Has 4 ARMV8 Cores and 2 R5 Cores
|
|
|
|
# * AM62P: https://www.ti.com/lit/pdf/spruj83
|
|
|
|
# Has 4 ARMV8 Cores and 2 R5 Cores
|
|
|
|
# * AM642: https://www.ti.com/lit/pdf/spruim2
|
|
|
|
# Has 2 ARMV8 Cores and 4 R5 Cores, M4F and an M3
|
2018-06-08 16:48:27 -05:00
|
|
|
# * AM654x: https://www.ti.com/lit/pdf/spruid7
|
|
|
|
# Has 4 ARMV8 Cores and 2 R5 Cores and an M3
|
|
|
|
# * J7200: https://www.ti.com/lit/pdf/spruiu1
|
|
|
|
# Has 2 ARMV8 Cores and 4 R5 Cores and an M3
|
2023-10-17 15:47:12 -05:00
|
|
|
# * J721E: https://www.ti.com/lit/pdf/spruil1
|
|
|
|
# Has 2 ARMV8 Cores and 6 R5 Cores and an M3
|
2023-08-09 09:07:28 -05:00
|
|
|
# * J721S2: https://www.ti.com/lit/pdf/spruj28
|
|
|
|
# Has 2 ARMV8 Cores and 6 R5 Cores and an M4F
|
2023-11-29 06:32:53 -06:00
|
|
|
# * J722S: https://www.ti.com/lit/zip/sprujb3
|
|
|
|
# Has 4 ARMV8 Cores and 3 R5 Cores
|
2023-09-06 07:59:23 -05:00
|
|
|
# * J784S4/AM69: http://www.ti.com/lit/zip/spruj52
|
|
|
|
# Has 8 ARMV8 Cores and 8 R5 Cores
|
2018-06-08 16:48:27 -05:00
|
|
|
#
|
|
|
|
|
2022-07-14 16:37:54 -05:00
|
|
|
source [find target/swj-dp.tcl]
|
|
|
|
|
2018-06-08 16:48:27 -05:00
|
|
|
if { [info exists SOC] } {
|
|
|
|
set _soc $SOC
|
|
|
|
} else {
|
|
|
|
set _soc am654
|
|
|
|
}
|
|
|
|
|
|
|
|
# set V8_SMP_DEBUG to non 0 value in board if you'd like to use SMP debug
|
|
|
|
if { [info exists V8_SMP_DEBUG] } {
|
|
|
|
set _v8_smp_debug $V8_SMP_DEBUG
|
|
|
|
} else {
|
|
|
|
set _v8_smp_debug 0
|
|
|
|
}
|
|
|
|
|
|
|
|
# Common Definitions
|
|
|
|
|
2021-10-01 23:02:23 -05:00
|
|
|
# System Controller is the very first processor - all current SoCs have it.
|
2018-06-08 16:48:27 -05:00
|
|
|
set CM3_CTIBASE {0x3C016000}
|
|
|
|
|
2021-10-01 23:02:23 -05:00
|
|
|
# sysctrl power-ap unlock offsets
|
|
|
|
set _sysctrl_ap_unlock_offsets {0xf0 0x44}
|
2023-10-17 13:51:51 -05:00
|
|
|
set _sysctrl_ap_num 7
|
2018-06-08 16:48:27 -05:00
|
|
|
|
|
|
|
# All the ARMV8s are the next processors.
|
|
|
|
# CL0,CORE0 CL0,CORE1 CL1,CORE0 CL1,CORE1
|
|
|
|
set ARMV8_DBGBASE {0x90410000 0x90510000 0x90810000 0x90910000}
|
|
|
|
set ARMV8_CTIBASE {0x90420000 0x90520000 0x90820000 0x90920000}
|
|
|
|
|
|
|
|
# And we add up the R5s
|
|
|
|
# (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}
|
2021-10-04 09:03:49 -05:00
|
|
|
set R5_NAMES {mcu_r5.0 mcu_r5.1 main0_r5.0 main0_r5.1 main1_r5.0 main1_r5.1}
|
2023-10-17 13:56:00 -05:00
|
|
|
set _r5_ap_num 1
|
2018-06-08 16:48:27 -05:00
|
|
|
|
2021-10-01 23:18:09 -05:00
|
|
|
# Finally an General Purpose(GP) MCU
|
2018-06-08 16:48:27 -05:00
|
|
|
set CM4_CTIBASE {0x20001000}
|
|
|
|
|
2021-10-01 23:18:09 -05:00
|
|
|
# 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}
|
2018-06-08 16:48:27 -05:00
|
|
|
|
2023-10-18 13:45:39 -05:00
|
|
|
# Generic mem-ap port number
|
|
|
|
set _mem_ap_num 2
|
|
|
|
|
2018-06-08 16:48:27 -05:00
|
|
|
# Set configuration overrides for each SOC
|
|
|
|
switch $_soc {
|
2023-10-17 16:00:27 -05:00
|
|
|
am263 {
|
|
|
|
set _K3_DAP_TAPID 0x2bb7d02f
|
|
|
|
|
|
|
|
# Mem-ap port
|
|
|
|
set _mem_ap_num 6
|
|
|
|
|
|
|
|
# AM263 has 0 ARMV8 CPUs
|
|
|
|
set _armv8_cores 0
|
|
|
|
|
|
|
|
# AM263 has 2 cluster of 2 R5s cores.
|
|
|
|
set _r5_cores 4
|
|
|
|
set R5_NAMES {main0_r5.0 main0_r5.1 main1_r5.0 main1_r5.1}
|
|
|
|
set R5_DBGBASE {0x90030000 0x90032000 0x90050000 0x90052000}
|
|
|
|
set R5_CTIBASE {0x90038000 0x90039000 0x90058000 0x90059000}
|
|
|
|
set _r5_ap_num 5
|
|
|
|
}
|
2023-10-17 16:07:41 -05:00
|
|
|
am273 {
|
|
|
|
set _K3_DAP_TAPID 0x1bb6a02f
|
|
|
|
|
|
|
|
# Mem-ap port
|
|
|
|
set _mem_ap_num 6
|
|
|
|
|
|
|
|
# system controller is on AP0
|
|
|
|
set _sysctrl_ap_num 0
|
|
|
|
|
|
|
|
# AM273 has 0 ARMV8 CPUs
|
|
|
|
set _armv8_cores 0
|
|
|
|
|
|
|
|
# AM273 has 1 cluster of 2 R5s cores.
|
|
|
|
set _r5_cores 2
|
|
|
|
set R5_NAMES {main0_r5.0 main0_r5.1}
|
|
|
|
set R5_DBGBASE {0x90030000 0x90032000}
|
|
|
|
set R5_CTIBASE {0x90038000 0x90039000}
|
|
|
|
set _r5_ap_num 5
|
|
|
|
}
|
2018-06-08 16:48:27 -05:00
|
|
|
am654 {
|
|
|
|
set _K3_DAP_TAPID 0x0bb5a02f
|
|
|
|
|
|
|
|
# AM654 has 2 clusters of 2 A53 cores each.
|
|
|
|
set _armv8_cpu_name a53
|
|
|
|
set _armv8_cores 4
|
|
|
|
|
|
|
|
# AM654 has 1 cluster of 2 R5s cores.
|
|
|
|
set _r5_cores 2
|
2021-10-04 09:03:49 -05:00
|
|
|
set R5_NAMES {mcu_r5.0 mcu_r5.1}
|
2018-06-08 16:48:27 -05:00
|
|
|
|
2021-10-01 23:02:23 -05:00
|
|
|
# Sysctrl power-ap unlock offsets
|
|
|
|
set _sysctrl_ap_unlock_offsets {0xf0 0x50}
|
2018-06-08 16:48:27 -05:00
|
|
|
}
|
2023-10-17 15:50:49 -05:00
|
|
|
am243 -
|
2018-06-08 16:48:27 -05:00
|
|
|
am642 {
|
|
|
|
set _K3_DAP_TAPID 0x0bb3802f
|
|
|
|
|
|
|
|
# AM642 has 1 clusters of 2 A53 cores each.
|
|
|
|
set _armv8_cpu_name a53
|
|
|
|
set _armv8_cores 2
|
|
|
|
set ARMV8_DBGBASE {0x90010000 0x90110000}
|
|
|
|
set ARMV8_CTIBASE {0x90020000 0x90120000}
|
|
|
|
|
|
|
|
# AM642 has 2 cluster of 2 R5s cores.
|
|
|
|
set _r5_cores 4
|
2021-10-04 09:03:49 -05:00
|
|
|
set R5_NAMES {main0_r5.0 main0_r5.1 main1_r5.0 main1_r5.1}
|
2018-06-08 16:48:27 -05:00
|
|
|
set R5_DBGBASE {0x9d410000 0x9d412000 0x9d510000 0x9d512000}
|
|
|
|
set R5_CTIBASE {0x9d418000 0x9d419000 0x9d518000 0x9d519000}
|
|
|
|
|
|
|
|
# M4 processor
|
2021-10-01 23:18:09 -05:00
|
|
|
set _gp_mcu_cores 1
|
2023-10-17 15:50:49 -05:00
|
|
|
|
|
|
|
# Overrides for am243
|
|
|
|
if { "$_soc" == "am243" } {
|
|
|
|
# Uses the same JTAG ID
|
|
|
|
set _armv8_cores 0
|
|
|
|
}
|
2018-06-08 16:48:27 -05:00
|
|
|
}
|
2022-01-03 13:23:38 -06:00
|
|
|
am625 {
|
|
|
|
set _K3_DAP_TAPID 0x0bb7e02f
|
|
|
|
|
|
|
|
# AM625 has 1 clusters of 4 A53 cores.
|
|
|
|
set _armv8_cpu_name a53
|
|
|
|
set _armv8_cores 4
|
|
|
|
set ARMV8_DBGBASE {0x90010000 0x90110000 0x90210000 0x90310000}
|
|
|
|
set ARMV8_CTIBASE {0x90020000 0x90120000 0x90220000 0x90320000}
|
|
|
|
|
|
|
|
# AM625 has 1 cluster of 1 R5s core.
|
|
|
|
set _r5_cores 1
|
|
|
|
set R5_NAMES {main0_r5.0}
|
|
|
|
set R5_DBGBASE {0x9d410000}
|
|
|
|
set R5_CTIBASE {0x9d418000}
|
|
|
|
|
|
|
|
# sysctrl CTI base
|
|
|
|
set CM3_CTIBASE {0x20001000}
|
|
|
|
# Sysctrl power-ap unlock offsets
|
|
|
|
set _sysctrl_ap_unlock_offsets {0xf0 0x78}
|
|
|
|
|
|
|
|
# M4 processor
|
|
|
|
set _gp_mcu_cores 1
|
|
|
|
set _gp_mcu_ap_unlock_offsets {0xf0 0x7c}
|
2022-07-14 16:37:54 -05:00
|
|
|
|
|
|
|
# Setup DMEM access descriptions
|
|
|
|
# DAPBUS (Debugger) description
|
|
|
|
set _dmem_base_address 0x740002000
|
|
|
|
set _dmem_ap_address_offset 0x100
|
|
|
|
set _dmem_max_aps 10
|
|
|
|
# Emulated AP description
|
|
|
|
set _dmem_emu_base_address 0x760000000
|
|
|
|
set _dmem_emu_base_address_map_to 0x1d500000
|
|
|
|
set _dmem_emu_ap_list 1
|
2022-01-03 13:23:38 -06:00
|
|
|
}
|
2023-11-29 06:32:53 -06:00
|
|
|
j722s -
|
2023-09-06 10:21:09 -05:00
|
|
|
am62p -
|
2023-08-09 09:10:13 -05:00
|
|
|
am62a7 {
|
|
|
|
set _K3_DAP_TAPID 0x0bb8d02f
|
|
|
|
|
2023-09-06 10:21:09 -05:00
|
|
|
# AM62a7/AM62P has 1 cluster of 4 A53 cores.
|
2023-08-09 09:10:13 -05:00
|
|
|
set _armv8_cpu_name a53
|
|
|
|
set _armv8_cores 4
|
|
|
|
set ARMV8_DBGBASE {0x90010000 0x90110000 0x90210000 0x90310000}
|
|
|
|
set ARMV8_CTIBASE {0x90020000 0x90120000 0x90220000 0x90320000}
|
|
|
|
|
2023-09-06 10:21:09 -05:00
|
|
|
# AM62a7/AM62P has 2 cluster of 1 R5 core.
|
2023-08-09 09:10:13 -05:00
|
|
|
set _r5_cores 2
|
|
|
|
set R5_NAMES {main0_r5.0 mcu0_r5.0}
|
|
|
|
set R5_DBGBASE {0x9d410000 0x9d810000}
|
|
|
|
set R5_CTIBASE {0x9d418000 0x9d818000}
|
|
|
|
|
|
|
|
# sysctrl CTI base
|
|
|
|
set CM3_CTIBASE {0x20001000}
|
|
|
|
# Sysctrl power-ap unlock offsets
|
|
|
|
set _sysctrl_ap_unlock_offsets {0xf0 0x78}
|
2023-09-06 10:21:09 -05:00
|
|
|
|
2024-05-16 15:49:37 -05:00
|
|
|
# Setup DMEM access descriptions
|
|
|
|
# DAPBUS (Debugger) description
|
|
|
|
set _dmem_base_address 0x740002000
|
|
|
|
set _dmem_ap_address_offset 0x100
|
|
|
|
set _dmem_max_aps 10
|
|
|
|
# Emulated AP description
|
|
|
|
set _dmem_emu_base_address 0x760000000
|
|
|
|
set _dmem_emu_base_address_map_to 0x1d500000
|
|
|
|
set _dmem_emu_ap_list 1
|
|
|
|
|
2023-09-06 10:21:09 -05:00
|
|
|
# Overrides for am62p
|
|
|
|
if { "$_soc" == "am62p" } {
|
|
|
|
set _K3_DAP_TAPID 0x0bb9d02f
|
|
|
|
set R5_NAMES {wkup0_r5.0 mcu0_r5.0}
|
|
|
|
}
|
2023-11-29 06:32:53 -06:00
|
|
|
# Overrides for j722s
|
|
|
|
if { "$_soc" == "j722s" } {
|
|
|
|
set _K3_DAP_TAPID 0x0bba002f
|
|
|
|
set _r5_cores 3
|
|
|
|
set R5_NAMES {wkup0_r5.0 main0_r5.0 mcu0_r5.0}
|
|
|
|
set R5_DBGBASE {0x9d410000 0x9d510000 0x9d810000}
|
|
|
|
set R5_CTIBASE {0x9d418000 0x9d518000 0x9d818000}
|
|
|
|
}
|
2023-08-09 09:10:13 -05:00
|
|
|
}
|
2018-06-08 16:48:27 -05:00
|
|
|
j721e {
|
|
|
|
set _K3_DAP_TAPID 0x0bb6402f
|
|
|
|
# J721E has 1 cluster of 2 A72 cores.
|
|
|
|
set _armv8_cpu_name a72
|
|
|
|
set _armv8_cores 2
|
|
|
|
|
|
|
|
# J721E has 3 clusters of 2 R5 cores each.
|
|
|
|
set _r5_cores 6
|
2022-10-04 13:11:02 -05:00
|
|
|
|
|
|
|
# Setup DMEM access descriptions
|
|
|
|
# DAPBUS (Debugger) description
|
|
|
|
set _dmem_base_address 0x4c40002000
|
|
|
|
set _dmem_ap_address_offset 0x100
|
|
|
|
set _dmem_max_aps 8
|
|
|
|
# Emulated AP description
|
|
|
|
set _dmem_emu_base_address 0x4c60000000
|
|
|
|
set _dmem_emu_base_address_map_to 0x1d600000
|
|
|
|
set _dmem_emu_ap_list 1
|
2018-06-08 16:48:27 -05:00
|
|
|
}
|
|
|
|
j7200 {
|
|
|
|
set _K3_DAP_TAPID 0x0bb6d02f
|
|
|
|
|
|
|
|
# J7200 has 1 cluster of 2 A72 cores.
|
|
|
|
set _armv8_cpu_name a72
|
|
|
|
set _armv8_cores 2
|
|
|
|
|
|
|
|
# J7200 has 2 clusters of 2 R5 cores each.
|
|
|
|
set _r5_cores 4
|
|
|
|
set R5_DBGBASE {0x9d010000 0x9d012000 0x9d110000 0x9d112000}
|
|
|
|
set R5_CTIBASE {0x9d018000 0x9d019000 0x9d118000 0x9d119000}
|
|
|
|
|
|
|
|
# M3 CTI base
|
|
|
|
set CM3_CTIBASE {0x20001000}
|
|
|
|
}
|
2021-10-14 09:55:49 -05:00
|
|
|
j721s2 {
|
|
|
|
set _K3_DAP_TAPID 0x0bb7502f
|
|
|
|
|
|
|
|
# J721s2 has 1 cluster of 2 A72 cores.
|
|
|
|
set _armv8_cpu_name a72
|
|
|
|
set _armv8_cores 2
|
|
|
|
|
|
|
|
# J721s2 has 3 clusters of 2 R5 cores each.
|
|
|
|
set _r5_cores 6
|
|
|
|
|
|
|
|
# sysctrl CTI base
|
|
|
|
set CM3_CTIBASE {0x20001000}
|
|
|
|
# Sysctrl power-ap unlock offsets
|
|
|
|
set _sysctrl_ap_unlock_offsets {0xf0 0x78}
|
|
|
|
|
|
|
|
# M4 processor
|
|
|
|
set _gp_mcu_cores 1
|
|
|
|
set _gp_mcu_ap_unlock_offsets {0xf0 0x7c}
|
|
|
|
}
|
2023-09-06 07:59:23 -05:00
|
|
|
j784s4 {
|
|
|
|
set _K3_DAP_TAPID 0x0bb8002f
|
|
|
|
|
|
|
|
# j784s4 has 2 cluster of 4 A72 cores each.
|
|
|
|
set _armv8_cpu_name a72
|
|
|
|
set _armv8_cores 8
|
|
|
|
set ARMV8_DBGBASE {0x90410000 0x90510000 0x90610000 0x90710000
|
|
|
|
0x90810000 0x90910000 0x90a10000 0x90b10000}
|
|
|
|
set ARMV8_CTIBASE {0x90420000 0x90520000 0x90620000 0x90720000
|
|
|
|
0x90820000 0x90920000 0x90a20000 0x90b20000}
|
|
|
|
|
|
|
|
# J721s2 has 4 clusters of 2 R5 cores each.
|
|
|
|
set _r5_cores 8
|
|
|
|
set R5_DBGBASE {0x9d010000 0x9d012000
|
|
|
|
0x9d410000 0x9d412000
|
|
|
|
0x9d510000 0x9d512000
|
|
|
|
0x9d610000 0x9d612000}
|
|
|
|
set R5_CTIBASE {0x9d018000 0x9d019000
|
|
|
|
0x9d418000 0x9d419000
|
|
|
|
0x9d518000 0x9d519000
|
|
|
|
0x9d618000 0x9d619000}
|
|
|
|
set R5_NAMES {mcu_r5.0 mcu_r5.1
|
|
|
|
main0_r5.0 main0_r5.1
|
|
|
|
main1_r5.0 main1_r5.1
|
|
|
|
main2_r5.0 main2_r5.1}
|
|
|
|
|
|
|
|
# sysctrl CTI base
|
|
|
|
set CM3_CTIBASE {0x20001000}
|
|
|
|
# Sysctrl power-ap unlock offsets
|
|
|
|
set _sysctrl_ap_unlock_offsets {0xf0 0x78}
|
|
|
|
}
|
2018-06-08 16:48:27 -05:00
|
|
|
default {
|
|
|
|
echo "'$_soc' is invalid!"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-13 17:57:29 -05:00
|
|
|
proc _get_rtos_type_for_cpu { target_name } {
|
|
|
|
if { [info exists ::RTOS($target_name)] } {
|
|
|
|
return $::RTOS($target_name)
|
|
|
|
}
|
|
|
|
return none
|
|
|
|
}
|
|
|
|
|
2023-09-06 10:10:20 -05:00
|
|
|
set _CHIPNAME $_soc
|
|
|
|
|
2022-07-14 16:37:54 -05:00
|
|
|
swj_newdap $_CHIPNAME cpu -irlen 4 -expected-id $_K3_DAP_TAPID -ignore-version
|
|
|
|
|
2018-06-08 16:48:27 -05:00
|
|
|
dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu
|
|
|
|
|
|
|
|
set _TARGETNAME $_CHIPNAME.cpu
|
|
|
|
|
|
|
|
set _CTINAME $_CHIPNAME.cti
|
|
|
|
|
2021-10-01 23:02:23 -05:00
|
|
|
# sysctrl is always present
|
2023-10-17 13:51:51 -05:00
|
|
|
cti create $_CTINAME.sysctrl -dap $_CHIPNAME.dap \
|
|
|
|
-ap-num $_sysctrl_ap_num -baseaddr [lindex $CM3_CTIBASE 0]
|
2023-09-13 17:57:29 -05:00
|
|
|
|
2023-10-17 13:51:51 -05:00
|
|
|
target create $_TARGETNAME.sysctrl cortex_m -dap $_CHIPNAME.dap \
|
|
|
|
-ap-num $_sysctrl_ap_num -defer-examine \
|
2023-09-13 17:57:29 -05:00
|
|
|
-rtos [_get_rtos_type_for_cpu $_TARGETNAME.sysctrl]
|
|
|
|
|
2021-10-01 23:02:23 -05:00
|
|
|
$_TARGETNAME.sysctrl configure -event reset-assert { }
|
2018-06-08 16:48:27 -05:00
|
|
|
|
2021-10-01 23:02:23 -05:00
|
|
|
proc sysctrl_up {} {
|
|
|
|
# To access sysctrl, we need to enable the JTAG access for the same.
|
2018-06-08 16:48:27 -05:00
|
|
|
# Ensure Power-AP unlocked
|
2021-10-01 23:02:23 -05:00
|
|
|
$::_CHIPNAME.dap apreg 3 [lindex $::_sysctrl_ap_unlock_offsets 0] 0x00190000
|
|
|
|
$::_CHIPNAME.dap apreg 3 [lindex $::_sysctrl_ap_unlock_offsets 1] 0x00102098
|
2018-06-08 16:48:27 -05:00
|
|
|
|
2021-10-01 23:02:23 -05:00
|
|
|
$::_TARGETNAME.sysctrl arp_examine
|
2018-06-08 16:48:27 -05:00
|
|
|
}
|
|
|
|
|
2021-10-01 23:02:23 -05:00
|
|
|
$_TARGETNAME.sysctrl configure -event gdb-attach {
|
|
|
|
sysctrl_up
|
2021-10-01 22:48:34 -05:00
|
|
|
# gdb-attach default rule
|
|
|
|
halt 1000
|
|
|
|
}
|
|
|
|
|
2021-10-04 09:20:34 -05:00
|
|
|
proc _cpu_no_smp_up {} {
|
|
|
|
set _current_target [target current]
|
|
|
|
set _current_type [$_current_target cget -type]
|
|
|
|
|
|
|
|
$_current_target arp_examine
|
|
|
|
$_current_target $_current_type dbginit
|
|
|
|
}
|
|
|
|
|
2022-03-01 09:09:55 -06:00
|
|
|
proc _armv8_smp_up {} {
|
|
|
|
for { set _core 0 } { $_core < $::_armv8_cores } { incr _core } {
|
|
|
|
$::_TARGETNAME.$::_armv8_cpu_name.$_core arp_examine
|
|
|
|
$::_TARGETNAME.$::_armv8_cpu_name.$_core aarch64 dbginit
|
|
|
|
$::_TARGETNAME.$::_armv8_cpu_name.$_core aarch64 smp on
|
|
|
|
}
|
|
|
|
# Set Default target as core 0
|
|
|
|
targets $::_TARGETNAME.$::_armv8_cpu_name.0
|
|
|
|
}
|
|
|
|
|
2018-06-08 16:48:27 -05:00
|
|
|
set _v8_smp_targets ""
|
|
|
|
|
|
|
|
for { set _core 0 } { $_core < $_armv8_cores } { incr _core } {
|
|
|
|
|
|
|
|
cti create $_CTINAME.$_armv8_cpu_name.$_core -dap $_CHIPNAME.dap -ap-num 1 \
|
|
|
|
-baseaddr [lindex $ARMV8_CTIBASE $_core]
|
|
|
|
|
2023-09-13 16:23:03 -05:00
|
|
|
target create $_TARGETNAME.$_armv8_cpu_name.$_core aarch64 -dap $_CHIPNAME.dap -coreid $_core \
|
2023-09-13 17:57:29 -05:00
|
|
|
-dbgbase [lindex $ARMV8_DBGBASE $_core] -cti $_CTINAME.$_armv8_cpu_name.$_core -defer-examine \
|
|
|
|
-rtos [_get_rtos_type_for_cpu $_TARGETNAME.$_armv8_cpu_name.$_core]
|
2018-06-08 16:48:27 -05:00
|
|
|
|
|
|
|
set _v8_smp_targets "$_v8_smp_targets $_TARGETNAME.$_armv8_cpu_name.$_core"
|
2022-03-01 09:09:55 -06:00
|
|
|
|
|
|
|
if { $_v8_smp_debug == 0 } {
|
|
|
|
$_TARGETNAME.$_armv8_cpu_name.$_core configure -event gdb-attach {
|
|
|
|
_cpu_no_smp_up
|
|
|
|
# gdb-attach default rule
|
|
|
|
halt 1000
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$_TARGETNAME.$_armv8_cpu_name.$_core configure -event gdb-attach {
|
|
|
|
_armv8_smp_up
|
|
|
|
# gdb-attach default rule
|
|
|
|
halt 1000
|
|
|
|
}
|
|
|
|
}
|
2018-06-08 16:48:27 -05:00
|
|
|
}
|
|
|
|
|
2023-10-17 15:36:55 -05:00
|
|
|
if { $_armv8_cores > 0 } {
|
|
|
|
# Setup ARMV8 proc commands based on CPU to prevent people confusing SoCs
|
|
|
|
set _armv8_up_cmd "$_armv8_cpu_name"_up
|
|
|
|
# Available if V8_SMP_DEBUG is set to non-zero value
|
|
|
|
set _armv8_smp_cmd "$_armv8_cpu_name"_smp
|
|
|
|
|
|
|
|
if { $_v8_smp_debug == 0 } {
|
|
|
|
proc $_armv8_up_cmd { args } {
|
|
|
|
foreach _core $args {
|
|
|
|
targets $_core
|
|
|
|
_cpu_no_smp_up
|
|
|
|
}
|
2018-06-08 16:48:27 -05:00
|
|
|
}
|
2023-10-17 15:36:55 -05:00
|
|
|
} else {
|
|
|
|
proc $_armv8_smp_cmd { args } {
|
|
|
|
_armv8_smp_up
|
|
|
|
}
|
|
|
|
# Declare SMP
|
|
|
|
target smp {*}$_v8_smp_targets
|
2018-06-08 16:48:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for { set _core 0 } { $_core < $_r5_cores } { incr _core } {
|
2021-10-04 09:03:49 -05:00
|
|
|
set _r5_name [lindex $R5_NAMES $_core]
|
2023-10-17 13:56:00 -05:00
|
|
|
cti create $_CTINAME.$_r5_name -dap $_CHIPNAME.dap -ap-num $_r5_ap_num \
|
2018-06-08 16:48:27 -05:00
|
|
|
-baseaddr [lindex $R5_CTIBASE $_core]
|
|
|
|
|
|
|
|
# inactive core examination will fail - wait till startup of additional core
|
2021-10-04 09:03:49 -05:00
|
|
|
target create $_TARGETNAME.$_r5_name cortex_r4 -dap $_CHIPNAME.dap \
|
2023-10-17 13:56:00 -05:00
|
|
|
-dbgbase [lindex $R5_DBGBASE $_core] -ap-num $_r5_ap_num -defer-examine \
|
2023-09-13 17:57:29 -05:00
|
|
|
-rtos [_get_rtos_type_for_cpu $_TARGETNAME.$_r5_name]
|
2018-06-08 16:48:27 -05:00
|
|
|
|
2021-10-04 09:20:34 -05:00
|
|
|
$_TARGETNAME.$_r5_name configure -event gdb-attach {
|
|
|
|
_cpu_no_smp_up
|
|
|
|
# gdb-attach default rule
|
|
|
|
halt 1000
|
2018-06-08 16:48:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-04 09:20:34 -05:00
|
|
|
proc r5_up { args } {
|
|
|
|
foreach _core $args {
|
|
|
|
targets $_core
|
|
|
|
_cpu_no_smp_up
|
2018-06-08 16:48:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-01 23:18:09 -05:00
|
|
|
if { $_gp_mcu_cores != 0 } {
|
|
|
|
cti create $_CTINAME.gp_mcu -dap $_CHIPNAME.dap -ap-num 8 -baseaddr [lindex $CM4_CTIBASE 0]
|
2023-09-13 17:57:29 -05:00
|
|
|
target create $_TARGETNAME.gp_mcu cortex_m -dap $_CHIPNAME.dap -ap-num 8 -defer-examine \
|
|
|
|
-rtos [_get_rtos_type_for_cpu $_TARGETNAME.gp_mcu]
|
2021-10-01 23:18:09 -05:00
|
|
|
$_TARGETNAME.gp_mcu configure -event reset-assert { }
|
2018-06-08 16:48:27 -05:00
|
|
|
|
2021-10-01 23:18:09 -05:00
|
|
|
proc gp_mcu_up {} {
|
|
|
|
# To access GP MCU, we need to enable the JTAG access for the same.
|
2018-06-08 16:48:27 -05:00
|
|
|
# Ensure Power-AP unlocked
|
2021-10-01 23:18:09 -05:00
|
|
|
$::_CHIPNAME.dap apreg 3 [lindex $::_gp_mcu_ap_unlock_offsets 0] 0x00190000
|
|
|
|
$::_CHIPNAME.dap apreg 3 [lindex $::_gp_mcu_ap_unlock_offsets 1] 0x00102098
|
2018-06-08 16:48:27 -05:00
|
|
|
|
2021-10-01 23:18:09 -05:00
|
|
|
$::_TARGETNAME.gp_mcu arp_examine
|
2018-06-08 16:48:27 -05:00
|
|
|
}
|
2021-10-01 22:48:34 -05:00
|
|
|
|
2021-10-01 23:18:09 -05:00
|
|
|
$_TARGETNAME.gp_mcu configure -event gdb-attach {
|
|
|
|
gp_mcu_up
|
2021-10-01 22:48:34 -05:00
|
|
|
# gdb-attach default rule
|
|
|
|
halt 1000
|
|
|
|
}
|
2018-06-08 16:48:27 -05:00
|
|
|
}
|
2022-07-14 16:37:54 -05:00
|
|
|
|
|
|
|
# In case of DMEM access, configure the dmem adapter with offsets from above.
|
|
|
|
if { 0 == [string compare [adapter name] dmem ] } {
|
|
|
|
if { [info exists _dmem_base_address] } {
|
|
|
|
# DAPBUS (Debugger) description
|
|
|
|
dmem base_address $_dmem_base_address
|
|
|
|
dmem ap_address_offset $_dmem_ap_address_offset
|
|
|
|
dmem max_aps $_dmem_max_aps
|
|
|
|
|
|
|
|
# The following are the details of APs to be emulated for direct address access.
|
|
|
|
# Debug Config (Debugger) description
|
|
|
|
dmem emu_base_address_range $_dmem_emu_base_address $_dmem_emu_base_address_map_to
|
|
|
|
dmem emu_ap_list $_dmem_emu_ap_list
|
|
|
|
# We are going local bus, so speed is really dummy here.
|
|
|
|
adapter speed 2500
|
|
|
|
} else {
|
|
|
|
puts "ERROR: ${SOC} data is missing to support dmem access!"
|
|
|
|
}
|
2023-09-14 07:49:02 -05:00
|
|
|
} else {
|
|
|
|
# AXI AP access port for SoC address map
|
2023-10-18 13:45:39 -05:00
|
|
|
target create $_CHIPNAME.axi_ap mem_ap -dap $_CHIPNAME.dap -ap-num $_mem_ap_num
|
2022-07-14 16:37:54 -05:00
|
|
|
}
|