const struct etm_reg_info *r = etm_reg->reg_info;
uint8_t reg_addr = r->addr & 0x7f;
struct scan_field fields[3];
+ int retval;
if (etm_reg->reg_info->mode == WO) {
LOG_ERROR("BUG: can't read write-only register %s", r->name);
LOG_DEBUG("%s (%u)", r->name, reg_addr);
- arm_jtag_scann(etm_reg->jtag_info, 0x6, TAP_IDLE);
- arm_jtag_set_instr(etm_reg->jtag_info, etm_reg->jtag_info->intest_instr, NULL, TAP_IDLE);
+ 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, etm_reg->jtag_info->intest_instr, NULL, TAP_IDLE);
+ if (retval != ERROR_OK)
+ return retval;
fields[0].num_bits = 32;
fields[0].out_value = reg->value;
const struct etm_reg_info *r = etm_reg->reg_info;
uint8_t reg_addr = r->addr & 0x7f;
struct scan_field fields[3];
+ int retval;
if (etm_reg->reg_info->mode == RO) {
LOG_ERROR("BUG: can't write read--only register %s", r->name);
LOG_DEBUG("%s (%u): 0x%8.8" PRIx32 "", r->name, reg_addr, value);
- arm_jtag_scann(etm_reg->jtag_info, 0x6, TAP_IDLE);
- arm_jtag_set_instr(etm_reg->jtag_info, etm_reg->jtag_info->intest_instr, NULL, TAP_IDLE);
+ 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, etm_reg->jtag_info->intest_instr, NULL, TAP_IDLE);
+ if (retval != ERROR_OK)
+ return retval;
fields[0].num_bits = 32;
uint8_t tmp1[4];
ctx->current_pc - ctx->image->sections[section].base_address,
4, buf, &size_read)) != ERROR_OK)
{
- LOG_ERROR("error while reading instruction: %i", retval);
+ LOG_ERROR("error while reading instruction");
return ERROR_TRACE_INSTRUCTION_UNAVAILABLE;
}
opcode = target_buffer_get_u32(ctx->target, buf);
ctx->current_pc - ctx->image->sections[section].base_address,
2, buf, &size_read)) != ERROR_OK)
{
- LOG_ERROR("error while reading instruction: %i", retval);
+ LOG_ERROR("error while reading instruction");
return ERROR_TRACE_INSTRUCTION_UNAVAILABLE;
}
opcode = target_buffer_get_u16(ctx->target, buf);
if (ctx->trace_depth == 0)
ctx->capture_driver->read_trace(ctx);
+ if (ctx->trace_depth == 0) {
+ command_print(cmd_ctx, "Trace is empty.");
+ return ERROR_OK;
+ }
+
/* start at the beginning of the captured trace */
ctx->pipe_index = 0;
ctx->data_index = 0;
return ERROR_FAIL;
}
- if (file.size % 4)
+ int filesize;
+ int retval = fileio_size(&file, &filesize);
+ if (retval != ERROR_OK)
+ {
+ 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);
if ((retval = etmv1_analyze_trace(etm_ctx, CMD_CTX)) != ERROR_OK)
{
+ /* FIX! error should be reported inside etmv1_analyze_trace() */
switch (retval)
{
case ERROR_ETM_ANALYSIS_FAILED:
command_print(CMD_CTX, "no image available for trace analysis");
break;
default:
- command_print(CMD_CTX, "unknown error: %i", retval);
+ command_print(CMD_CTX, "unknown error");
}
}