This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 00abcc41bd4be841ab45c0e02be3cfa373d69bd6
Author: Saravanan Sekar <[email protected]>
AuthorDate: Thu Nov 5 17:03:22 2026 +0530

    arch/tricore: Keep the trap status registers with the trap information.
    
    g_trapinfo holds only the trap class, TIN, core and return address.  For
    a bus or memory error, the trap status registers PSTR, DSTR and DATR,
    and the error address in DEADD, tell what failed.  Keep them in
    g_trapinfo as well, read when the trap is taken.
    
    Signed-off-by: Saravanan Sekar <[email protected]>
---
 arch/tricore/src/common/tricore_trapcall.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/arch/tricore/src/common/tricore_trapcall.c 
b/arch/tricore/src/common/tricore_trapcall.c
index c5e0ed25093..2ca7145b83d 100644
--- a/arch/tricore/src/common/tricore_trapcall.c
+++ b/arch/tricore/src/common/tricore_trapcall.c
@@ -105,11 +105,26 @@
 
 #define TRICORE_TRAP_MSG_LEN      24
 
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/* Last trap and the trap status registers, for the coredump */
+
+struct tricore_trapinfo_s
+{
+  struct tricore_trap_s trap;
+  uint32_t pstr;   /* Program synchronous trap status */
+  uint32_t dstr;   /* Data synchronous trap status */
+  uint32_t datr;   /* Data asynchronous trap */
+  uint32_t deadd;  /* Data error address */
+};
+
 /****************************************************************************
  * Private Data
  ****************************************************************************/
 
-static struct tricore_trap_s g_trapinfo;
+static struct tricore_trapinfo_s g_trapinfo;
 
 /* FCU pool, also read by tricore_fcu_entry in tricore_vectors.S/.asm */
 
@@ -199,7 +214,11 @@ static const char * const g_trap_reasons[8][8] =
 
 static void tricore_trapinfo(volatile void *trap)
 {
-  g_trapinfo = *(struct tricore_trap_s *)trap;
+  g_trapinfo.trap  = *(struct tricore_trap_s *)trap;
+  g_trapinfo.pstr  = tricore_mfcr(TRICORE_CPU_PSTR);
+  g_trapinfo.dstr  = tricore_mfcr(TRICORE_CPU_DSTR);
+  g_trapinfo.datr  = tricore_mfcr(TRICORE_CPU_DATR);
+  g_trapinfo.deadd = tricore_mfcr(TRICORE_CPU_DEADD);
 }
 
 /* The message tells a panic notifier which trap it was.  The buffer is on

Reply via email to