2022-07-10 19:35:50 -05:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
# Target Support for Xtensa Processors
|
|
|
|
#
|
|
|
|
|
|
|
|
set xtensa_ids { 0x120034e5 0x120134e5
|
|
|
|
0x209034e5 0x209134e5 0x209234e5 0x209334e5 0x209434e5 0x209534e5 0x209634e5 0x209734e5
|
|
|
|
0x20a034e5 0x20a134e5 0x20a234e5 0x20a334e5 0x20a434e5 0x20a534e5 0x20a634e5 0x20a734e5 0x20a834e5
|
2024-01-18 18:10:26 -06:00
|
|
|
0x20b034e5 0x20b33ac5 0x20b33ac7 }
|
2022-07-10 19:35:50 -05:00
|
|
|
set expected_xtensa_ids {}
|
|
|
|
foreach i $xtensa_ids {
|
|
|
|
lappend expected_xtensa_ids -expected-id $i
|
|
|
|
}
|
|
|
|
|
|
|
|
if { [info exists CHIPNAME] } {
|
|
|
|
set _CHIPNAME $CHIPNAME
|
|
|
|
} else {
|
|
|
|
set _CHIPNAME xtensa
|
|
|
|
}
|
|
|
|
|
|
|
|
if { [info exists CPUTAPID] } {
|
|
|
|
set _CPUTAPARGLIST "-expected-id $CPUTAPID"
|
|
|
|
} else {
|
|
|
|
set _CPUTAPARGLIST [join $expected_xtensa_ids]
|
|
|
|
}
|
|
|
|
|
2024-01-18 18:10:26 -06:00
|
|
|
if { [info exists XTENSA_NUM_CORES] } {
|
|
|
|
set _XTENSA_NUM_CORES $XTENSA_NUM_CORES
|
|
|
|
} else {
|
|
|
|
set _XTENSA_NUM_CORES 1
|
|
|
|
}
|
|
|
|
|
2022-07-10 19:35:50 -05:00
|
|
|
set _TARGETNAME $_CHIPNAME
|
|
|
|
set _CPU0NAME cpu
|
|
|
|
set _TAPNAME $_CHIPNAME.$_CPU0NAME
|
|
|
|
|
|
|
|
if { [info exists XTENSA_DAP] } {
|
|
|
|
source [find target/swj-dp.tcl]
|
|
|
|
# SWD mode ignores the -irlen parameter
|
|
|
|
eval swj_newdap $_CHIPNAME cpu -irlen 4 $_CPUTAPARGLIST
|
|
|
|
dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu
|
|
|
|
|
|
|
|
set _TARGETNAME $_CHIPNAME.cpu
|
2022-08-25 10:55:00 -05:00
|
|
|
if { [info exists XTENSA_DAP_BASE] } {
|
|
|
|
# Specify fixed offset for accessing XDM via APB behind a DAP interface
|
|
|
|
target create $_TARGETNAME xtensa -dap $_CHIPNAME.dap -dbgbase $XTENSA_DAP_BASE
|
|
|
|
} else {
|
|
|
|
target create $_TARGETNAME xtensa -dap $_CHIPNAME.dap
|
|
|
|
}
|
2024-01-18 18:10:26 -06:00
|
|
|
} elseif { $_XTENSA_NUM_CORES > 1 } {
|
2022-07-10 19:35:50 -05:00
|
|
|
# JTAG direct (without DAP)
|
2024-01-18 18:10:26 -06:00
|
|
|
for {set i 0} {$i < $_XTENSA_NUM_CORES} {incr i} {
|
|
|
|
set _LCPUNAME $_CPU0NAME$i
|
|
|
|
set _LTAPNAME $_CHIPNAME.$_LCPUNAME
|
|
|
|
eval jtag newtap $_CHIPNAME $_LCPUNAME -irlen 5 $_CPUTAPARGLIST
|
|
|
|
target create $_LTAPNAME xtensa -chain-position $_LTAPNAME -coreid $i
|
|
|
|
|
|
|
|
$_LTAPNAME configure -event reset-assert-post { soft_reset_halt }
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
# JTAG direct (without DAP) - for legacy xtensa-config-XXX.cfg format
|
2022-07-10 19:35:50 -05:00
|
|
|
eval jtag newtap $_CHIPNAME $_CPU0NAME -irlen 5 $_CPUTAPARGLIST
|
|
|
|
target create $_TARGETNAME xtensa -chain-position $_TAPNAME
|
|
|
|
}
|
|
|
|
|
2024-01-18 18:10:26 -06:00
|
|
|
if { $_XTENSA_NUM_CORES == 1 } {
|
|
|
|
# DAP and single-core legacy JTAG
|
|
|
|
$_TARGETNAME configure -event reset-assert-post { soft_reset_halt }
|
|
|
|
}
|
2022-07-10 19:35:50 -05:00
|
|
|
|
|
|
|
gdb_report_register_access_error enable
|