target/arc: Introduce Actionpoints support

Actionpoint mechanism allows to setup HW breakpoints and watchpoints on Synopsys ARC CPUs.
This mechanism is controlled by DEBUG register and by a set of auxilary registers.
Each actionpoint is controlled by 3 aux registers: Actionpoint(AP) match mask(AP_AMM),
AP match value(AP_AMV) and AP control(AC).

Note: some fields of actionpoint_t structure will be used in further
support of watchpoints.

Change-Id: I4efb24675f247cc19d9122501c9e63c3126fcab4
Signed-off-by: Evgeniy Didin <didin@synopsys.com>
Reviewed-on: http://openocd.zylin.com/5763
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
Evgeniy Didin
2020-07-10 14:52:35 +03:00
committed by Antonio Borneo
parent 07df04b3b1
commit 8fea8460db
4 changed files with 418 additions and 9 deletions

View File

@@ -929,6 +929,50 @@ COMMAND_HANDLER(arc_l2_cache_disable_auto_cmd)
&arc->has_l2cache, "target has l2 cache enabled");
}
static int jim_handle_actionpoints_num(Jim_Interp *interp, int argc,
Jim_Obj * const *argv)
{
Jim_GetOptInfo goi;
Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1);
LOG_DEBUG("-");
if (goi.argc >= 2) {
Jim_WrongNumArgs(interp, goi.argc, goi.argv, "[<unsigned integer>]");
return JIM_ERR;
}
struct command_context *context = current_command_context(interp);
assert(context);
struct target *target = get_current_target(context);
if (!target) {
Jim_SetResultFormatted(goi.interp, "No current target");
return JIM_ERR;
}
struct arc_common *arc = target_to_arc(target);
/* It is not possible to pass &arc->actionpoints_num directly to
* handle_command_parse_uint, because this value should be valid during
* "actionpoint reset, initiated by arc_set_actionpoints_num. */
uint32_t ap_num = arc->actionpoints_num;
if (goi.argc == 1) {
JIM_CHECK_RETVAL(arc_cmd_jim_get_uint32(&goi, &ap_num));
int e = arc_set_actionpoints_num(target, ap_num);
if (e != ERROR_OK) {
Jim_SetResultFormatted(goi.interp,
"Failed to set number of actionpoints");
return JIM_ERR;
}
}
Jim_SetResultInt(interp, ap_num);
return JIM_OK;
}
/* ----- Exported target commands ------------------------------------------ */
const struct command_registration arc_l2_cache_group_handlers[] = {
@@ -1024,6 +1068,13 @@ static const struct command_registration arc_core_command_handlers[] = {
.usage = "",
.chain = arc_cache_group_handlers,
},
{
.name = "num-actionpoints",
.jim_handler = jim_handle_actionpoints_num,
.mode = COMMAND_ANY,
.usage = "[<unsigned integer>]",
.help = "Prints or sets amount of actionpoints in the processor.",
},
COMMAND_REGISTRATION_DONE
};