uint32_t etc;
int retval;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
retval = esirisc_jtag_read_csr(jtag_info, CSR_THREAD, CSR_THREAD_ETC, &etc);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to read Thread CSR: ETC", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to read Thread CSR: ETC");
return retval;
}
retval = esirisc_jtag_write_csr(jtag_info, CSR_THREAD, CSR_THREAD_ETC, etc);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to write Thread CSR: ETC", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to write Thread CSR: ETC");
return retval;
}
uint32_t etc;
int retval;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
retval = esirisc_jtag_read_csr(jtag_info, CSR_THREAD, CSR_THREAD_ETC, &etc);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to read Thread CSR: ETC", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to read Thread CSR: ETC");
return retval;
}
retval = esirisc_jtag_write_csr(jtag_info, CSR_THREAD, CSR_THREAD_ETC, etc);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to write Thread CSR: ETC", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to write Thread CSR: ETC");
return retval;
}
struct esirisc_common *esirisc = target_to_esirisc(target);
struct esirisc_jtag *jtag_info = &esirisc->jtag_info;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
int retval = esirisc_jtag_read_csr(jtag_info, CSR_THREAD, CSR_THREAD_ETC,
&esirisc->etc_save);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to read Thread CSR: ETC", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to read Thread CSR: ETC");
return retval;
}
struct esirisc_common *esirisc = target_to_esirisc(target);
struct esirisc_jtag *jtag_info = &esirisc->jtag_info;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
int retval = esirisc_jtag_write_csr(jtag_info, CSR_THREAD, CSR_THREAD_ETC,
esirisc->etc_save);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to write Thread CSR: ETC", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to write Thread CSR: ETC");
return retval;
}
struct esirisc_common *esirisc = target_to_esirisc(target);
struct esirisc_jtag *jtag_info = &esirisc->jtag_info;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
int retval = esirisc_jtag_read_csr(jtag_info, CSR_DEBUG, CSR_DEBUG_HWDC,
&esirisc->hwdc_save);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to read Thread CSR: HWDC", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to read Thread CSR: HWDC");
return retval;
}
struct esirisc_common *esirisc = target_to_esirisc(target);
struct esirisc_jtag *jtag_info = &esirisc->jtag_info;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
int retval = esirisc_jtag_write_csr(jtag_info, CSR_DEBUG, CSR_DEBUG_HWDC,
esirisc->hwdc_save);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to write Debug CSR: HWDC", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to write Debug CSR: HWDC");
return retval;
}
{
struct esirisc_common *esirisc = target_to_esirisc(target);
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
for (unsigned int i = 0; i < esirisc->reg_cache->num_regs; ++i) {
struct reg *reg = esirisc->reg_cache->reg_list + i;
{
struct esirisc_common *esirisc = target_to_esirisc(target);
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
for (unsigned int i = 0; i < esirisc->reg_cache->num_regs; ++i) {
struct reg *reg = esirisc->reg_cache->reg_list + i;
struct esirisc_common *esirisc = target_to_esirisc(target);
struct esirisc_jtag *jtag_info = &esirisc->jtag_info;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
if (target->state != TARGET_HALTED) {
LOG_TARGET_ERROR(target, "not halted");
int retval = esirisc_jtag_flush_caches(jtag_info);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to flush caches", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to flush caches");
return retval;
}
struct esirisc_jtag *jtag_info = &esirisc->jtag_info;
int64_t t;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(esirisc->target, "-");
t = timeval_ms();
for (;;) {
struct esirisc_jtag *jtag_info = &esirisc->jtag_info;
int retval;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
int num_bits = 8 * size;
for (uint32_t i = 0; i < count; ++i) {
break;
default:
- LOG_ERROR("%s: unsupported size: %" PRIu32, target_name(target), size);
+ LOG_TARGET_ERROR(target, "unsupported size: %" PRIu32, size);
return ERROR_FAIL;
}
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to read address: 0x%" TARGET_PRIxADDR, target_name(target),
+ LOG_TARGET_ERROR(target, "failed to read address: 0x%" TARGET_PRIxADDR,
address);
return retval;
}
struct esirisc_jtag *jtag_info = &esirisc->jtag_info;
int retval;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
int num_bits = 8 * size;
for (uint32_t i = 0; i < count; ++i) {
break;
default:
- LOG_ERROR("%s: unsupported size: %" PRIu32, target_name(target), size);
+ LOG_TARGET_ERROR(target, "unsupported size: %" PRIu32, size);
return ERROR_FAIL;
}
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to write address: 0x%" TARGET_PRIxADDR, target_name(target),
+ LOG_TARGET_ERROR(target, "failed to write address: 0x%" TARGET_PRIxADDR,
address);
return retval;
}
struct breakpoint **breakpoints_p = esirisc->breakpoints_p;
struct breakpoint **breakpoints_e = breakpoints_p + esirisc->num_breakpoints;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
for (int bp_index = 0; breakpoints_p < breakpoints_e; ++breakpoints_p, ++bp_index)
if (!*breakpoints_p)
uint32_t ibc;
int retval;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
/*
* The default linker scripts provided by the eSi-RISC toolchain do
bp_index = esirisc_next_breakpoint(target);
if (bp_index < 0) {
- LOG_ERROR("%s: out of hardware breakpoints", target_name(target));
+ LOG_TARGET_ERROR(target, "out of hardware breakpoints");
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
}
retval = esirisc_jtag_write_csr(jtag_info, CSR_DEBUG, CSR_DEBUG_IBA_N + bp_index,
breakpoint->address);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to write Debug CSR: IBA", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to write Debug CSR: IBA");
return retval;
}
/* enable instruction breakpoint */
retval = esirisc_jtag_read_csr(jtag_info, CSR_DEBUG, CSR_DEBUG_IBC, &ibc);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to read Debug CSR: IBC", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to read Debug CSR: IBC");
return retval;
}
retval = esirisc_jtag_write_csr(jtag_info, CSR_DEBUG, CSR_DEBUG_IBC, ibc);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to write Debug CSR: IBC", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to write Debug CSR: IBC");
return retval;
}
{
struct breakpoint *breakpoint = target->breakpoints;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
while (breakpoint) {
if (!breakpoint->is_set)
uint32_t ibc;
int retval;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
/* disable instruction breakpoint */
retval = esirisc_jtag_read_csr(jtag_info, CSR_DEBUG, CSR_DEBUG_IBC, &ibc);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to read Debug CSR: IBC", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to read Debug CSR: IBC");
return retval;
}
retval = esirisc_jtag_write_csr(jtag_info, CSR_DEBUG, CSR_DEBUG_IBC, ibc);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to write Debug CSR: IBC", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to write Debug CSR: IBC");
return retval;
}
struct esirisc_common *esirisc = target_to_esirisc(target);
struct esirisc_jtag *jtag_info = &esirisc->jtag_info;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
/* clear instruction breakpoints */
int retval = esirisc_jtag_write_csr(jtag_info, CSR_DEBUG, CSR_DEBUG_IBC, 0);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to write Debug CSR: IBC", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to write Debug CSR: IBC");
return retval;
}
struct watchpoint **watchpoints_p = esirisc->watchpoints_p;
struct watchpoint **watchpoints_e = watchpoints_p + esirisc->num_watchpoints;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
for (int wp_index = 0; watchpoints_p < watchpoints_e; ++watchpoints_p, ++wp_index)
if (!*watchpoints_p)
uint32_t dbs, dbc;
int retval;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
wp_index = esirisc_next_watchpoint(target);
if (wp_index < 0) {
- LOG_ERROR("%s: out of hardware watchpoints", target_name(target));
+ LOG_TARGET_ERROR(target, "out of hardware watchpoints");
return ERROR_FAIL;
}
retval = esirisc_jtag_write_csr(jtag_info, CSR_DEBUG, CSR_DEBUG_DBA_N + wp_index,
watchpoint->address);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to write Debug CSR: DBA", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to write Debug CSR: DBA");
return retval;
}
/* specify data breakpoint size */
retval = esirisc_jtag_read_csr(jtag_info, CSR_DEBUG, CSR_DEBUG_DBS, &dbs);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to read Debug CSR: DBS", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to read Debug CSR: DBS");
return retval;
}
break;
default:
- LOG_ERROR("%s: unsupported length: %" PRIu32, target_name(target),
+ LOG_TARGET_ERROR(target, "unsupported length: %" PRIu32,
watchpoint->length);
return ERROR_FAIL;
}
retval = esirisc_jtag_write_csr(jtag_info, CSR_DEBUG, CSR_DEBUG_DBS, dbs);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to write Debug CSR: DBS", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to write Debug CSR: DBS");
return retval;
}
/* enable data breakpoint */
retval = esirisc_jtag_read_csr(jtag_info, CSR_DEBUG, CSR_DEBUG_DBC, &dbc);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to read Debug CSR: DBC", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to read Debug CSR: DBC");
return retval;
}
break;
default:
- LOG_ERROR("%s: unsupported rw: %" PRId32, target_name(target),
- watchpoint->rw);
+ LOG_TARGET_ERROR(target, "unsupported rw: %" PRId32, watchpoint->rw);
return ERROR_FAIL;
}
retval = esirisc_jtag_write_csr(jtag_info, CSR_DEBUG, CSR_DEBUG_DBC, dbc);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to write Debug CSR: DBC", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to write Debug CSR: DBC");
return retval;
}
{
struct watchpoint *watchpoint = target->watchpoints;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
while (watchpoint) {
if (!watchpoint->is_set)
uint32_t dbc;
int retval;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
/* disable data breakpoint */
retval = esirisc_jtag_read_csr(jtag_info, CSR_DEBUG, CSR_DEBUG_DBC, &dbc);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to read Debug CSR: DBC", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to read Debug CSR: DBC");
return retval;
}
retval = esirisc_jtag_write_csr(jtag_info, CSR_DEBUG, CSR_DEBUG_DBC, dbc);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to write Debug CSR: DBC", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to write Debug CSR: DBC");
return retval;
}
struct esirisc_common *esirisc = target_to_esirisc(target);
struct esirisc_jtag *jtag_info = &esirisc->jtag_info;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
/* clear data breakpoints */
int retval = esirisc_jtag_write_csr(jtag_info, CSR_DEBUG, CSR_DEBUG_DBC, 0);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to write Debug CSR: DBC", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to write Debug CSR: DBC");
return retval;
}
struct esirisc_common *esirisc = target_to_esirisc(target);
struct esirisc_jtag *jtag_info = &esirisc->jtag_info;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
if (target->state == TARGET_HALTED)
return ERROR_OK;
int retval = esirisc_jtag_break(jtag_info);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to halt target", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to halt target");
return retval;
}
uint32_t dc;
int retval;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
retval = esirisc_jtag_read_csr(jtag_info, CSR_DEBUG, CSR_DEBUG_DC, &dc);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to read Debug CSR: DC", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to read Debug CSR: DC");
return retval;
}
retval = esirisc_jtag_write_csr(jtag_info, CSR_DEBUG, CSR_DEBUG_DC, dc);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to write Debug CSR: DC", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to write Debug CSR: DC");
return retval;
}
uint32_t dc;
int retval;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
retval = esirisc_jtag_read_csr(jtag_info, CSR_DEBUG, CSR_DEBUG_DC, &dc);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to read Debug CSR: DC", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to read Debug CSR: DC");
return retval;
}
retval = esirisc_jtag_write_csr(jtag_info, CSR_DEBUG, CSR_DEBUG_DC, dc);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to write Debug CSR: DC", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to write Debug CSR: DC");
return retval;
}
struct breakpoint *breakpoint = NULL;
int retval;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
if (target->state != TARGET_HALTED) {
LOG_TARGET_ERROR(target, "not halted");
retval = esirisc_jtag_continue(jtag_info);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to resume target", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to resume target");
return retval;
}
static int esirisc_resume(struct target *target, int current, target_addr_t address,
int handle_breakpoints, int debug_execution)
{
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
return esirisc_resume_or_step(target, current, address,
handle_breakpoints, debug_execution, false);
static int esirisc_step(struct target *target, int current, target_addr_t address,
int handle_breakpoints)
{
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
return esirisc_resume_or_step(target, current, address,
handle_breakpoints, 0, true);
struct esirisc_jtag *jtag_info = &esirisc->jtag_info;
int retval;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
esirisc_disable_interrupts(target);
esirisc_enable_step(target);
retval = esirisc_jtag_continue(jtag_info);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to resume target", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to resume target");
return retval;
}
retval = esirisc_wait_debug_active(esirisc, STEP_TIMEOUT);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: step timed out", target_name(target));
+ LOG_TARGET_ERROR(target, "step timed out");
return retval;
}
struct esirisc_jtag *jtag_info = &esirisc->jtag_info;
int retval;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
retval = esirisc_jtag_assert_reset(jtag_info);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to assert reset", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to assert reset");
return retval;
}
retval = esirisc_jtag_deassert_reset(jtag_info);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to deassert reset", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to deassert reset");
return retval;
}
retval = esirisc_wait_debug_active(esirisc, RESET_TIMEOUT);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: reset timed out", target_name(target));
+ LOG_TARGET_ERROR(target, "reset timed out");
return retval;
}
struct esirisc_jtag *jtag_info = &esirisc->jtag_info;
int retval;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
retval = esirisc_jtag_enable_debug(jtag_info);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to enable debug mode", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to enable debug mode");
return retval;
}
* targets, which will respond with all ones and appear active.
*/
if (esirisc_jtag_is_stopped(jtag_info)) {
- LOG_INFO("%s: debug clock inactive; attempting debug reset", target_name(target));
+ LOG_TARGET_INFO(target, "debug clock inactive; attempting debug reset");
retval = esirisc_debug_reset(target);
if (retval != ERROR_OK)
return retval;
if (esirisc_jtag_is_stopped(jtag_info)) {
- LOG_ERROR("%s: target unresponsive; giving up", target_name(target));
+ LOG_TARGET_ERROR(target, "target unresponsive; giving up");
return ERROR_FAIL;
}
}
struct esirisc_common *esirisc = target_to_esirisc(target);
struct breakpoint *breakpoint;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
esirisc_save_context(target);
retval = esirisc_jtag_enable_debug(jtag_info);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to poll target", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to poll target");
return retval;
}
if (esirisc_jtag_is_stopped(jtag_info)) {
- LOG_ERROR("%s: target has stopped; reset required", target_name(target));
+ LOG_TARGET_ERROR(target, "target has stopped; reset required");
target->state = TARGET_UNKNOWN;
return ERROR_TARGET_FAILURE;
}
struct esirisc_jtag *jtag_info = &esirisc->jtag_info;
int retval;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
if (jtag_get_reset_config() & RESET_HAS_SRST) {
jtag_add_reset(1, 1);
retval = esirisc_jtag_assert_reset(jtag_info);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to assert reset", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to assert reset");
return retval;
}
}
uint32_t eta, epc;
int retval;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
/* read exception table address */
retval = esirisc_jtag_read_csr(jtag_info, CSR_THREAD, CSR_THREAD_ETA, &eta);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to read Thread CSR: ETA", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to read Thread CSR: ETA");
return retval;
}
/* read reset entry point */
retval = esirisc_jtag_read_word(jtag_info, eta + ENTRY_RESET, &epc);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to read address: 0x%" TARGET_PRIxADDR, target_name(target),
+ LOG_TARGET_ERROR(target, "failed to read address: 0x%" TARGET_PRIxADDR,
(target_addr_t)epc);
return retval;
}
/* write reset entry point */
retval = esirisc_jtag_write_csr(jtag_info, CSR_THREAD, CSR_THREAD_EPC, epc);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to write Thread CSR: EPC", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to write Thread CSR: EPC");
return retval;
}
struct esirisc_jtag *jtag_info = &esirisc->jtag_info;
int retval;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
if (jtag_get_reset_config() & RESET_HAS_SRST) {
jtag_add_reset(0, 0);
} else {
retval = esirisc_jtag_deassert_reset(jtag_info);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to deassert reset", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to deassert reset");
return retval;
}
}
retval = esirisc_wait_debug_active(esirisc, RESET_TIMEOUT);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: reset timed out", target_name(target));
+ LOG_TARGET_ERROR(target, "reset timed out");
return retval;
}
if (!target->reset_halt) {
retval = esirisc_jtag_continue(jtag_info);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to resume target", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to resume target");
return retval;
}
}
uint32_t eid = buf_get_u32(esirisc->eid->value, 0, esirisc->eid->size);
uint32_t ed = buf_get_u32(esirisc->ed->value, 0, esirisc->ed->size);
- LOG_USER("target halted due to %s, exception: %s\n"
+ LOG_TARGET_USER(target, "target halted due to %s, exception: %s\n"
"EPC: 0x%" PRIx32 ", ECAS: 0x%" PRIx32 ", EID: 0x%" PRIx32 ", ED: 0x%" PRIx32,
debug_reason_name(target), esirisc_exception_strings[eid], epc, ecas, eid, ed);
{
struct esirisc_common *esirisc = target_to_esirisc(target);
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
/*
* Targets with the UNIFIED_ADDRESS_SPACE option disabled employ a
{
struct esirisc_common *esirisc = target_to_esirisc(target);
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
*reg_list_size = ESIRISC_NUM_REGS;
struct target *target = esirisc->target;
uint32_t data;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
int retval = esirisc_jtag_read_reg(jtag_info, reg->number, &data);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to read register: %s", target_name(target), reg->name);
+ LOG_TARGET_ERROR(target, "failed to read register: %s", reg->name);
return retval;
}
struct target *target = esirisc->target;
uint32_t data = buf_get_u32(reg->value, 0, reg->size);
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
int retval = esirisc_jtag_write_reg(jtag_info, reg->number, data);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to write register: %s", target_name(target), reg->name);
+ LOG_TARGET_ERROR(target, "failed to write register: %s", reg->name);
return retval;
}
struct target *target = esirisc->target;
uint32_t data;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
int retval = esirisc_jtag_read_csr(jtag_info, reg_info->bank, reg_info->csr, &data);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to read CSR: %s", target_name(target), reg->name);
+ LOG_TARGET_ERROR(target, "failed to read CSR: %s", reg->name);
return retval;
}
struct target *target = esirisc->target;
uint32_t data = buf_get_u32(reg->value, 0, reg->size);
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
int retval = esirisc_jtag_write_csr(jtag_info, reg_info->bank, reg_info->csr, data);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to write CSR: %s", target_name(target), reg->name);
+ LOG_TARGET_ERROR(target, "failed to write CSR: %s", reg->name);
return retval;
}
struct esirisc_common *esirisc = reg_info->esirisc;
struct target *target = esirisc->target;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
if (target->state != TARGET_HALTED)
return ERROR_TARGET_NOT_HALTED;
struct target *target = esirisc->target;
uint32_t value = buf_get_u32(buf, 0, reg->size);
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
if (target->state != TARGET_HALTED)
return ERROR_TARGET_NOT_HALTED;
struct reg_cache *cache = malloc(sizeof(struct reg_cache));
struct reg *reg_list = calloc(ESIRISC_NUM_REGS, sizeof(struct reg));
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
cache->name = "eSi-RISC registers";
cache->next = NULL;
uint32_t csr;
int retval;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
retval = esirisc_jtag_read_csr(jtag_info, CSR_CONFIG, CSR_CONFIG_ARCH0, &csr);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to read Configuration CSR: ARCH0", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to read Configuration CSR: ARCH0");
return retval;
}
retval = esirisc_jtag_read_csr(jtag_info, CSR_CONFIG, CSR_CONFIG_MEM, &csr);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to read Configuration CSR: MEM", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to read Configuration CSR: MEM");
return retval;
}
retval = esirisc_jtag_read_csr(jtag_info, CSR_CONFIG, CSR_CONFIG_IC, &csr);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to read Configuration CSR: IC", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to read Configuration CSR: IC");
return retval;
}
retval = esirisc_jtag_read_csr(jtag_info, CSR_CONFIG, CSR_CONFIG_DC, &csr);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to read Configuration CSR: DC", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to read Configuration CSR: DC");
return retval;
}
retval = esirisc_jtag_read_csr(jtag_info, CSR_CONFIG, CSR_CONFIG_DBG, &csr);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to read Configuration CSR: DBG", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to read Configuration CSR: DBG");
return retval;
}
retval = esirisc_jtag_read_csr(jtag_info, CSR_CONFIG, CSR_CONFIG_TRACE, &csr);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to read Configuration CSR: TRACE", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to read Configuration CSR: TRACE");
return retval;
}
return ERROR_FAIL;
if (tap->ir_length != INSTR_LENGTH) {
- LOG_ERROR("%s: invalid IR length; expected %d", target_name(target),
- INSTR_LENGTH);
+ LOG_TARGET_ERROR(target, "invalid IR length; expected %d", INSTR_LENGTH);
return ERROR_FAIL;
}
struct esirisc_jtag *jtag_info = &esirisc->jtag_info;
int retval;
- LOG_DEBUG("-");
+ LOG_TARGET_DEBUG(target, "-");
if (!target_was_examined(target)) {
retval = esirisc_debug_enable(target);
} else {
retval = esirisc_jtag_break(jtag_info);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to halt target", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to halt target");
return retval;
}
retval = esirisc_identify(target);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to identify target", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to identify target");
return retval;
}
else {
retval = esirisc_jtag_continue(jtag_info);
if (retval != ERROR_OK) {
- LOG_ERROR("%s: failed to resume target", target_name(target));
+ LOG_TARGET_ERROR(target, "failed to resume target");
return retval;
}
}
target_set_examined(target);
- LOG_INFO("%s: %d bit, %d registers, %s%s%s", target_name(target),
+ LOG_TARGET_INFO(target, "%d bit, %d registers, %s%s%s",
esirisc->num_bits, esirisc->num_regs,
target_endianness(target),
esirisc->has_icache ? ", icache" : "",
esirisc->has_dcache ? ", dcache" : "");
- LOG_INFO("%s: hardware has %d breakpoints, %d watchpoints%s", target_name(target),
+ LOG_TARGET_INFO(target, "hardware has %d breakpoints, %d watchpoints%s",
esirisc->num_breakpoints, esirisc->num_watchpoints,
esirisc->has_trace ? ", trace" : "");
}
else if (strcmp(*CMD_ARGV, "von_neumann") == 0)
esirisc->cache_arch = ESIRISC_CACHE_VON_NEUMANN;
else {
- LOG_ERROR("invalid cache_arch: %s", *CMD_ARGV);
+ LOG_TARGET_ERROR(target, "invalid cache_arch: %s", *CMD_ARGV);
return ERROR_COMMAND_SYNTAX_ERROR;
}
}
int retval;
if (!esirisc_has_cache(esirisc)) {
- LOG_ERROR("target does not support caching");
+ LOG_TARGET_ERROR(target, "target does not support caching");
return ERROR_FAIL;
}
while (CMD_ARGC-- > 0) {
int mask = esirisc_find_hwdc_mask(CMD_ARGV[CMD_ARGC]);
if (mask < 0) {
- LOG_ERROR("invalid mask: %s", CMD_ARGV[CMD_ARGC]);
+ LOG_TARGET_ERROR(target, "invalid mask: %s", CMD_ARGV[CMD_ARGC]);
return ERROR_COMMAND_SYNTAX_ERROR;
}
esirisc->hwdc_save |= mask;