src/target/riscv: fix nuclei etrace trigger find and dump trace
Change-Id: I325844a96b608cfff9ed977910f237d097883305 Signed-off-by: wangyanwen <wangyanwen@nucleisys.com>
This commit is contained in:
parent
7259995361
commit
e96358db0b
|
@ -495,13 +495,15 @@ COMMAND_HANDLER(handle_etrace_enable_command)
|
||||||
field_value(CSR_MCONTROL_U, 1) |
|
field_value(CSR_MCONTROL_U, 1) |
|
||||||
field_value(CSR_MCONTROL_EXECUTE, 1);
|
field_value(CSR_MCONTROL_EXECUTE, 1);
|
||||||
RISCV_INFO(r);
|
RISCV_INFO(r);
|
||||||
|
if (riscv_enumerate_triggers(target_real) != ERROR_OK)
|
||||||
|
return ERROR_FAIL;
|
||||||
if (target_real->etrace_trigger_index == 0xFFFFFFFF) {
|
if (target_real->etrace_trigger_index == 0xFFFFFFFF) {
|
||||||
if (find_next_free_trigger(target_real, CSR_TDATA1_TYPE_MCONTROL, false,
|
for (unsigned int i = 0; i < r->trigger_count; i++) {
|
||||||
&target_real->etrace_trigger_index) != ERROR_OK) {
|
if (r->trigger_unique_id[i] != -1)
|
||||||
LOG_ERROR("No available trigger could be reserved for etrace usage.\n");
|
LOG_ERROR("Index=%d trigger in use could't be reserved for etrace usage.\n", i);
|
||||||
return ERROR_FAIL;
|
target_real->etrace_trigger_index = i;
|
||||||
|
r->reserved_triggers[target_real->etrace_trigger_index] = true;
|
||||||
}
|
}
|
||||||
r->reserved_triggers[target_real->etrace_trigger_index] = true;
|
|
||||||
}
|
}
|
||||||
tselect = target_real->etrace_trigger_index;
|
tselect = target_real->etrace_trigger_index;
|
||||||
if (riscv_reg_set(target_real, GDB_REGNO_TSELECT, tselect) != ERROR_OK)
|
if (riscv_reg_set(target_real, GDB_REGNO_TSELECT, tselect) != ERROR_OK)
|
||||||
|
@ -537,8 +539,10 @@ COMMAND_HANDLER(handle_etrace_disable_command)
|
||||||
field_value(CSR_MCONTROL_U, 1) |
|
field_value(CSR_MCONTROL_U, 1) |
|
||||||
field_value(CSR_MCONTROL_EXECUTE, 1);
|
field_value(CSR_MCONTROL_EXECUTE, 1);
|
||||||
RISCV_INFO(r);
|
RISCV_INFO(r);
|
||||||
|
if (riscv_enumerate_triggers(target_real) != ERROR_OK)
|
||||||
|
return ERROR_FAIL;
|
||||||
if (target_real->etrace_trigger_index == 0xFFFFFFFF)
|
if (target_real->etrace_trigger_index == 0xFFFFFFFF)
|
||||||
return ERROR_OK;
|
return ERROR_FAIL;
|
||||||
tselect = target_real->etrace_trigger_index;
|
tselect = target_real->etrace_trigger_index;
|
||||||
if (riscv_reg_set(target_real, GDB_REGNO_TSELECT, tselect) != ERROR_OK)
|
if (riscv_reg_set(target_real, GDB_REGNO_TSELECT, tselect) != ERROR_OK)
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
|
@ -655,7 +659,7 @@ COMMAND_HANDLER(handle_etrace_dump_command)
|
||||||
duration_elapsed(&bench), duration_kbps(&bench, filesize));
|
duration_elapsed(&bench), duration_kbps(&bench, filesize));
|
||||||
}
|
}
|
||||||
|
|
||||||
retval = ERROR_OK;
|
goto ok;
|
||||||
fail:
|
fail:
|
||||||
retval = ERROR_FAIL;
|
retval = ERROR_FAIL;
|
||||||
ok:
|
ok:
|
||||||
|
|
Loading…
Reference in New Issue