aboutsummaryrefslogtreecommitdiff
path: root/tcl/target/nrf52.cfg
diff options
context:
space:
mode:
Diffstat (limited to 'tcl/target/nrf52.cfg')
-rw-r--r--tcl/target/nrf52.cfg29
1 files changed, 23 insertions, 6 deletions
diff --git a/tcl/target/nrf52.cfg b/tcl/target/nrf52.cfg
index 0c82c57..0703b18 100644
--- a/tcl/target/nrf52.cfg
+++ b/tcl/target/nrf52.cfg
@@ -131,10 +131,29 @@ 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 } {
- echo "Error. Device only supports 4-bit sync traces."
- return
+ error "Device only supports 4-bit sync traces"
}
# Set TRACECONFIG.TRACEMUX to enable synchronous trace
@@ -154,12 +173,10 @@ proc _proc_pre_enable_$_CHIPNAME.tpiu {_targetname _chipname} {
0x52811 -
0x52810 -
0x52805 {
- echo "Error: Device does not support TPIU"
- return
+ error "Device does not support TPIU"
}
default {
- echo "Error: Unknown device"
- return
+ error "Unknown device, cannot configure TPIU"
}
}
}