From ea4f98046fe2f9d8362feadb50f058a9fff7ad4f Mon Sep 17 00:00:00 2001 From: Evgeniy Didin Date: Tue, 17 Mar 2020 14:06:24 +0300 Subject: [PATCH] target/arc: remove saving context during reset In arc_poll() function we handle the cases, when jtag indicates, that processor is halted, but target->state is not TARGET_HALTED. In case, when processor was halted and target->state was TARGET_RUNNING, we should save context. At the same time if target->state was TARGET_RESET we do not need to save context. Changes: 16.04: Fix - Move setting target->state = TARGET_HALT after "target->state == TARGET_RUNNIG" check, otherwise this check makes no sense Change-Id: I92ab6ec71cf58273bb8401d14a562035de3deab4 Signed-off-by: Evgeniy Didin Reviewed-on: http://openocd.zylin.com/5524 Tested-by: jenkins Reviewed-by: Oleksij Rempel --- src/target/arc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/target/arc.c b/src/target/arc.c index 244dd5247..823b9ed70 100644 --- a/src/target/arc.c +++ b/src/target/arc.c @@ -928,8 +928,10 @@ static int arc_poll(struct target *target) CHECK_RETVAL(arc_get_register_value(target, "status32", &value)); if (value & AUX_STATUS32_REG_HALT_BIT) { LOG_DEBUG("ARC core in halt or reset state."); + /* Save context if target was not in reset state */ + if (target->state == TARGET_RUNNING) + CHECK_RETVAL(arc_debug_entry(target)); target->state = TARGET_HALTED; - CHECK_RETVAL(arc_debug_entry(target)); CHECK_RETVAL(target_call_event_callbacks(target, TARGET_EVENT_HALTED)); } else { LOG_DEBUG("Discrepancy of STATUS32[0] HALT bit and ARC_JTAG_STAT_RU, "