tcl/target/nrf52: Configure trace port speed

Configure the TRACECONFIG.TRACEPORTSPEED register depending on the
trace clock speed. Also catch invalid trace clock speeds.

Change-Id: I1ece1cc59da539732d2d71f296fd55799c195387
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8256
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
This commit is contained in:
Marc Schink 2024-05-05 15:28:20 +02:00 committed by Antonio Borneo
parent 1a00c67e10
commit edb14a02e9
1 changed files with 20 additions and 0 deletions

View File

@ -131,6 +131,26 @@ proc _proc_pre_enable_$_CHIPNAME.tpiu {_targetname _chipname} {
0x52840 -
0x52833 -
0x52832 {
# Configuration values for all supported trace port speeds, see
# TRACECONFIG.TRACEPORTSPEED
set trace_port_speeds {
32000000 0
16000000 1
8000000 2
4000000 3
}
# Note that trace port clock stands for what is referred to as
# TRACECLKIN in the Arm CoreSight documentation.
set trace_port_clock [$_chipname.tpiu cget -traceclk]
if { ![dict exists $trace_port_speeds $trace_port_clock] } {
error "Trace clock speed is not supported"
}
# Set TRACECONFIG.TRACEPORTSPEED
mmw 0x4000055C [dict get $trace_port_speeds $trace_port_clock] 0x3
if { [$_chipname.tpiu cget -protocol] eq "sync" } {
if { [$_chipname.tpiu cget -port-width] != 4 } {
error "Device only supports 4-bit sync traces"