X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Ftarget%2Fcortex_m.c;fp=src%2Ftarget%2Fcortex_m.c;h=63603da395923d4e7a9baa329f456c8bba4f85b6;hp=ed9397aef0f6e0ff714d168fb91036f3b3411f5c;hb=0d47d85ff5d3c8512d2475097ef8356267c57cda;hpb=1f1558e74bd14ba633c49916ac1d0e1867cad4f1 diff --git a/src/target/cortex_m.c b/src/target/cortex_m.c index ed9397aef0..63603da395 100644 --- a/src/target/cortex_m.c +++ b/src/target/cortex_m.c @@ -2093,6 +2093,15 @@ static void cortex_m_dwt_free(struct target *target) #define MVFR1_DEFAULT_M7_SP 0x11000011 #define MVFR1_DEFAULT_M7_DP 0x12000011 +static int cortex_m_find_mem_ap(struct adiv5_dap *swjdp, + struct adiv5_ap **debug_ap) +{ + if (dap_find_ap(swjdp, AP_TYPE_AHB3_AP, debug_ap) == ERROR_OK) + return ERROR_OK; + + return dap_find_ap(swjdp, AP_TYPE_AHB5_AP, debug_ap); +} + int cortex_m_examine(struct target *target) { int retval; @@ -2107,7 +2116,7 @@ int cortex_m_examine(struct target *target) if (!armv7m->stlink) { if (cortex_m->apsel == DP_APSEL_INVALID) { /* Search for the MEM-AP */ - retval = dap_find_ap(swjdp, AP_TYPE_AHB3_AP, &armv7m->debug_ap); + retval = cortex_m_find_mem_ap(swjdp, &armv7m->debug_ap); if (retval != ERROR_OK) { LOG_ERROR("Could not find MEM-AP to control the core"); return retval;