From d594b42976e3b9640b64ef1cb2da3f74067930b8 Mon Sep 17 00:00:00 2001 From: Uwe Bonnes Date: Thu, 13 Jan 2022 12:06:13 +0100 Subject: [PATCH] Cortexm: With connect under reset, keep the device halted until attach. --- src/target/adiv5.c | 12 +++++++++--- src/target/cortexm.c | 2 -- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/target/adiv5.c b/src/target/adiv5.c index 4cc528fd..7d167093 100644 --- a/src/target/adiv5.c +++ b/src/target/adiv5.c @@ -834,9 +834,15 @@ void adiv5_dp_init(ADIv5_DP_t *dp) adiv5_ap_unref(ap); } /* We halted at least CortexM for Romtable scan. - * Release the devices now. Attach() will halt them again.*/ - for (target *t = target_list; t; t = t->next) - target_halt_resume(t, false); + * With connect under reset, keep the devices halted. + * Otherwise, release the devices now. + * Attach() will halt them again. + */ + for (target *t = target_list; t; t = t->next) { + if (!connect_assert_srst) { + target_halt_resume(t, false); + } + } adiv5_dp_unref(dp); } diff --git a/src/target/cortexm.c b/src/target/cortexm.c index f7ad4e0c..2288063e 100644 --- a/src/target/cortexm.c +++ b/src/target/cortexm.c @@ -471,8 +471,6 @@ bool cortexm_probe(ADIv5_AP_t *ap) PROBE(lpc17xx_probe); } #undef PROBE - /* Restart the CortexM we stopped for Romtable scan. Allow pure debug.*/ - target_halt_resume(t, 0); return true; }