Improve ETM tracemode update command.
This commit is contained in:
parent
d660721ba8
commit
4189fdad28
|
@ -1155,48 +1155,21 @@ static int etmv1_analyze_trace(etm_context_t *ctx, struct command_context_s *cmd
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int handle_etm_tracemode_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
|
static int handle_etm_tracemode_command_update(
|
||||||
|
struct command_context_s *cmd_ctx,
|
||||||
|
char **args, etmv1_tracemode_t *mode)
|
||||||
{
|
{
|
||||||
target_t *target;
|
|
||||||
armv4_5_common_t *armv4_5;
|
|
||||||
arm7_9_common_t *arm7_9;
|
|
||||||
etmv1_tracemode_t tracemode;
|
etmv1_tracemode_t tracemode;
|
||||||
|
|
||||||
target = get_current_target(cmd_ctx);
|
|
||||||
|
|
||||||
if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK)
|
|
||||||
{
|
|
||||||
command_print(cmd_ctx, "current target isn't an ARM7/ARM9 target");
|
|
||||||
return ERROR_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!arm7_9->etm_ctx)
|
|
||||||
{
|
|
||||||
command_print(cmd_ctx, "current target doesn't have an ETM configured");
|
|
||||||
return ERROR_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
tracemode = arm7_9->etm_ctx->tracemode;
|
|
||||||
|
|
||||||
if (argc == 4)
|
|
||||||
{
|
|
||||||
/* what parts of data access are traced? */
|
/* what parts of data access are traced? */
|
||||||
if (strcmp(args[0], "none") == 0)
|
if (strcmp(args[0], "none") == 0)
|
||||||
{
|
|
||||||
tracemode = ETMV1_TRACE_NONE;
|
tracemode = ETMV1_TRACE_NONE;
|
||||||
}
|
|
||||||
else if (strcmp(args[0], "data") == 0)
|
else if (strcmp(args[0], "data") == 0)
|
||||||
{
|
|
||||||
tracemode = ETMV1_TRACE_DATA;
|
tracemode = ETMV1_TRACE_DATA;
|
||||||
}
|
|
||||||
else if (strcmp(args[0], "address") == 0)
|
else if (strcmp(args[0], "address") == 0)
|
||||||
{
|
|
||||||
tracemode = ETMV1_TRACE_ADDR;
|
tracemode = ETMV1_TRACE_ADDR;
|
||||||
}
|
|
||||||
else if (strcmp(args[0], "all") == 0)
|
else if (strcmp(args[0], "all") == 0)
|
||||||
{
|
|
||||||
tracemode = ETMV1_TRACE_DATA | ETMV1_TRACE_ADDR;
|
tracemode = ETMV1_TRACE_DATA | ETMV1_TRACE_ADDR;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
command_print(cmd_ctx, "invalid option '%s'", args[0]);
|
command_print(cmd_ctx, "invalid option '%s'", args[0]);
|
||||||
|
@ -1225,13 +1198,9 @@ static int handle_etm_tracemode_command(struct command_context_s *cmd_ctx, char
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(args[2], "enable") == 0)
|
if (strcmp(args[2], "enable") == 0)
|
||||||
{
|
|
||||||
tracemode |= ETMV1_CYCLE_ACCURATE;
|
tracemode |= ETMV1_CYCLE_ACCURATE;
|
||||||
}
|
|
||||||
else if (strcmp(args[2], "disable") == 0)
|
else if (strcmp(args[2], "disable") == 0)
|
||||||
{
|
|
||||||
tracemode |= 0;
|
tracemode |= 0;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
command_print(cmd_ctx, "invalid option '%s'", args[2]);
|
command_print(cmd_ctx, "invalid option '%s'", args[2]);
|
||||||
|
@ -1239,16 +1208,12 @@ static int handle_etm_tracemode_command(struct command_context_s *cmd_ctx, char
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(args[3], "enable") == 0)
|
if (strcmp(args[3], "enable") == 0)
|
||||||
{
|
|
||||||
tracemode |= ETMV1_BRANCH_OUTPUT;
|
tracemode |= ETMV1_BRANCH_OUTPUT;
|
||||||
}
|
|
||||||
else if (strcmp(args[3], "disable") == 0)
|
else if (strcmp(args[3], "disable") == 0)
|
||||||
{
|
|
||||||
tracemode |= 0;
|
tracemode |= 0;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
command_print(cmd_ctx, "invalid option '%s'", args[2]);
|
command_print(cmd_ctx, "invalid option '%s'", args[3]);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1257,10 +1222,41 @@ static int handle_etm_tracemode_command(struct command_context_s *cmd_ctx, char
|
||||||
* - debug request (causes debug entry on trigger)
|
* - debug request (causes debug entry on trigger)
|
||||||
* - stall on FIFOFULL (preventing tracedata lossage)
|
* - stall on FIFOFULL (preventing tracedata lossage)
|
||||||
*/
|
*/
|
||||||
}
|
*mode = tracemode;
|
||||||
else if (argc != 0)
|
|
||||||
|
return ERROR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int handle_etm_tracemode_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
|
||||||
|
{
|
||||||
|
target_t *target = get_current_target(cmd_ctx);
|
||||||
|
|
||||||
|
armv4_5_common_t *armv4_5;
|
||||||
|
arm7_9_common_t *arm7_9;
|
||||||
|
if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK)
|
||||||
{
|
{
|
||||||
command_print(cmd_ctx, "usage: configure trace mode <none | data | address | all> <context id bits> <cycle accurate> <branch output>");
|
command_print(cmd_ctx, "current target isn't an ARM7/ARM9 target");
|
||||||
|
return ERROR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!arm7_9->etm_ctx)
|
||||||
|
{
|
||||||
|
command_print(cmd_ctx, "current target doesn't have an ETM configured");
|
||||||
|
return ERROR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
etmv1_tracemode_t tracemode = arm7_9->etm_ctx->tracemode;
|
||||||
|
switch (argc)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
handle_etm_tracemode_command_update(cmd_ctx, args, &tracemode);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
command_print(cmd_ctx, "usage: configure trace mode "
|
||||||
|
"<none | data | address | all> "
|
||||||
|
"<context id bits> <cycle accurate> <branch output>");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue