* 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. *
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
reg_list = calloc(128, sizeof(struct reg));
arch_info = calloc(128, sizeof(struct etm_reg));
+ if (reg_cache == NULL || reg_list == NULL || arch_info == NULL) {
+ 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];
retval = arm_jtag_scann(etm_reg->jtag_info, 0x6, TAP_IDLE);
if (retval != ERROR_OK)
return retval;
- retval = arm_jtag_set_instr(etm_reg->jtag_info,
+ retval = arm_jtag_set_instr(etm_reg->jtag_info->tap,
etm_reg->jtag_info->intest_instr,
NULL,
TAP_IDLE);
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;
retval = arm_jtag_scann(etm_reg->jtag_info, 0x6, TAP_IDLE);
if (retval != ERROR_OK)
return retval;
- retval = arm_jtag_set_instr(etm_reg->jtag_info,
+ retval = arm_jtag_set_instr(etm_reg->jtag_info->tap,
etm_reg->jtag_info->intest_instr,
NULL,
TAP_IDLE);
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;
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);
}
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;
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));
COMMAND_HANDLER(handle_etm_dump_command)
{
- struct fileio file;
+ struct fileio *file;
struct target *target;
struct arm *arm;
struct etm_context *etm_ctx;
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;
}
if (fileio_open(&file, CMD_ARGV[0], FILEIO_WRITE, FILEIO_BINARY) != ERROR_OK)
return ERROR_FAIL;
- fileio_write_u32(&file, etm_ctx->capture_status);
- fileio_write_u32(&file, etm_ctx->control);
- fileio_write_u32(&file, etm_ctx->trace_depth);
+ fileio_write_u32(file, etm_ctx->capture_status);
+ fileio_write_u32(file, etm_ctx->control);
+ fileio_write_u32(file, etm_ctx->trace_depth);
for (i = 0; i < etm_ctx->trace_depth; i++) {
- fileio_write_u32(&file, etm_ctx->trace_data[i].pipestat);
- fileio_write_u32(&file, etm_ctx->trace_data[i].packet);
- fileio_write_u32(&file, etm_ctx->trace_data[i].flags);
+ fileio_write_u32(file, etm_ctx->trace_data[i].pipestat);
+ fileio_write_u32(file, etm_ctx->trace_data[i].packet);
+ fileio_write_u32(file, etm_ctx->trace_data[i].flags);
}
- fileio_close(&file);
+ fileio_close(file);
return ERROR_OK;
}
COMMAND_HANDLER(handle_etm_load_command)
{
- struct fileio file;
+ struct fileio *file;
struct target *target;
struct arm *arm;
struct etm_context *etm_ctx;
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;
}
return ERROR_FAIL;
size_t filesize;
- int retval = fileio_size(&file, &filesize);
+ int retval = fileio_size(file, &filesize);
if (retval != ERROR_OK) {
- fileio_close(&file);
+ fileio_close(file);
return retval;
}
if (filesize % 4) {
- command_print(CMD_CTX, "size isn't a multiple of 4, no valid trace data");
- fileio_close(&file);
+ command_print(CMD, "size isn't a multiple of 4, no valid trace data");
+ fileio_close(file);
return ERROR_FAIL;
}
{
uint32_t tmp;
- fileio_read_u32(&file, &tmp); etm_ctx->capture_status = tmp;
- fileio_read_u32(&file, &tmp); etm_ctx->control = tmp;
- fileio_read_u32(&file, &etm_ctx->trace_depth);
+ fileio_read_u32(file, &tmp); etm_ctx->capture_status = tmp;
+ fileio_read_u32(file, &tmp); etm_ctx->control = tmp;
+ 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");
- fileio_close(&file);
+ command_print(CMD, "not enough memory to perform operation");
+ fileio_close(file);
return ERROR_FAIL;
}
for (i = 0; i < etm_ctx->trace_depth; i++) {
uint32_t pipestat, packet, flags;
- fileio_read_u32(&file, &pipestat);
- fileio_read_u32(&file, &packet);
- fileio_read_u32(&file, &flags);
+ fileio_read_u32(file, &pipestat);
+ fileio_read_u32(file, &packet);
+ fileio_read_u32(file, &flags);
etm_ctx->trace_data[i].pipestat = pipestat & 0xff;
etm_ctx->trace_data[i].packet = packet & 0xffff;
etm_ctx->trace_data[i].flags = flags;
}
- fileio_close(&file);
+ fileio_close(file);
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_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");
}
}