aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorianst <ianst@cadence.com>2023-12-06 14:34:09 -0800
committerEvgeniy Naydanov <109669442+en-sc@users.noreply.github.com>2024-01-29 13:36:27 +0300
commit3d37a84b07ce5a47bc974eb6636c6e155bf32082 (patch)
treee36a28a1e03d23d3954f042c21e2950f3291b2c0
parent881fd7689895f31e7b6275497b29c145427c91c3 (diff)
downloadriscv-openocd-3d37a84b07ce5a47bc974eb6636c6e155bf32082.zip
riscv-openocd-3d37a84b07ce5a47bc974eb6636c6e155bf32082.tar.gz
riscv-openocd-3d37a84b07ce5a47bc974eb6636c6e155bf32082.tar.bz2
target/xtensa: extra debug info for "xtensa exe" failures
- Read and display EXCCAUSE on exe error - Clean up error messages - Clarify "xtensa exe" documentation Signed-off-by: ianst <ianst@cadence.com> Change-Id: I90ed39f6afb6543c0c873301501435384b4dccbe Reviewed-on: https://review.openocd.org/c/openocd/+/7982 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
-rw-r--r--doc/openocd.texi9
-rw-r--r--src/target/xtensa/xtensa.c18
2 files changed, 17 insertions, 10 deletions
diff --git a/doc/openocd.texi b/doc/openocd.texi
index a43949f..e7de90b 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -11826,13 +11826,14 @@ This feature is not well implemented and tested yet.
@end deffn
@deffn {Command} {xtensa exe} <ascii-encoded hexadecimal instruction bytes>
-Execute arbitrary instruction(s) provided as an ascii string. The string represents an integer
-number of instruction bytes, thus its length must be even.
+Execute one arbitrary instruction provided as an ascii string. The string represents an integer
+number of instruction bytes, thus its length must be even. The instruction can be of any width
+that is valid for the Xtensa core configuration.
@end deffn
@deffn {Command} {xtensa dm} (address) [value]
-Read or write Xtensa Debug Module (DM) registers. @var{address} is required for both reads
-and writes and is a 4-byte-aligned value typically between 0 and 0x3ffc. @var{value} is specified
+Read or write Xtensa Debug Module (DM) registers. @var{address} is required for both reads
+and writes and is a 4-byte-aligned value typically between 0 and 0x3ffc. @var{value} is specified
only for write accesses.
@end deffn
diff --git a/src/target/xtensa/xtensa.c b/src/target/xtensa/xtensa.c
index d2ca32c..ab3bfbb 100644
--- a/src/target/xtensa/xtensa.c
+++ b/src/target/xtensa/xtensa.c
@@ -3483,15 +3483,21 @@ static COMMAND_HELPER(xtensa_cmd_exe_do, struct target *target)
LOG_TARGET_DEBUG(target, "execute stub: %s", CMD_ARGV[0]);
xtensa_queue_exec_ins_wide(xtensa, ops, oplen); /* Handles endian-swap */
status = xtensa_dm_queue_execute(&xtensa->dbg_mod);
- if (status != ERROR_OK)
- LOG_TARGET_ERROR(target, "TIE queue execute: %d\n", status);
- status = xtensa_core_status_check(target);
- if (status != ERROR_OK)
- LOG_TARGET_ERROR(target, "TIE instr execute: %d\n", status);
+ if (status != ERROR_OK) {
+ LOG_TARGET_ERROR(target, "exec: queue error %d", status);
+ } else {
+ status = xtensa_core_status_check(target);
+ if (status != ERROR_OK)
+ LOG_TARGET_ERROR(target, "exec: status error %d", status);
+ }
/* Reread register cache and restore saved regs after instruction execution */
if (xtensa_fetch_all_regs(target) != ERROR_OK)
- LOG_TARGET_ERROR(target, "%s: Failed to fetch register cache (post-exec).", target_name(target));
+ LOG_TARGET_ERROR(target, "post-exec: register fetch error");
+ if (status != ERROR_OK) {
+ LOG_TARGET_ERROR(target, "post-exec: EXCCAUSE 0x%02" PRIx32,
+ xtensa_reg_get(target, XT_REG_IDX_EXCCAUSE));
+ }
xtensa_reg_set(target, XT_REG_IDX_EXCCAUSE, exccause);
xtensa_reg_set(target, XT_REG_IDX_CPENABLE, cpenable);
return status;