+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
/***************************************************************************
* Copyright (C) 2005 by Dominic Rath *
* Dominic.Rath@gmx.de *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
***************************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include "register.h"
#include "etm_dummy.h"
-#if BUILD_OOCD_TRACE == 1
-#include "oocd_trace.h"
-#endif
-
-
/*
* ARM "Embedded Trace Macrocell" (ETM) support -- direct JTAG access.
*
reg->name = r->name;
reg->size = r->size;
- reg->value = &ereg->value;
+ reg->value = ereg->value;
reg->arch_info = ereg;
reg->type = &etm_scan6_type;
reg++;
reg_list = calloc(128, sizeof(struct reg));
arch_info = calloc(128, sizeof(struct etm_reg));
+ if (!reg_cache || !reg_list || !arch_info) {
+ LOG_ERROR("No memory");
+ goto fail;
+ }
+
/* fill in values for the reg cache */
reg_cache->name = "etm registers";
reg_cache->next = NULL;
uint8_t *check_value, uint8_t *check_mask)
{
struct etm_reg *etm_reg = reg->arch_info;
+ assert(etm_reg);
const struct etm_reg_info *r = etm_reg->reg_info;
uint8_t reg_addr = r->addr & 0x7f;
struct scan_field fields[3];
fields[0].check_mask = NULL;
fields[1].num_bits = 7;
- uint8_t temp1;
+ uint8_t temp1 = 0;
fields[1].out_value = &temp1;
buf_set_u32(&temp1, 0, 7, reg_addr);
fields[1].in_value = NULL;
fields[1].check_mask = NULL;
fields[2].num_bits = 1;
- uint8_t temp2;
+ uint8_t temp2 = 0;
fields[2].out_value = &temp2;
buf_set_u32(&temp2, 0, 1, 0);
fields[2].in_value = NULL;
fields[0].in_value = NULL;
fields[1].num_bits = 7;
- uint8_t tmp2;
+ uint8_t tmp2 = 0;
fields[1].out_value = &tmp2;
buf_set_u32(&tmp2, 0, 7, reg_addr);
fields[1].in_value = NULL;
fields[2].num_bits = 1;
- uint8_t tmp3;
+ uint8_t tmp3 = 0;
fields[2].out_value = &tmp3;
buf_set_u32(&tmp3, 0, 1, 1);
fields[2].in_value = NULL;
static struct etm_capture_driver *etm_capture_drivers[] = {
&etb_capture_driver,
&etm_dummy_capture_driver,
-#if BUILD_OOCD_TRACE == 1
- &oocd_trace_capture_driver,
-#endif
NULL
};
static int etm_read_instruction(struct etm_context *ctx, struct arm_instruction *instruction)
{
- int i;
int section = -1;
size_t size_read;
uint32_t opcode;
return ERROR_TRACE_IMAGE_UNAVAILABLE;
/* search for the section the current instruction belongs to */
- for (i = 0; i < ctx->image->num_sections; i++) {
+ for (unsigned int i = 0; i < ctx->image->num_sections; i++) {
if ((ctx->image->sections[i].base_address <= ctx->current_pc) &&
(ctx->image->sections[i].base_address + ctx->image->sections[i].size >
ctx->current_pc)) {
return 0;
}
-static int etmv1_analyze_trace(struct etm_context *ctx, struct command_context *cmd_ctx)
+static int etmv1_analyze_trace(struct etm_context *ctx, struct command_invocation *cmd)
{
int retval;
struct arm_instruction instruction;
ctx->capture_driver->read_trace(ctx);
if (ctx->trace_depth == 0) {
- command_print(cmd_ctx, "Trace is empty.");
+ command_print(cmd, "Trace is empty.");
return ERROR_OK;
}
int current_pc_ok = ctx->pc_ok;
if (ctx->trace_data[ctx->pipe_index].flags & ETMV1_TRIGGER_CYCLE)
- command_print(cmd_ctx, "--- trigger ---");
+ command_print(cmd, "--- trigger ---");
/* instructions execute in IE/D or BE/D cycles */
if ((pipestat == STAT_IE) || (pipestat == STAT_ID))
next_pc = ctx->last_branch;
break;
case 0x1: /* tracing enabled */
- command_print(cmd_ctx,
+ command_print(cmd,
"--- tracing enabled at 0x%8.8" PRIx32 " ---",
ctx->last_branch);
ctx->current_pc = ctx->last_branch;
continue;
break;
case 0x2: /* trace restarted after FIFO overflow */
- command_print(cmd_ctx,
+ command_print(cmd,
"--- trace restarted after FIFO overflow at 0x%8.8" PRIx32 " ---",
ctx->last_branch);
ctx->current_pc = ctx->last_branch;
continue;
break;
case 0x3: /* exit from debug state */
- command_print(cmd_ctx,
+ command_print(cmd,
"--- exit from debug state at 0x%8.8" PRIx32 " ---",
ctx->last_branch);
ctx->current_pc = ctx->last_branch;
* we have to move on with the next trace cycle
*/
if (!current_pc_ok) {
- command_print(cmd_ctx,
+ command_print(cmd,
"--- periodic synchronization point at 0x%8.8" PRIx32 " ---",
next_pc);
ctx->current_pc = next_pc;
|| ((ctx->last_branch >= 0xffff0000) &&
(ctx->last_branch <= 0xffff0020))) {
if ((ctx->last_branch & 0xff) == 0x10)
- command_print(cmd_ctx, "data abort");
+ command_print(cmd, "data abort");
else {
- command_print(cmd_ctx,
+ command_print(cmd,
"exception vector 0x%2.2" PRIx32 "",
ctx->last_branch);
ctx->current_pc = ctx->last_branch;
ctx->ptr_ok = 1;
if (ctx->ptr_ok)
- command_print(cmd_ctx,
+ command_print(cmd,
"address: 0x%8.8" PRIx32 "",
ctx->last_ptr);
}
(instruction.type == ARM_STM)) {
int i;
for (i = 0; i < 16; i++) {
- if (instruction.info.load_store_multiple.
- register_list & (1 << i)) {
+ if (instruction.info.load_store_multiple.register_list
+ & (1 << i)) {
uint32_t data;
if (etmv1_data(ctx, 4, &data) != 0)
return ERROR_ETM_ANALYSIS_FAILED;
- command_print(cmd_ctx,
+ command_print(cmd,
"data: 0x%8.8" PRIx32 "",
data);
}
if (etmv1_data(ctx, arm_access_size(&instruction),
&data) != 0)
return ERROR_ETM_ANALYSIS_FAILED;
- command_print(cmd_ctx, "data: 0x%8.8" PRIx32 "", data);
+ command_print(cmd, "data: 0x%8.8" PRIx32 "", data);
}
}
(cycles == 1) ? "cycle" : "cycles");
}
- command_print(cmd_ctx, "%s%s%s",
+ command_print(cmd, "%s%s%s",
instruction.text,
(pipestat == STAT_IN) ? " (not executed)" : "",
cycles_text);
else if (strcmp(CMD_ARGV[0], "all") == 0)
tracemode = ETM_CTRL_TRACE_DATA | ETM_CTRL_TRACE_ADDR;
else {
- command_print(CMD_CTX, "invalid option '%s'", CMD_ARGV[0]);
+ command_print(CMD, "invalid option '%s'", CMD_ARGV[0]);
return ERROR_COMMAND_SYNTAX_ERROR;
}
tracemode |= ETM_CTRL_CONTEXTID_32;
break;
default:
- command_print(CMD_CTX, "invalid option '%s'", CMD_ARGV[1]);
+ command_print(CMD, "invalid option '%s'", CMD_ARGV[1]);
return ERROR_COMMAND_SYNTAX_ERROR;
}
struct etm_context *etm;
if (!is_arm(arm)) {
- command_print(CMD_CTX, "ETM: current target isn't an ARM");
+ command_print(CMD, "ETM: current target isn't an ARM");
return ERROR_FAIL;
}
etm = arm->etm;
if (!etm) {
- command_print(CMD_CTX, "current target doesn't have an ETM configured");
+ command_print(CMD, "current target doesn't have an ETM configured");
return ERROR_FAIL;
}
* or couldn't be written; display actual hardware state...
*/
- command_print(CMD_CTX, "current tracemode configuration:");
+ command_print(CMD, "current tracemode configuration:");
switch (tracemode & ETM_CTRL_TRACE_MASK) {
default:
- command_print(CMD_CTX, "data tracing: none");
+ command_print(CMD, "data tracing: none");
break;
case ETM_CTRL_TRACE_DATA:
- command_print(CMD_CTX, "data tracing: data only");
+ command_print(CMD, "data tracing: data only");
break;
case ETM_CTRL_TRACE_ADDR:
- command_print(CMD_CTX, "data tracing: address only");
+ command_print(CMD, "data tracing: address only");
break;
case ETM_CTRL_TRACE_DATA | ETM_CTRL_TRACE_ADDR:
- command_print(CMD_CTX, "data tracing: address and data");
+ command_print(CMD, "data tracing: address and data");
break;
}
switch (tracemode & ETM_CTRL_CONTEXTID_MASK) {
case ETM_CTRL_CONTEXTID_NONE:
- command_print(CMD_CTX, "contextid tracing: none");
+ command_print(CMD, "contextid tracing: none");
break;
case ETM_CTRL_CONTEXTID_8:
- command_print(CMD_CTX, "contextid tracing: 8 bit");
+ command_print(CMD, "contextid tracing: 8 bit");
break;
case ETM_CTRL_CONTEXTID_16:
- command_print(CMD_CTX, "contextid tracing: 16 bit");
+ command_print(CMD, "contextid tracing: 16 bit");
break;
case ETM_CTRL_CONTEXTID_32:
- command_print(CMD_CTX, "contextid tracing: 32 bit");
+ command_print(CMD, "contextid tracing: 32 bit");
break;
}
if (tracemode & ETM_CTRL_CYCLE_ACCURATE)
- command_print(CMD_CTX, "cycle-accurate tracing enabled");
+ command_print(CMD, "cycle-accurate tracing enabled");
else
- command_print(CMD_CTX, "cycle-accurate tracing disabled");
+ command_print(CMD, "cycle-accurate tracing disabled");
if (tracemode & ETM_CTRL_BRANCH_OUTPUT)
- command_print(CMD_CTX, "full branch address output enabled");
+ command_print(CMD, "full branch address output enabled");
else
- command_print(CMD_CTX, "full branch address output disabled");
+ command_print(CMD, "full branch address output disabled");
#define TRACEMODE_MASK ( \
ETM_CTRL_CONTEXTID_MASK \
arm = target_to_arm(target);
if (!is_arm(arm)) {
- command_print(CMD_CTX, "target '%s' is '%s'; not an ARM",
+ command_print(CMD, "target '%s' is '%s'; not an ARM",
target_name(target),
target_type_name(target));
return ERROR_FAIL;
portmode |= ETM_PORT_2BIT;
break;
default:
- command_print(CMD_CTX,
+ command_print(CMD,
"unsupported ETM port width '%s'", CMD_ARGV[1]);
return ERROR_FAIL;
}
else if (strcmp("demultiplexed", CMD_ARGV[2]) == 0)
portmode |= ETM_PORT_DEMUXED;
else {
- command_print(CMD_CTX,
+ command_print(CMD,
"unsupported ETM port mode '%s', must be 'normal', 'multiplexed' or 'demultiplexed'",
CMD_ARGV[2]);
return ERROR_FAIL;
else if (strcmp("full", CMD_ARGV[3]) == 0)
portmode |= ETM_PORT_FULL_CLOCK;
else {
- command_print(CMD_CTX,
+ command_print(CMD,
"unsupported ETM port clocking '%s', must be 'full' or 'half'",
CMD_ARGV[3]);
return ERROR_FAIL;
for (i = 0; etm_capture_drivers[i]; i++) {
if (strcmp(CMD_ARGV[4], etm_capture_drivers[i]->name) == 0) {
- int retval = register_commands(CMD_CTX, NULL,
- etm_capture_drivers[i]->commands);
- if (ERROR_OK != retval) {
+ int retval = register_commands(CMD_CTX, NULL, etm_capture_drivers[i]->commands);
+ if (retval != ERROR_OK) {
free(etm_ctx);
return retval;
}
target = get_current_target(CMD_CTX);
arm = target_to_arm(target);
if (!is_arm(arm)) {
- command_print(CMD_CTX, "ETM: current target isn't an ARM");
+ command_print(CMD, "ETM: current target isn't an ARM");
return ERROR_FAIL;
}
etm = arm->etm;
if (!etm) {
- command_print(CMD_CTX, "current target doesn't have an ETM configured");
+ command_print(CMD, "current target doesn't have an ETM configured");
return ERROR_FAIL;
}
- command_print(CMD_CTX, "ETM v%d.%d",
+ command_print(CMD, "ETM v%d.%d",
etm->bcd_vers >> 4, etm->bcd_vers & 0xf);
- command_print(CMD_CTX, "pairs of address comparators: %i",
+ command_print(CMD, "pairs of address comparators: %i",
(int) (etm->config >> 0) & 0x0f);
- command_print(CMD_CTX, "data comparators: %i",
+ command_print(CMD, "data comparators: %i",
(int) (etm->config >> 4) & 0x0f);
- command_print(CMD_CTX, "memory map decoders: %i",
+ command_print(CMD, "memory map decoders: %i",
(int) (etm->config >> 8) & 0x1f);
- command_print(CMD_CTX, "number of counters: %i",
+ command_print(CMD, "number of counters: %i",
(int) (etm->config >> 13) & 0x07);
- command_print(CMD_CTX, "sequencer %spresent",
+ command_print(CMD, "sequencer %spresent",
(int) (etm->config & (1 << 16)) ? "" : "not ");
- command_print(CMD_CTX, "number of ext. inputs: %i",
+ command_print(CMD, "number of ext. inputs: %i",
(int) (etm->config >> 17) & 0x07);
- command_print(CMD_CTX, "number of ext. outputs: %i",
+ command_print(CMD, "number of ext. outputs: %i",
(int) (etm->config >> 20) & 0x07);
- command_print(CMD_CTX, "FIFO full %spresent",
+ command_print(CMD, "FIFO full %spresent",
(int) (etm->config & (1 << 23)) ? "" : "not ");
if (etm->bcd_vers < 0x20)
- command_print(CMD_CTX, "protocol version: %i",
+ command_print(CMD, "protocol version: %i",
(int) (etm->config >> 28) & 0x07);
else {
- command_print(CMD_CTX,
+ command_print(CMD,
"coprocessor and memory access %ssupported",
(etm->config & (1 << 26)) ? "" : "not ");
- command_print(CMD_CTX, "trace start/stop %spresent",
+ command_print(CMD, "trace start/stop %spresent",
(etm->config & (1 << 26)) ? "" : "not ");
- command_print(CMD_CTX, "number of context comparators: %i",
+ command_print(CMD, "number of context comparators: %i",
(int) (etm->config >> 24) & 0x03);
}
LOG_ERROR("Illegal max_port_size");
return ERROR_FAIL;
}
- command_print(CMD_CTX, "max. port size: %i", max_port_size);
+ command_print(CMD, "max. port size: %i", max_port_size);
if (etm->bcd_vers < 0x30) {
- command_print(CMD_CTX, "half-rate clocking %ssupported",
+ command_print(CMD, "half-rate clocking %ssupported",
(config & (1 << 3)) ? "" : "not ");
- command_print(CMD_CTX, "full-rate clocking %ssupported",
+ command_print(CMD, "full-rate clocking %ssupported",
(config & (1 << 4)) ? "" : "not ");
- command_print(CMD_CTX, "normal trace format %ssupported",
+ command_print(CMD, "normal trace format %ssupported",
(config & (1 << 5)) ? "" : "not ");
- command_print(CMD_CTX, "multiplex trace format %ssupported",
+ command_print(CMD, "multiplex trace format %ssupported",
(config & (1 << 6)) ? "" : "not ");
- command_print(CMD_CTX, "demultiplex trace format %ssupported",
+ command_print(CMD, "demultiplex trace format %ssupported",
(config & (1 << 7)) ? "" : "not ");
} else {
/* REVISIT show which size and format are selected ... */
- command_print(CMD_CTX, "current port size %ssupported",
+ command_print(CMD, "current port size %ssupported",
(config & (1 << 10)) ? "" : "not ");
- command_print(CMD_CTX, "current trace format %ssupported",
+ command_print(CMD, "current trace format %ssupported",
(config & (1 << 11)) ? "" : "not ");
}
if (etm->bcd_vers >= 0x21)
- command_print(CMD_CTX, "fetch comparisons %ssupported",
+ command_print(CMD, "fetch comparisons %ssupported",
(config & (1 << 17)) ? "not " : "");
- command_print(CMD_CTX, "FIFO full %ssupported",
+ command_print(CMD, "FIFO full %ssupported",
(config & (1 << 8)) ? "" : "not ");
return ERROR_OK;
target = get_current_target(CMD_CTX);
arm = target_to_arm(target);
if (!is_arm(arm)) {
- command_print(CMD_CTX, "ETM: current target isn't an ARM");
+ command_print(CMD, "ETM: current target isn't an ARM");
return ERROR_FAIL;
}
etm = arm->etm;
if (!etm) {
- command_print(CMD_CTX, "current target doesn't have an ETM configured");
+ command_print(CMD, "current target doesn't have an ETM configured");
return ERROR_FAIL;
}
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",
+ command_print(CMD, "etm: %s%s%s%s",
/* bit(1) == progbit */
(etm->bcd_vers >= 0x12)
? ((s & (1 << 1))
/* Trace Port Driver status */
trace_status = etm->capture_driver->status(etm);
if (trace_status == TRACE_IDLE)
- command_print(CMD_CTX, "%s: idle", etm->capture_driver->name);
+ command_print(CMD, "%s: idle", etm->capture_driver->name);
else {
static char *completed = " completed";
static char *running = " is running";
static char *overflowed = ", overflowed";
static char *triggered = ", triggered";
- command_print(CMD_CTX, "%s: trace collection%s%s%s",
+ command_print(CMD, "%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 (etm->trace_depth > 0) {
- command_print(CMD_CTX, "%i frames of trace data read",
+ command_print(CMD, "%i frames of trace data read",
(int)(etm->trace_depth));
}
}
target = get_current_target(CMD_CTX);
arm = target_to_arm(target);
if (!is_arm(arm)) {
- command_print(CMD_CTX, "ETM: current target isn't an ARM");
+ command_print(CMD, "ETM: current target isn't an ARM");
return ERROR_FAIL;
}
etm_ctx = arm->etm;
if (!etm_ctx) {
- command_print(CMD_CTX, "current target doesn't have an ETM configured");
+ command_print(CMD, "current target doesn't have an ETM configured");
return ERROR_FAIL;
}
if (etm_ctx->image) {
image_close(etm_ctx->image);
free(etm_ctx->image);
- command_print(CMD_CTX, "previously loaded image found and closed");
+ command_print(CMD, "previously loaded image found and closed");
}
etm_ctx->image = malloc(sizeof(struct image));
- etm_ctx->image->base_address_set = 0;
- etm_ctx->image->start_address_set = 0;
+ etm_ctx->image->base_address_set = false;
+ etm_ctx->image->start_address_set = false;
/* a base address isn't always necessary, default to 0x0 (i.e. don't relocate) */
if (CMD_ARGC >= 2) {
- etm_ctx->image->base_address_set = 1;
+ etm_ctx->image->base_address_set = true;
COMMAND_PARSE_NUMBER(llong, CMD_ARGV[1], etm_ctx->image->base_address);
} else
- etm_ctx->image->base_address_set = 0;
+ etm_ctx->image->base_address_set = false;
if (image_open(etm_ctx->image, CMD_ARGV[0],
(CMD_ARGC >= 3) ? CMD_ARGV[2] : NULL) != ERROR_OK) {
target = get_current_target(CMD_CTX);
arm = target_to_arm(target);
if (!is_arm(arm)) {
- command_print(CMD_CTX, "ETM: current target isn't an ARM");
+ command_print(CMD, "ETM: current target isn't an ARM");
return ERROR_FAIL;
}
etm_ctx = arm->etm;
if (!etm_ctx) {
- command_print(CMD_CTX, "current target doesn't have an ETM configured");
+ command_print(CMD, "current target doesn't have an ETM configured");
return ERROR_FAIL;
}
if (etm_ctx->capture_driver->status == TRACE_IDLE) {
- command_print(CMD_CTX, "trace capture wasn't enabled, no trace data captured");
+ command_print(CMD, "trace capture wasn't enabled, no trace data captured");
return ERROR_OK;
}
if (etm_ctx->capture_driver->status(etm_ctx) & TRACE_RUNNING) {
/* TODO: if on-the-fly capture is to be supported, this needs to be changed */
- command_print(CMD_CTX, "trace capture not completed");
+ command_print(CMD, "trace capture not completed");
return ERROR_FAIL;
}
target = get_current_target(CMD_CTX);
arm = target_to_arm(target);
if (!is_arm(arm)) {
- command_print(CMD_CTX, "ETM: current target isn't an ARM");
+ command_print(CMD, "ETM: current target isn't an ARM");
return ERROR_FAIL;
}
etm_ctx = arm->etm;
if (!etm_ctx) {
- command_print(CMD_CTX, "current target doesn't have an ETM configured");
+ command_print(CMD, "current target doesn't have an ETM configured");
return ERROR_FAIL;
}
if (etm_ctx->capture_driver->status(etm_ctx) & TRACE_RUNNING) {
- command_print(CMD_CTX, "trace capture running, stop first");
+ command_print(CMD, "trace capture running, stop first");
return ERROR_FAIL;
}
}
if (filesize % 4) {
- command_print(CMD_CTX, "size isn't a multiple of 4, no valid trace data");
+ command_print(CMD, "size isn't a multiple of 4, no valid trace data");
fileio_close(file);
return ERROR_FAIL;
}
fileio_read_u32(file, &etm_ctx->trace_depth);
}
etm_ctx->trace_data = malloc(sizeof(struct etmv1_trace_data) * etm_ctx->trace_depth);
- if (etm_ctx->trace_data == NULL) {
- command_print(CMD_CTX, "not enough memory to perform operation");
+ if (!etm_ctx->trace_data) {
+ command_print(CMD, "not enough memory to perform operation");
fileio_close(file);
return ERROR_FAIL;
}
target = get_current_target(CMD_CTX);
arm = target_to_arm(target);
if (!is_arm(arm)) {
- command_print(CMD_CTX, "ETM: current target isn't an ARM");
+ command_print(CMD, "ETM: current target isn't an ARM");
return ERROR_FAIL;
}
etm_ctx = arm->etm;
if (!etm_ctx) {
- command_print(CMD_CTX, "current target doesn't have an ETM configured");
+ command_print(CMD, "current target doesn't have an ETM configured");
return ERROR_FAIL;
}
target = get_current_target(CMD_CTX);
arm = target_to_arm(target);
if (!is_arm(arm)) {
- command_print(CMD_CTX, "ETM: current target isn't an ARM");
+ command_print(CMD, "ETM: current target isn't an ARM");
return ERROR_FAIL;
}
etm_ctx = arm->etm;
if (!etm_ctx) {
- command_print(CMD_CTX, "current target doesn't have an ETM configured");
+ command_print(CMD, "current target doesn't have an ETM configured");
return ERROR_FAIL;
}
target = get_current_target(CMD_CTX);
arm = target_to_arm(target);
if (!is_arm(arm)) {
- command_print(CMD_CTX, "ETM: %s isn't an ARM",
+ command_print(CMD, "ETM: %s isn't an ARM",
target_name(target));
return ERROR_FAIL;
}
etm = arm->etm;
if (!etm) {
- command_print(CMD_CTX, "ETM: no ETM configured for %s",
+ command_print(CMD, "ETM: no ETM configured for %s",
target_name(target));
return ERROR_FAIL;
}
buf_set_u32(etm_ctrl_reg->value, 0, 32, etm->control);
}
- command_print(CMD_CTX, "ETM: %s debug halt",
+ command_print(CMD, "ETM: %s debug halt",
(etm->control & ETM_CTRL_DBGRQ)
? "triggers"
: "does not trigger");
target = get_current_target(CMD_CTX);
arm = target_to_arm(target);
if (!is_arm(arm)) {
- command_print(CMD_CTX, "ETM: current target isn't an ARM");
+ command_print(CMD, "ETM: current target isn't an ARM");
return ERROR_FAIL;
}
etm_ctx = arm->etm;
if (!etm_ctx) {
- command_print(CMD_CTX, "current target doesn't have an ETM configured");
+ command_print(CMD, "current target doesn't have an ETM configured");
return ERROR_FAIL;
}
- retval = etmv1_analyze_trace(etm_ctx, CMD_CTX);
+ retval = etmv1_analyze_trace(etm_ctx, CMD);
if (retval != ERROR_OK) {
/* FIX! error should be reported inside etmv1_analyze_trace() */
switch (retval) {
case ERROR_ETM_ANALYSIS_FAILED:
- command_print(CMD_CTX,
+ command_print(CMD,
"further analysis failed (corrupted trace data or just end of data");
break;
case ERROR_TRACE_INSTRUCTION_UNAVAILABLE:
- command_print(CMD_CTX,
+ command_print(CMD,
"no instruction for current address available, analysis aborted");
break;
case ERROR_TRACE_IMAGE_UNAVAILABLE:
- command_print(CMD_CTX, "no image available for trace analysis");
+ command_print(CMD, "no image available for trace analysis");
break;
default:
- command_print(CMD_CTX, "unknown error");
+ command_print(CMD, "unknown error");
}
}
static int etm_register_user_commands(struct command_context *cmd_ctx)
{
- struct command *etm_cmd = command_find_in_context(cmd_ctx, "etm");
- return register_commands(cmd_ctx, etm_cmd, etm_exec_command_handlers);
+ return register_commands(cmd_ctx, "etm", etm_exec_command_handlers);
}