From 71f92c94468f370be80ce60dd76d5d924ddba69a Mon Sep 17 00:00:00 2001 From: Tomas Vanek Date: Tue, 28 Jan 2025 20:43:33 +0100 Subject: [PATCH] target/cortex_m: call adapter_deassert_reset() only if srst is configured Deasserting is useless if reset was not asserted except the very corner case: changed reset_config during reset processing. Change-Id: I1d1ea142980d67293daa348a2869b68ffd78d0eb Signed-off-by: Tomas Vanek Reviewed-on: https://review.openocd.org/c/openocd/+/8734 Reviewed-by: Antonio Borneo Tested-by: jenkins --- src/target/cortex_m.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/target/cortex_m.c b/src/target/cortex_m.c index 2cea203a2..9314d6675 100644 --- a/src/target/cortex_m.c +++ b/src/target/cortex_m.c @@ -1849,11 +1849,13 @@ static int cortex_m_deassert_reset(struct target *target) target_state_name(target), target_was_examined(target) ? "" : " not"); - /* deassert reset lines */ - adapter_deassert_reset(); - enum reset_types jtag_reset_config = jtag_get_reset_config(); + /* deassert reset lines */ + if (jtag_reset_config & RESET_HAS_SRST) + adapter_deassert_reset(); + + if ((jtag_reset_config & RESET_HAS_SRST) && !(jtag_reset_config & RESET_SRST_NO_GATING) && armv7m->debug_ap) {