forked from auracaster/openocd
target: restructure dap support
- add 'dap create' command to create dap instances - move all dap subcmmand into the dap instance commands - keep 'dap info' for convenience - change all armv7 and armv8 targets to take a dap instance instead of a jtag chain position - restructure tap/dap/target relations, jtag tap no longer references the dap, daps are now independently created and initialized. - clean up swd connect - re-initialize DAP also on JTAG errors (e.g. after reset, power cycle) - update documentation - update target files Change-Id: I322cf3969b5407c25d1d3962f9d9b9bc1df067d9 Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com> Reviewed-on: http://openocd.zylin.com/4468 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
This commit is contained in:
committed by
Matthias Welwarsky
parent
7274090456
commit
2231da8ec4
@@ -2947,12 +2947,6 @@ static int cortex_a_examine_first(struct target *target)
|
||||
int retval = ERROR_OK;
|
||||
uint32_t didr, cpuid, dbg_osreg;
|
||||
|
||||
retval = dap_dp_init(swjdp);
|
||||
if (retval != ERROR_OK) {
|
||||
LOG_ERROR("Could not initialize the debug port");
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* Search for the APB-AP - it is needed for access to debug registers */
|
||||
retval = dap_find_ap(swjdp, AP_TYPE_APB_AP, &armv7a->debug_ap);
|
||||
if (retval != ERROR_OK) {
|
||||
@@ -3134,22 +3128,13 @@ static int cortex_a_init_target(struct command_context *cmd_ctx,
|
||||
}
|
||||
|
||||
static int cortex_a_init_arch_info(struct target *target,
|
||||
struct cortex_a_common *cortex_a, struct jtag_tap *tap)
|
||||
struct cortex_a_common *cortex_a, struct adiv5_dap *dap)
|
||||
{
|
||||
struct armv7a_common *armv7a = &cortex_a->armv7a_common;
|
||||
|
||||
/* Setup struct cortex_a_common */
|
||||
cortex_a->common_magic = CORTEX_A_COMMON_MAGIC;
|
||||
|
||||
/* tap has no dap initialized */
|
||||
if (!tap->dap) {
|
||||
tap->dap = dap_init();
|
||||
|
||||
/* Leave (only) generic DAP stuff for debugport_init() */
|
||||
tap->dap->tap = tap;
|
||||
}
|
||||
|
||||
armv7a->arm.dap = tap->dap;
|
||||
armv7a->arm.dap = dap;
|
||||
|
||||
cortex_a->fast_reg_read = 0;
|
||||
|
||||
@@ -3175,21 +3160,34 @@ static int cortex_a_init_arch_info(struct target *target,
|
||||
static int cortex_a_target_create(struct target *target, Jim_Interp *interp)
|
||||
{
|
||||
struct cortex_a_common *cortex_a = calloc(1, sizeof(struct cortex_a_common));
|
||||
cortex_a->common_magic = CORTEX_A_COMMON_MAGIC;
|
||||
struct adiv5_private_config *pc;
|
||||
|
||||
if (target->private_config == NULL)
|
||||
return ERROR_FAIL;
|
||||
|
||||
pc = (struct adiv5_private_config *)target->private_config;
|
||||
|
||||
cortex_a->armv7a_common.is_armv7r = false;
|
||||
|
||||
cortex_a->armv7a_common.arm.arm_vfp_version = ARM_VFP_V3;
|
||||
|
||||
return cortex_a_init_arch_info(target, cortex_a, target->tap);
|
||||
return cortex_a_init_arch_info(target, cortex_a, pc->dap);
|
||||
}
|
||||
|
||||
static int cortex_r4_target_create(struct target *target, Jim_Interp *interp)
|
||||
{
|
||||
struct cortex_a_common *cortex_a = calloc(1, sizeof(struct cortex_a_common));
|
||||
cortex_a->common_magic = CORTEX_A_COMMON_MAGIC;
|
||||
struct adiv5_private_config *pc;
|
||||
|
||||
pc = (struct adiv5_private_config *)target->private_config;
|
||||
if (adiv5_verify_config(pc) != ERROR_OK)
|
||||
return ERROR_FAIL;
|
||||
|
||||
cortex_a->armv7a_common.is_armv7r = true;
|
||||
|
||||
return cortex_a_init_arch_info(target, cortex_a, target->tap);
|
||||
return cortex_a_init_arch_info(target, cortex_a, pc->dap);
|
||||
}
|
||||
|
||||
static void cortex_a_deinit_target(struct target *target)
|
||||
@@ -3200,6 +3198,7 @@ static void cortex_a_deinit_target(struct target *target)
|
||||
free(cortex_a->brp_list);
|
||||
free(dpm->dbp);
|
||||
free(dpm->dwp);
|
||||
free(target->private_config);
|
||||
free(cortex_a);
|
||||
}
|
||||
|
||||
@@ -3484,6 +3483,7 @@ struct target_type cortexa_target = {
|
||||
|
||||
.commands = cortex_a_command_handlers,
|
||||
.target_create = cortex_a_target_create,
|
||||
.target_jim_configure = adiv5_jim_configure,
|
||||
.init_target = cortex_a_init_target,
|
||||
.examine = cortex_a_examine,
|
||||
.deinit_target = cortex_a_deinit_target,
|
||||
@@ -3516,9 +3516,6 @@ static const struct command_registration cortex_r4_command_handlers[] = {
|
||||
{
|
||||
.chain = arm_command_handlers,
|
||||
},
|
||||
{
|
||||
.chain = dap_command_handlers,
|
||||
},
|
||||
{
|
||||
.name = "cortex_r4",
|
||||
.mode = COMMAND_ANY,
|
||||
@@ -3562,6 +3559,7 @@ struct target_type cortexr4_target = {
|
||||
|
||||
.commands = cortex_r4_command_handlers,
|
||||
.target_create = cortex_r4_target_create,
|
||||
.target_jim_configure = adiv5_jim_configure,
|
||||
.init_target = cortex_a_init_target,
|
||||
.examine = cortex_a_examine,
|
||||
.deinit_target = cortex_a_deinit_target,
|
||||
|
||||
Reference in New Issue
Block a user