This is an automated email from Gerrit.
"Daniel Goehring <dgo...@os...>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/9264
-- gerrit
commit 5a04b064ed6566f52a349a4c9465631f2ac7c398
Author: Daniel Goehring <dgo...@os...>
Date: Mon Jul 14 19:29:24 2025 -0600
target/arm: add nested AP Cortex M target support
For the Cortex M processor target, add nested AP support.
Change-Id: I624e3c0dfa899968ebca06b3b0d0d963fc0f9828
Signed-off-by: Daniel Goehring <dgo...@os...>
diff --git a/src/target/cortex_m.c b/src/target/cortex_m.c
index 9f0b6284b0..a01ce2a3ee 100644
--- a/src/target/cortex_m.c
+++ b/src/target/cortex_m.c
@@ -2775,7 +2775,11 @@ int cortex_m_examine(struct target *target)
return retval;
}
} else {
- armv7m->debug_ap = dap_get_ap(swjdp, cortex_m->apsel);
+ if (cortex_m->apsel_gateway == DP_APSEL_INVALID)
+ armv7m->debug_ap = dap_get_ap(swjdp, cortex_m->apsel);
+ else
+ armv7m->debug_ap = dap_get_ap_gateway(swjdp, cortex_m->apsel, cortex_m->apsel_gateway);
+
if (!armv7m->debug_ap) {
LOG_TARGET_ERROR(target, "Cannot get AP");
return ERROR_FAIL;
@@ -3147,6 +3151,7 @@ static int cortex_m_target_create(struct target *target)
cortex_m->common_magic = CORTEX_M_COMMON_MAGIC;
cortex_m->apsel = pc->ap_num;
+ cortex_m->apsel_gateway = pc->ap_num_gateway;
cortex_m_init_arch_info(target, cortex_m, pc->dap);
diff --git a/src/target/cortex_m.h b/src/target/cortex_m.h
index 615369f344..1588ddee00 100644
--- a/src/target/cortex_m.h
+++ b/src/target/cortex_m.h
@@ -304,6 +304,7 @@ struct cortex_m_common {
bool slow_register_read; /* A register has not been ready, poll S_REGRDY */
uint64_t apsel;
+ uint64_t apsel_gateway;
/* Whether this target has the erratum that makes C_MASKINTS not apply to
* already pending interrupts */
--
|