ssekar15 opened a new pull request, #21496:
URL: https://github.com/apache/nuttx/pull/21496
## Summary
TriCore traps are taken by the iLLD trap table (IfxCpu_Trap.c) and passed
to NuttX through the Ifx_Cfg_Trap.h hooks. A free context list underflow
(FCU) then hangs the core without any report, because no free CSA is left
for the trap entry. The panic message does not say which trap it was, and
seven per-class handlers print strings that are always built in. Also, the
TASKING linker scripts put the trap table at offset 0x20. The core forms
the vector address as BTV | (class << 5), so with that offset class 1, 3,
5 and 7 traps run the handler of the class below.
This series fixes the TASKING table alignment, then replaces the iLLD trap
table with a native per-core vector table (GNU and TASKING assembly), and
makes tricore_trapcall.c free of the iLLD. On top of that, an FCU trap is
reported from a small CSA pool (TRICORE_FCU_CSA_NUM, or a board pool
through tricore_fcu_register_pool()). A trap panics with
"Trap c=<class> t=<TIN>", so a panic notifier can tell the trap. The trap
names and reasons come from one table, printed only with the new
TRICORE_TRAP_ALERT option (off with DEFAULT_SMALL). g_trapinfo also keeps
PSTR, DSTR, DATR and DEADD.
## Dependency
Depends on #21486.
## Impact
TriCore only (arch/tricore and the TC397/TC4x9 TASKING linker scripts).
- The TASKING trap table moves to offset 0x100, as in the GCC scripts.
- IfxCpu_Trap.c and Ifx_Cfg_Trap.h are no longer used; the vector sources
are linked as head objects (make and cmake).
- New Kconfig options TRICORE_FCU_CSA_NUM (default 0) and
TRICORE_TRAP_ALERT (default !DEFAULT_SMALL).
- The trap alert text and the panic message change; the per-class trap
handlers are gone, tricore_nmitrap() stays weak.
- Code size on TC397 GCC: about 1.4 KB smaller, 2.8 KB without
TRICORE_TRAP_ALERT.
No board defconfig or documentation changes.
## Testing
I confirm that changes are verified on local setup and works as intended:
* Build Host(s): Linux x86_64, Debian GNU/Linux 12 (bookworm)
* Toolchains: AURIX GCC 11.3.1 (tricore-elf-gcc), TASKING VX-toolset v6.4r1
(TC3x), TASKING SmartCode v10.4r1 (TC4x)
* Build systems: make, cmake (Ninja)
* Target(s): a2g-tc397-5v-tft:nsh, triboard_tc4x9_com:nsh
* Hardware: TriBoard TC397 V2.0; TriBoard TC4x7 COM V3.0 for the
triboard_tc4x9_com image
* Each commit passes tools/checkpatch.sh.
Build results (tip):
| Board | GCC make | GCC cmake | TASKING make | TASKING cmake |
|---|---|---|---|---|
| a2g-tc397-5v-tft:nsh | pass | pass | pass | - |
| triboard_tc4x9_com:nsh | pass | - | pass | pass |
Runtime, ostest on the tip:
| Board | GCC | TASKING |
|---|---|---|
| TriBoard TC397 (a2g-tc397-5v-tft:nsh) | pass | pass |
| TriBoard TC4x7 (triboard_tc4x9_com:nsh) | pass | wqueue assert, also on
master |
```
nsh> uname -a
NuttX 10.4.0 7994d44f0c6 Nov 5 2026 17:04:44 tricore a2g-tc397-5v-tft
nsh> ostest
...
user_main: Exiting
ostest_main: Exiting with status 0
```
Trap tests with a local test command, on both boards and both toolchains.
A bus error (write to 0x4):
```
tricore_trap_panic: PANIC!!! System Bus Trap:
tricore_trap_panic: Class 4 TID: 3 regs: 0x70032340
tricore_trap_panic: Data Access Asynchronous Error
dump_assert_info: Assertion failed Trap c=4 t=3: at file: :0 task: hello
process: hello 0x8002c1ea
tricore_dump_trapctrl: PSTR:00000000 DSTR:00000000 DATR:00000008
DEADD:00000004
```
A free context list underflow (TRICORE_FCU_CSA_NUM=32, LCX=0, deep
recursion); before this series the core hangs:
```
tricore_trap_panic: PANIC!!! Context Management Trap:
tricore_trap_panic: Class 3 TID: 4 regs: 0x70011f00
tricore_trap_panic: Free Context List Underflow
dump_assert_info: Assertion failed Trap c=3 t=4: at file: :0 task: hello
process: hello 0x8002c1ea
```
g_trapinfo read back from the board after the bus error holds the return
address, class 4, TIN 3, DATR 0x8 and DEADD 0x4.
On the TriBoard TC4x7 with TASKING, ostest asserts in the wqueue test with
and without this series (also on master), so that is a separate,
pre-existing issue.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]