This is an automated email from Gerrit. Eric Katzfey ([email protected]) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/3704
-- gerrit commit 6eae0e747e1e9cf7d2829dc8d66c6a9d4365da31 Author: Eric Katzfey <[email protected]> Date: Wed Aug 17 15:32:56 2016 -0700 cortex_m: Added the ability to configure the AP number The AP number is normally autodetected. However, there are some Qualcomm devices that have multiple AP and the autodetection will fail for the Cortex-M. This new option allows the AP number to be specified in the target command. This option only affects Cortex-M. Change-Id: I94ce9cc3a75fc58a104310214b5a9764c36c5fb1 Signed-off-by: Eric Katzfey <[email protected]> diff --git a/src/target/cortex_m.c b/src/target/cortex_m.c index a6a9309..b0d298a 100644 --- a/src/target/cortex_m.c +++ b/src/target/cortex_m.c @@ -1898,11 +1898,19 @@ int cortex_m_examine(struct target *target) return retval; } - /* Search for the MEM-AP */ - retval = dap_find_ap(swjdp, AP_TYPE_AHB_AP, &armv7m->debug_ap); - if (retval != ERROR_OK) { - LOG_ERROR("Could not find MEM-AP to control the core"); - return retval; + /* Search for the MEM-AP if location wasn't configured */ + if (target->ap_num == -1) { + retval = dap_find_ap(swjdp, + AP_TYPE_AHB_AP, + &armv7m->debug_ap); + if (retval != ERROR_OK) { + LOG_ERROR("Could not find MEM-AP to control the core"); + return retval; + } else { + target->ap_num = armv7m->debug_ap->ap_num; + } + } else { + armv7m->debug_ap = &swjdp->ap[target->ap_num]; } /* Leave (only) generic DAP stuff for debugport_init(); */ diff --git a/src/target/target.c b/src/target/target.c index 56d9eee..bbc302d 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -4323,6 +4323,7 @@ enum target_cfg_param { TCFG_CHAIN_POSITION, TCFG_DBGBASE, TCFG_RTOS, + TCFG_AP_NUM, }; static Jim_Nvp nvp_config_opts[] = { @@ -4337,6 +4338,7 @@ static Jim_Nvp nvp_config_opts[] = { { .name = "-chain-position", .value = TCFG_CHAIN_POSITION }, { .name = "-dbgbase", .value = TCFG_DBGBASE }, { .name = "-rtos", .value = TCFG_RTOS }, + { .name = "-ap-num", .value = TCFG_AP_NUM }, { .name = NULL, .value = -1 } }; @@ -4611,6 +4613,20 @@ no_params: } /* loop for more */ break; + case TCFG_AP_NUM: + /* Configure AP number so that it doesn't have to be detected */ + if (goi->isconfigure) { + e = Jim_GetOpt_Wide(goi, &w); + if (e != JIM_OK) + return e; + target->ap_num = (int)w; + } else { + if (goi->argc != 0) + goto no_params; + } + Jim_SetResult(goi->interp, Jim_NewIntObj(goi->interp, target->ap_num)); + /* loop for more */ + break; } } /* while (goi->argc) */ @@ -5340,6 +5356,8 @@ static int target_create(Jim_GetOptInfo *goi) target->rtos = NULL; target->rtos_auto_detect = false; + target->ap_num = -1; + /* Do the rest as "configure" options */ goi->isconfigure = 1; e = target_configure(goi, target); diff --git a/src/target/target.h b/src/target/target.h index 0cee117..5d61334 100644 --- a/src/target/target.h +++ b/src/target/target.h @@ -186,6 +186,7 @@ struct target { * and must be detected when symbols are offered */ struct backoff_timer backoff; int smp; /* add some target attributes for smp support */ + int ap_num; /* Which AP in a DAP */ struct target_list *head; /* the gdb service is there in case of smp, we have only one gdb server * for all smp target -- ------------------------------------------------------------------------------ _______________________________________________ OpenOCD-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openocd-devel
