target/cortex_m: prevent asserting reset if examine is deferred

In a corner case when debug_ap is not available,
cortex_m_assert_reset() asserts reset to restore
communication with the target.

Prevent to do so on targets with defer_examine,
as such targets need some special handling to enable them
after reset anyway.

The change makes possible to handle a multicore Cortex-M SoC with
an auxiliary Cortex-M core(s) switched of by default
even with 'reset_config srst_gates_jtag'

Change-Id: I8cec7a816423e588d5e2e4f7904c81c776eddc42
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8097
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
Tomas Vanek 2024-01-21 10:15:07 +01:00 committed by Antonio Borneo
parent 0d3d4c981a
commit 3861699074
1 changed files with 2 additions and 1 deletions

View File

@ -1625,7 +1625,8 @@ static int cortex_m_assert_reset(struct target *target)
bool srst_asserted = false;
if ((jtag_reset_config & RESET_HAS_SRST) &&
((jtag_reset_config & RESET_SRST_NO_GATING) || !armv7m->debug_ap)) {
((jtag_reset_config & RESET_SRST_NO_GATING)
|| (!armv7m->debug_ap && !target->defer_examine))) {
/* If we have no debug_ap, asserting SRST is the only thing
* we can do now */
adapter_assert_reset();