diff options
author | dbrownell <dbrownell@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2009-10-02 09:19:03 +0000 |
---|---|---|
committer | dbrownell <dbrownell@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2009-10-02 09:19:03 +0000 |
commit | 1033633321056d3e20c125e21d48723fc6f8705f (patch) | |
tree | 55c5f3c1bcbda447a3d2d3185c1603aa295d5abe /src/target/etm.c | |
parent | d340906476950dc62201009b6fb8aeb15b211b38 (diff) | |
download | riscv-openocd-1033633321056d3e20c125e21d48723fc6f8705f.zip riscv-openocd-1033633321056d3e20c125e21d48723fc6f8705f.tar.gz riscv-openocd-1033633321056d3e20c125e21d48723fc6f8705f.tar.bz2 |
Minor ETB and ETM bugfixes and doc updates
- ETB
* report _actual_ hardware status, not just expected status
* add a missing diagnostic on a potential ETB setup error
* prefix any diagnostics with "ETB"
- ETM
* make "etm status" show ETM hardware status too, instead of
just traceport status (which previously was fake, sigh)
- Docs
* flesh out "etm tracemode" docs a bit
* clarify "etm status" ... previously it was traceport status
* explain "etm trigger_percent" as a *traceport* option
ETM+ETB tracing still isn't behaving, but now I can see that part of
the reason is that the ETB turns itself off almost immediately after
being enabled, and before collecting any data.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2790 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/target/etm.c')
-rw-r--r-- | src/target/etm.c | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/src/target/etm.c b/src/target/etm.c index cb18b21..5a774f4 100644 --- a/src/target/etm.c +++ b/src/target/etm.c @@ -1567,6 +1567,7 @@ static int handle_etm_status_command(struct command_context_s *cmd_ctx, char *cm target_t *target; armv4_5_common_t *armv4_5; arm7_9_common_t *arm7_9; + etm_context_t *etm; trace_status_t trace_status; target = get_current_target(cmd_ctx); @@ -1582,28 +1583,56 @@ static int handle_etm_status_command(struct command_context_s *cmd_ctx, char *cm command_print(cmd_ctx, "current target doesn't have an ETM configured"); return ERROR_OK; } + etm = arm7_9->etm_ctx; - trace_status = arm7_9->etm_ctx->capture_driver->status(arm7_9->etm_ctx); + /* ETM status */ + if (etm->bcd_vers >= 0x11) { + reg_t *reg; + reg = etm_reg_lookup(etm, ETM_STATUS); + if (!reg) + return ERROR_OK; + if (etm_get_reg(reg) == ERROR_OK) { + unsigned s = buf_get_u32(reg->value, 0, reg->size); + + command_print(cmd_ctx, "etm: %s%s%s%s", + /* bit(1) == progbit */ + (etm->bcd_vers >= 0x12) + ? ((s & (1 << 1)) + ? "disabled" : "enabled") + : "?", + ((s & (1 << 3)) && etm->bcd_vers >= 0x31) + ? " triggered" : "", + ((s & (1 << 2)) && etm->bcd_vers >= 0x12) + ? " start/stop" : "", + ((s & (1 << 0)) && etm->bcd_vers >= 0x11) + ? " untraced-overflow" : ""); + } /* else ignore and try showing trace port status */ + } + + /* Trace Port Driver status */ + trace_status = etm->capture_driver->status(etm); if (trace_status == TRACE_IDLE) { - command_print(cmd_ctx, "tracing is idle"); + command_print(cmd_ctx, "%s: idle", etm->capture_driver->name); } else { static char *completed = " completed"; static char *running = " is running"; - static char *overflowed = ", trace overflowed"; - static char *triggered = ", trace triggered"; + static char *overflowed = ", overflowed"; + static char *triggered = ", triggered"; - command_print(cmd_ctx, "trace collection%s%s%s", + command_print(cmd_ctx, "%s: trace collection%s%s%s", + etm->capture_driver->name, (trace_status & TRACE_RUNNING) ? running : completed, (trace_status & TRACE_OVERFLOWED) ? overflowed : "", (trace_status & TRACE_TRIGGERED) ? triggered : ""); - if (arm7_9->etm_ctx->trace_depth > 0) + if (etm->trace_depth > 0) { - command_print(cmd_ctx, "%i frames of trace data read", (int)(arm7_9->etm_ctx->trace_depth)); + command_print(cmd_ctx, "%i frames of trace data read", + (int)(etm->trace_depth)); } } |