* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* 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/>. *
reg_list = calloc(128, sizeof(struct reg));
arch_info = calloc(128, sizeof(struct etm_reg));
reg_list = calloc(128, sizeof(struct reg));
arch_info = calloc(128, sizeof(struct etm_reg));
uint8_t *check_value, uint8_t *check_mask)
{
struct etm_reg *etm_reg = reg->arch_info;
uint8_t *check_value, uint8_t *check_mask)
{
struct etm_reg *etm_reg = reg->arch_info;
const struct etm_reg_info *r = etm_reg->reg_info;
uint8_t reg_addr = r->addr & 0x7f;
struct scan_field fields[3];
const struct etm_reg_info *r = etm_reg->reg_info;
uint8_t reg_addr = r->addr & 0x7f;
struct scan_field fields[3];
/* instructions execute in IE/D or BE/D cycles */
if ((pipestat == STAT_IE) || (pipestat == STAT_ID))
/* instructions execute in IE/D or BE/D cycles */
if ((pipestat == STAT_IE) || (pipestat == STAT_ID))
"--- tracing enabled at 0x%8.8" PRIx32 " ---",
ctx->last_branch);
ctx->current_pc = ctx->last_branch;
"--- tracing enabled at 0x%8.8" PRIx32 " ---",
ctx->last_branch);
ctx->current_pc = ctx->last_branch;
"--- trace restarted after FIFO overflow at 0x%8.8" PRIx32 " ---",
ctx->last_branch);
ctx->current_pc = ctx->last_branch;
"--- trace restarted after FIFO overflow at 0x%8.8" PRIx32 " ---",
ctx->last_branch);
ctx->current_pc = ctx->last_branch;
"--- exit from debug state at 0x%8.8" PRIx32 " ---",
ctx->last_branch);
ctx->current_pc = ctx->last_branch;
"--- exit from debug state at 0x%8.8" PRIx32 " ---",
ctx->last_branch);
ctx->current_pc = ctx->last_branch;
"--- periodic synchronization point at 0x%8.8" PRIx32 " ---",
next_pc);
ctx->current_pc = next_pc;
"--- 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)
|| ((ctx->last_branch >= 0xffff0000) &&
(ctx->last_branch <= 0xffff0020))) {
if ((ctx->last_branch & 0xff) == 0x10)
"exception vector 0x%2.2" PRIx32 "",
ctx->last_branch);
ctx->current_pc = ctx->last_branch;
"exception vector 0x%2.2" PRIx32 "",
ctx->last_branch);
ctx->current_pc = ctx->last_branch;
uint32_t data;
if (etmv1_data(ctx, 4, &data) != 0)
return ERROR_ETM_ANALYSIS_FAILED;
uint32_t data;
if (etmv1_data(ctx, 4, &data) != 0)
return ERROR_ETM_ANALYSIS_FAILED;
if (etmv1_data(ctx, arm_access_size(&instruction),
&data) != 0)
return ERROR_ETM_ANALYSIS_FAILED;
if (etmv1_data(ctx, arm_access_size(&instruction),
&data) != 0)
return ERROR_ETM_ANALYSIS_FAILED;
else if (strcmp(CMD_ARGV[0], "all") == 0)
tracemode = ETM_CTRL_TRACE_DATA | ETM_CTRL_TRACE_ADDR;
else {
else if (strcmp(CMD_ARGV[0], "all") == 0)
tracemode = ETM_CTRL_TRACE_DATA | ETM_CTRL_TRACE_ADDR;
else {
else if (strcmp("demultiplexed", CMD_ARGV[2]) == 0)
portmode |= ETM_PORT_DEMUXED;
else {
else if (strcmp("demultiplexed", CMD_ARGV[2]) == 0)
portmode |= ETM_PORT_DEMUXED;
else {
"unsupported ETM port mode '%s', must be 'normal', 'multiplexed' or 'demultiplexed'",
CMD_ARGV[2]);
return ERROR_FAIL;
"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 {
else if (strcmp("full", CMD_ARGV[3]) == 0)
portmode |= ETM_PORT_FULL_CLOCK;
else {
"coprocessor and memory access %ssupported",
(etm->config & (1 << 26)) ? "" : "not ");
"coprocessor and memory access %ssupported",
(etm->config & (1 << 26)) ? "" : "not ");
if (etm_get_reg(reg) == ERROR_OK) {
unsigned s = buf_get_u32(reg->value, 0, reg->size);
if (etm_get_reg(reg) == ERROR_OK) {
unsigned s = buf_get_u32(reg->value, 0, reg->size);
/* Trace Port Driver status */
trace_status = etm->capture_driver->status(etm);
if (trace_status == TRACE_IDLE)
/* Trace Port Driver status */
trace_status = etm->capture_driver->status(etm);
if (trace_status == TRACE_IDLE)
else {
static char *completed = " completed";
static char *running = " is running";
static char *overflowed = ", overflowed";
static char *triggered = ", triggered";
else {
static char *completed = " completed";
static char *running = " is running";
static char *overflowed = ", overflowed";
static char *triggered = ", triggered";
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) {
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) {
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 */
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 */
if (fileio_open(&file, CMD_ARGV[0], FILEIO_WRITE, FILEIO_BINARY) != ERROR_OK)
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);
- 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);
return ERROR_FAIL;
}
if (fileio_open(&file, CMD_ARGV[0], FILEIO_READ, FILEIO_BINARY) != ERROR_OK)
return ERROR_FAIL;
return ERROR_FAIL;
}
if (fileio_open(&file, CMD_ARGV[0], FILEIO_READ, FILEIO_BINARY) != ERROR_OK)
return ERROR_FAIL;
- 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) {
}
etm_ctx->trace_data = malloc(sizeof(struct etmv1_trace_data) * etm_ctx->trace_depth);
if (etm_ctx->trace_data == NULL) {
return ERROR_FAIL;
}
for (i = 0; i < etm_ctx->trace_depth; i++) {
uint32_t pipestat, packet, flags;
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;
}
etm_ctx->trace_data[i].pipestat = pipestat & 0xff;
etm_ctx->trace_data[i].packet = packet & 0xffff;
etm_ctx->trace_data[i].flags = flags;
}
buf_set_u32(etm_ctrl_reg->value, 0, 32, etm->control);
}
buf_set_u32(etm_ctrl_reg->value, 0, 32, etm->control);
}
if (retval != ERROR_OK) {
/* FIX! error should be reported inside etmv1_analyze_trace() */
switch (retval) {
case ERROR_ETM_ANALYSIS_FAILED:
if (retval != ERROR_OK) {
/* FIX! error should be reported inside etmv1_analyze_trace() */
switch (retval) {
case ERROR_ETM_ANALYSIS_FAILED:
"further analysis failed (corrupted trace data or just end of data");
break;
case ERROR_TRACE_INSTRUCTION_UNAVAILABLE:
"further analysis failed (corrupted trace data or just end of data");
break;
case ERROR_TRACE_INSTRUCTION_UNAVAILABLE:
"no instruction for current address available, analysis aborted");
break;
case ERROR_TRACE_IMAGE_UNAVAILABLE:
"no instruction for current address available, analysis aborted");
break;
case ERROR_TRACE_IMAGE_UNAVAILABLE: