From: OpenOCD-Gerrit <ope...@us...> - 2020-06-18 09:11:53
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 5a79481d3b17c4134a43052cea9a7902bbf0accf (commit) from 11116ef6ad875055a43cf9af1f228991349f2ba1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5a79481d3b17c4134a43052cea9a7902bbf0accf Author: Marc Schink <de...@za...> Date: Sun Apr 26 19:28:15 2020 +0200 target/armv7m_trace: Calculate prescaler for external capture devices This fixes a regression introduced in "2dc88e1479f29ef0141b05bfcd907ad9a3e2d54c" Change-Id: I04dc19ed30118a4c499b83732700b2ee0fdb67b6 Signed-off-by: Marc Schink <de...@za...> Reviewed-on: http://openocd.zylin.com/5610 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <and...@gm...> diff --git a/src/jtag/drivers/jlink.c b/src/jtag/drivers/jlink.c index 80202ed29..1baf3454e 100644 --- a/src/jtag/drivers/jlink.c +++ b/src/jtag/drivers/jlink.c @@ -1324,18 +1324,16 @@ static int config_trace(bool enabled, enum tpiu_pin_protocol pin_protocol, uint32_t min_freq; uint32_t max_freq; + trace_enabled = enabled; + if (!jaylink_has_cap(caps, JAYLINK_DEV_CAP_SWO)) { - LOG_ERROR("Trace capturing is not supported by the device."); - return ERROR_FAIL; - } + if (!enabled) + return ERROR_OK; - if (pin_protocol != TPIU_PIN_PROTOCOL_ASYNC_UART) { - LOG_ERROR("Selected pin protocol is not supported."); + LOG_ERROR("Trace capturing is not supported by the device."); return ERROR_FAIL; } - trace_enabled = enabled; - ret = jaylink_swo_stop(devh); if (ret != JAYLINK_OK) { @@ -1354,6 +1352,11 @@ static int config_trace(bool enabled, enum tpiu_pin_protocol pin_protocol, return ERROR_OK; } + if (pin_protocol != TPIU_PIN_PROTOCOL_ASYNC_UART) { + LOG_ERROR("Selected pin protocol is not supported."); + return ERROR_FAIL; + } + buffer_size = calculate_trace_buffer_size(); if (!buffer_size) { diff --git a/src/target/armv7m_trace.c b/src/target/armv7m_trace.c index 853362f7e..6b368f7a0 100644 --- a/src/target/armv7m_trace.c +++ b/src/target/armv7m_trace.c @@ -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; ----------------------------------------------------------------------- Summary of changes: src/jtag/drivers/jlink.c | 17 ++++++++++------- src/target/armv7m_trace.c | 16 ++++++++++++++++ 2 files changed, 26 insertions(+), 7 deletions(-) hooks/post-receive -- Main OpenOCD repository |