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
The following commit(s) were added to refs/heads/master by this push:
new eb70fcd7c7a arch/tricore: fix hwdebug build error
eb70fcd7c7a is described below
commit eb70fcd7c7a295257c54a01ca049151ae1b0f0c7
Author: zhangyu117 <[email protected]>
AuthorDate: Thu Nov 12 10:21:34 2026 +0800
arch/tricore: fix hwdebug build error
tricore_hwdebug.c uses TRICORE_CPU_LCX and FCD_RESERVE_SIZE, which are
not defined, and g_running_task, which does not exist. Define the LCX
CSFR address and the reserved FCD context size, and use
g_running_tasks[this_cpu()] as the other TriCore files do.
Signed-off-by: zhangyu117 <[email protected]>
---
arch/tricore/include/csfr.h | 1 +
arch/tricore/include/irq.h | 2 ++
arch/tricore/src/common/tricore_hwdebug.c | 11 +++++++----
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/arch/tricore/include/csfr.h b/arch/tricore/include/csfr.h
index dddf4568731..eefb06fd046 100644
--- a/arch/tricore/include/csfr.h
+++ b/arch/tricore/include/csfr.h
@@ -39,6 +39,7 @@
#define TRICORE_CPU_CORE_ID 0xfe1c /* Core Identification */
#define TRICORE_CPU_ICR 0xfe2c /* Interrupt Control Register */
#define TRICORE_CPU_FCX 0xfe38 /* Free CSA List Head Pointer */
+#define TRICORE_CPU_LCX 0xfe3c /* Free CSA List Limit Pointer */
/* Core configuration (TC1.8 only) */
diff --git a/arch/tricore/include/irq.h b/arch/tricore/include/irq.h
index 80dfac216ce..9e23a22a2cc 100644
--- a/arch/tricore/include/irq.h
+++ b/arch/tricore/include/irq.h
@@ -104,6 +104,8 @@
#define TC_CONTEXT_REGS (16)
#define TC_CONTEXT_SIZE (sizeof(void *) * TC_CONTEXT_REGS)
+#define FCD_RESERVE_SIZE (TC_CONTEXT_SIZE * 4)
+
#define XCPTCONTEXT_REGS (TC_CONTEXT_REGS * 2)
#define XCPTCONTEXT_SIZE (sizeof(void *) * XCPTCONTEXT_REGS)
diff --git a/arch/tricore/src/common/tricore_hwdebug.c
b/arch/tricore/src/common/tricore_hwdebug.c
index 7e9c9f5d716..b11534bca33 100644
--- a/arch/tricore/src/common/tricore_hwdebug.c
+++ b/arch/tricore/src/common/tricore_hwdebug.c
@@ -288,17 +288,20 @@ used_code static void tricore_trevt_match(void)
uintptr_t *regs;
bool switch_csa;
int evtsrc;
+ int cpu;
/* Save lower csa context. */
__asm__ __volatile__ ("svlcx\n\t");
+ cpu = this_cpu();
+
/* Switch to istack csa list. */
switch_csa = !(g_trevt_debug.dcx[1] & PSW_IS);
if (switch_csa)
{
- uintptr_t istackbase = up_get_intstackbase(up_cpu_index());
+ uintptr_t istackbase = up_get_intstackbase(cpu);
saved_fcx = tricore_mfcr(TRICORE_CPU_FCX);
saved_lcx = tricore_mfcr(TRICORE_CPU_LCX);
@@ -324,8 +327,8 @@ used_code static void tricore_trevt_match(void)
/* Debug trap handler. */
- regs = g_running_task->xcp.regs;
- g_running_task->xcp.regs = context;
+ regs = g_running_tasks[cpu]->xcp.regs;
+ g_running_tasks[cpu]->xcp.regs = context;
evtsrc = ((tricore_mfcr(TC_DBGSR) >> TC_DBGSR_EVTSRC_OFF) &
TC_DBGSR_EVTSRC_MSK) - TREVT_DEBUG_EVTSRC_BASE;
@@ -335,7 +338,7 @@ used_code static void tricore_trevt_match(void)
g_trevt_debug.dp[evtsrc].size,
g_trevt_debug.dp[evtsrc].arg);
- g_running_task->xcp.regs = regs;
+ g_running_tasks[cpu]->xcp.regs = regs;
/* Switch to thread csa list. */