From: OpenOCD-Gerrit <ope...@us...> - 2020-10-30 22:05: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 38277fa75280071fb4e851de291b0274a457cea1 (commit) via d05ef53cbd08972f89bd13e8ce2739de68965a05 (commit) from d3aa2d35363faeec4976b34fd5cb3127820ebc8d (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 38277fa75280071fb4e851de291b0274a457cea1 Author: Cliff L. Biffle <cl...@ox...puter> Date: Tue May 12 13:28:04 2020 -0700 jtag/drivers/stlink_usb: fix SWO prescaler The config_trace function has an out-parameter for generating the prescaler for the TPIU. The STLink implementation wasn't always writing it, causing the tpiu command to load uninitialized stack memory (minus one) into the TPIU's prescaler register when 'external' was requested. This change ensures that the out-parameter (and the other one, trace_freq, which hadn't caused any buggy behavior for me) are written every time. Signed-off-by: Cliff L. Biffle <cl...@ox...puter> Change-Id: I222975869b1aa49cc6b1963c79d5ea0f46522b8c Reviewed-on: http://openocd.zylin.com/5656 Tested-by: jenkins Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/src/jtag/drivers/stlink_usb.c b/src/jtag/drivers/stlink_usb.c index ce55b94a5..bfc27f2aa 100644 --- a/src/jtag/drivers/stlink_usb.c +++ b/src/jtag/drivers/stlink_usb.c @@ -2996,12 +2996,8 @@ int stlink_config_trace(void *handle, bool enabled, return ERROR_FAIL; } - if (!enabled) { - stlink_usb_trace_disable(h); - return ERROR_OK; - } - - if (*trace_freq > STLINK_TRACE_MAX_HZ) { + /* Only concern ourselves with the frequency if the STlink is processing it. */ + if (enabled && *trace_freq > STLINK_TRACE_MAX_HZ) { LOG_ERROR("ST-LINK doesn't support SWO frequency higher than %u", STLINK_TRACE_MAX_HZ); return ERROR_FAIL; @@ -3024,6 +3020,10 @@ int stlink_config_trace(void *handle, bool enabled, } *prescaler = presc; + + if (!enabled) + return ERROR_OK; + h->trace.source_hz = *trace_freq; return stlink_usb_trace_enable(h); commit d05ef53cbd08972f89bd13e8ce2739de68965a05 Author: Christopher Head <ch...@za...> Date: Fri Jun 14 15:35:31 2019 -0700 target: restore last run state after profiling Now that itâs possible to start profiling from either a running or a halted state, rather than unconditionally halting after profiling finishes, it makes more sense to restore the processor to whatever state (running or halted) it was in before profiling started. Change-Id: If6f6e70a1a365c1ce3b348a306c435c220b8bf12 Signed-off-by: Christopher Head <ch...@za...> Reviewed-on: http://openocd.zylin.com/5237 Tested-by: jenkins Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/src/target/target.c b/src/target/target.c index e64004fe5..53d3e82d7 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -4097,6 +4097,7 @@ COMMAND_HANDLER(handle_profile_command) uint32_t offset; uint32_t num_of_samples; int retval = ERROR_OK; + bool halted_before_profiling = target->state == TARGET_HALTED; COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], offset); @@ -4127,12 +4128,23 @@ COMMAND_HANDLER(handle_profile_command) free(samples); return retval; } - if (target->state == TARGET_RUNNING) { + + if (target->state == TARGET_RUNNING && halted_before_profiling) { + /* The target was halted before we started and is running now. Halt it, + * for consistency. */ retval = target_halt(target); if (retval != ERROR_OK) { free(samples); return retval; } + } else if (target->state == TARGET_HALTED && !halted_before_profiling) { + /* The target was running before we started and is halted now. Resume + * it, for consistency. */ + retval = target_resume(target, 1, 0, 0, 0); + if (retval != ERROR_OK) { + free(samples); + return retval; + } } retval = target_poll(target); ----------------------------------------------------------------------- Summary of changes: src/jtag/drivers/stlink_usb.c | 12 ++++++------ src/target/target.c | 14 +++++++++++++- 2 files changed, 19 insertions(+), 7 deletions(-) hooks/post-receive -- Main OpenOCD repository |