target/armv7m_trace: Calculate prescaler for external capture devices
This fixes a regression introduced in "2dc88e1479f29ef0141b05bfcd907ad9a3e2d54c" Change-Id: I04dc19ed30118a4c499b83732700b2ee0fdb67b6 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5610 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
This commit is contained in:
committed by
Andreas Fritiofson
parent
11116ef6ad
commit
5a79481d3b
@@ -68,6 +68,22 @@ int armv7m_trace_tpiu_config(struct target *target)
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
|
||||
if (trace_config->config_type == TRACE_CONFIG_TYPE_EXTERNAL) {
|
||||
prescaler = trace_config->traceclkin_freq / trace_config->trace_freq;
|
||||
|
||||
if (trace_config->traceclkin_freq % trace_config->trace_freq) {
|
||||
prescaler++;
|
||||
|
||||
int trace_freq = trace_config->traceclkin_freq / prescaler;
|
||||
LOG_INFO("Can not obtain %u trace port frequency from %u "
|
||||
"TRACECLKIN frequency, using %u instead",
|
||||
trace_config->trace_freq, trace_config->traceclkin_freq,
|
||||
trace_freq);
|
||||
|
||||
trace_config->trace_freq = trace_freq;
|
||||
}
|
||||
}
|
||||
|
||||
if (!trace_config->trace_freq) {
|
||||
LOG_ERROR("Trace port frequency is 0, can't enable TPIU");
|
||||
return ERROR_FAIL;
|
||||
|
||||
Reference in New Issue
Block a user