This is an automated email from the ASF dual-hosted git repository. acassis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 4e40393cc49881cb2b1eb958878d092447aca9ce Author: zhangyu117 <[email protected]> AuthorDate: Thu Apr 17 14:21:24 2025 +0800 arch/tricore: record trapinfo for coredump use global var record trap type and reason info for coredump Signed-off-by: zhangyuan29 <[email protected]> --- arch/tricore/src/common/tricore_initialize.c | 2 ++ arch/tricore/src/common/tricore_internal.h | 1 + arch/tricore/src/common/tricore_trapcall.c | 35 ++++++++++++++++++++++++++++ tools/nxstyle.c | 2 ++ 4 files changed, 40 insertions(+) diff --git a/arch/tricore/src/common/tricore_initialize.c b/arch/tricore/src/common/tricore_initialize.c index ec8377cbcb5..21173d355fd 100644 --- a/arch/tricore/src/common/tricore_initialize.c +++ b/arch/tricore/src/common/tricore_initialize.c @@ -61,6 +61,8 @@ volatile bool g_interrupt_context[CONFIG_SMP_NCPUS]; void up_initialize(void) { + tricore_trapinit(); + /* Initialize the serial device driver */ #ifdef USE_SERIALDRIVER diff --git a/arch/tricore/src/common/tricore_internal.h b/arch/tricore/src/common/tricore_internal.h index 4cbc9b1e4b7..57d4557146f 100644 --- a/arch/tricore/src/common/tricore_internal.h +++ b/arch/tricore/src/common/tricore_internal.h @@ -201,6 +201,7 @@ void tricore_sigdeliver(void); void tricore_svcall(volatile void *trap); void tricore_trapcall(volatile void *trap); +void tricore_trapinit(void); /* Context Save Areas *******************************************************/ diff --git a/arch/tricore/src/common/tricore_trapcall.c b/arch/tricore/src/common/tricore_trapcall.c index 7da9a212692..b924ad77d48 100644 --- a/arch/tricore/src/common/tricore_trapcall.c +++ b/arch/tricore/src/common/tricore_trapcall.c @@ -34,16 +34,33 @@ #include <arch/irq.h> #include <sched/sched.h> +#include <nuttx/coredump.h> #include <nuttx/sched.h> #include "tricore_internal.h" #include "IfxCpu_Trap.h" +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static IfxCpu_Trap g_trapinfo; + /**************************************************************************** * Private Functions ****************************************************************************/ +static void tricore_trapinfo(volatile void *trap) +{ + IfxCpu_Trap *ctrap = (IfxCpu_Trap *)trap; + + g_trapinfo.tCpu = ctrap->tCpu; + g_trapinfo.tClass = ctrap->tClass; + g_trapinfo.tId = ctrap->tId; + g_trapinfo.tAddr = ctrap->tAddr; +} + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -290,6 +307,8 @@ void tricore_trapcall(volatile void *trap) IfxCpu_Trap_Class tclass = (IfxCpu_Trap_Class)ctrap->tClass; unsigned int tid = ctrap->tId; + tricore_trapinfo(trap); + regs = tricore_csa2addr(__mfcr(CPU_PCXI)); pcxi = regs[REG_UPCXI]; regs = tricore_csa2addr(pcxi); @@ -342,3 +361,19 @@ void tricore_trapcall(volatile void *trap) up_irq_save(); PANIC_WITH_REGS("Trap", regs); } + +/**************************************************************************** + * Function: tricore_trapinit + * + * Description: + * Trap init for tricore arch. + * + ****************************************************************************/ + +void tricore_trapinit(void) +{ +#ifdef CONFIG_COREDUMP + coredump_add_memory_region(&g_trapinfo, sizeof(g_trapinfo), + PF_REGISTER); +#endif +} diff --git a/tools/nxstyle.c b/tools/nxstyle.c index 4b58da91cf9..b6b9c81ebf6 100644 --- a/tools/nxstyle.c +++ b/tools/nxstyle.c @@ -223,7 +223,9 @@ static const char *g_white_prefix[] = "Http", /* Ref: apps/netutils/xedge/BAS/examples/xedge/src/xedge.h */ "Disk", /* Ref: apps/netutils/xedge/BAS/examples/xedge/src/xedge.h */ "Xedge", /* Ref: apps/netutils/xedge/BAS/examples/xedge/src/xedge.h */ + "tAddr", /* Ref: arch/tricore/src */ "tClass", /* Ref: arch/tricore/src */ + "tCpu", /* Ref: arch/tricore/src */ "tId", /* Ref: arch/tricore/src */ NULL };
