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 <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8734
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
This commit is contained in:
Tomas Vanek 2025-01-28 20:43:33 +01:00 committed by Antonio Borneo
parent dcf02f46ff
commit 71f92c9446
1 changed files with 5 additions and 3 deletions

View File

@ -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) {