Skip to content

arch/tricore: Native interrupt vector and interrupt router access (2/n) - #21504

Merged
xiaoxiang781216 merged 5 commits into
apache:masterfrom
linumiz:native-2.2-irq
Nov 10, 2026
Merged

xiaoxiang781216 merged 5 commits into
apache:masterfrom
linumiz:native-2.2-irq

Conversation

@ssekar15

@ssekar15 ssekar15 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The TriCore interrupt path depends on the Infineon iLLD. The interrupt
vector comes from the iLLD IFX_INTERRUPT_INTERNAL macro on GCC and from
the compiler __interrupt/__vector_table keywords on TASKING, and both
build it for CPU0 only. tricore_irq.c programs the service request
control (SRC) registers through IfxSrc and IfxCpu, and TRICORE_SRC2IRQ
takes the SRC base from the iLLD MODULE_SRC.

This series adds the SRC register addresses and bit fields for TC3xx and
TC4xx, writes the SRC registers directly in tricore_irq.c, and replaces the
interrupt vector with a native one per core next to the trap vectors, in
GNU and TASKING assembly. tricore_doirq becomes a plain function entered
with jli. tricore_irq.c and tricore_doirq.c are now free of the iLLD, and
IfxSrc.c is no longer built.

Dependency

Depends on #21496.

Impact

TriCore only (arch/tricore and the TC397/TC4x9 linker scripts).

  • The linker scripts select the native interrupt vector of the configured
    core (.intvec_cpuN); its address is unchanged (INTTAB + 0x1FE0).
  • IfxSrc.c is dropped from the make and cmake builds, and the TC4xx
    SRC_CPU_CPU0_SB/SRC_GPSR00 alias defines are removed.
  • No functional change intended: the SRC register values after boot are
    the same as before.

No Kconfig, 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. The GCC warning from the iLLD
    interrupt macro in tricore_doirq.c (-Wstrict-prototypes) is gone.

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

The interrupt vector is at 0x80001fe0 in all four images.

Runtime, ostest:

Board GCC TASKING
TriBoard TC397 (a2g-tc397-5v-tft:nsh) pass pass
TriBoard TC4x7 (triboard_tc4x9_com:nsh) pass wqueue assert, also on master

ostest ran with the code of the vector commit (before it was committed,
hence -dirty); the tip, which only drops IfxSrc.c from the build, was boot
tested:

nsh> uname -a
NuttX 10.4.0 294043dd767-dirty Nov  5 2026 22:09:37 tricore a2g-tc397-5v-tft
nsh> ostest
...
user_main: Exiting
ostest_main: Exiting with status 0

nsh> uname -a
NuttX 10.4.0 843fff5ed24 Nov  5 2026 22:26:25 tricore a2g-tc397-5v-tft

SRC registers read back from the boards after boot, before and after
this series (ASCLIN0 RX, STM, GPSR0 to GPSR5/6 SR0):

TC397        before     after
0xf0038054:  00110408   00110408
0xf0038300:  000e0407   000e0407
0xf0038990:  001b0001   001b0001
...
0xf0038a30:  00050006   00050006

TC4x7        before     after
0xf44322b4:  00800009   00800009
0xf4433460:  00000001   00000001
...
0xf4433520:  00000007   00000007

All values match, except that the STM SRC on TC4x7 showed a pending
request (SRR) at the moment it was read, which is timing, not setup.

@github-actions github-actions Bot added Arch: tricore Issues related to the TriCore architecture from Infineon Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces. Board: tricore labels Nov 6, 2026
Comment thread arch/tricore/include/csfr.h Resolved
Comment thread arch/tricore/src/common/tricore_irq.c Resolved
Comment thread arch/tricore/src/common/tricore_doirq.c Resolved

@casaroli casaroli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This branch conflicts with master (csfr.h, tricore_trapcall.c) and carries an older copy of the #21496 commits (for example 27a6e36, which #21496 has changed since) and the CSFR commits that merged with #21486.
Fix: rebase the last four commits on the current #21496 head.

TRICORE_SRC2IRQ takes the SRC base from the iLLD MODULE_SRC, and the
interrupt code reaches the service request control (SRC) registers only
through IfxSrc.  Add the SRC base addresses and bit fields of TC3xx and
TC4xx, which differ, as checked against the TC39xB and TC4Dx iLLD
headers, and use the SRC base in TRICORE_SRC2IRQ.

Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
@github-actions github-actions Bot added Size: M The size of the change in this PR is medium and removed Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces. labels Nov 8, 2026
@ssekar15

ssekar15 commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

@xiaoxiang781216 please review

@ssekar15 ssekar15 changed the title arch/tricore: Native interrupt vector and interrupt router access arch/tricore: Native interrupt vector and interrupt router access (2/n) Nov 8, 2026
@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

MemBrowse Memory Report · Explore what changed →

No memory changes detected for:


Catch memory regressions in CI with MemBrowse. Free for open source.

Comment thread arch/tricore/src/common/tricore_irq.c Resolved
Comment thread arch/tricore/src/common/tricore_irq.c Resolved
@zhangyu981027

zhangyu981027 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

@xiaoxiang781216 please review

@ssekar15 please look my comment first

@zhangyu981027

Copy link
Copy Markdown
Contributor

@ssekar15 please look my comment first

Can we reach a consensus: you submit the interrupt/trap-related code based on our comment, while I provide the boot-related code? For instance, you take my interrupt/trap PR and make necessary modifications; likewise, you are welcome to offer your feedback on our boot implementation.

Comment thread arch/tricore/src/common/tricore_irq.c Resolved
@ssekar15

ssekar15 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

@ssekar15 please look my comment first

Can we reach a consensus: you submit the interrupt/trap-related code based on our comment, while I provide the boot-related code? For instance, you take my interrupt/trap PR and make necessary modifications; likewise, you are welcome to offer your feedback on our boot implementation.

We already reached in fair consensus,
#19041 (comment)
#19041 (comment)

We are just claiming allow us to complete what we started (not claiming the duplication effort or Co-authored-by for the past completed PR), hope we already reached to fair point and now all my request is please stick with the agreement.

you submit the interrupt/trap-related code based on our comment,

code review is one of maintainer duty in open source I guess.

likewise, you are welcome to offer your feedback on our boot implementation.

boot implementation were also part of our initial commit, if you think there is room for improvement please review (we are always happy to take healthier review comments) or allow our PR merge and you can open improvements later.

Comment thread arch/tricore/src/common/tricore_irq.c Resolved
@xiaoxiang781216

Copy link
Copy Markdown
Contributor

@xiaoxiang781216 please review

I am waiting you address the comment from @zhangyu-duck @zyfeier since they are more expert on tricore arch than me.

ssekar15 and others added 4 commits November 10, 2026 09:01
tricore_irq.c programs the SRC registers through IfxSrc and IfxCpu.  Write
them directly with the new SRC definitions instead, so the file no longer
needs the iLLD, and drop the TC4xx SRC name aliases that only it used.

Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
The interrupt vector comes from the iLLD IFX_INTERRUPT_INTERNAL macro,
which on GCC also makes tricore_doirq an interrupt_handler, and on
TASKING from the compiler __interrupt and __vector_table keywords.  Add
a native vector next to the trap vectors, which saves the lower context
and enters tricore_doirq with jli, and make tricore_doirq a plain
function that returns with ji.  An image runs on a single core, so one
vector section is enough, and the linker scripts place it at
INTTAB + 0x1FE0 as they did the iLLD one.

Co-authored-by: Parthiban Nallathambi <parthiban@linumiz.com>
Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
Nothing calls the IfxSrc functions any more, since the interrupt code
programs the SRC registers itself, so drop IfxSrc.c from the TC3xx and
TC4xx builds.

Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
tricore_svcall, tricore_trapcall and tricore_doirq are entered from the
vectors with jli and return with ji a11, and each spells that out with
the same TASKING and GCC variants.  Add tricore_jump_backto_link to
arch/arch.h and use it in all three.

Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>

@casaroli casaroli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR body still describes the per-core vectors: "a native one per core" and "core (.intvec_cpuN)", but the vector is now one .intvec section. The build table and "The interrupt vector is at 0x80001fe0 in all four images." come from before that change.
Fix: update the Summary and Impact to the single .intvec section, and give the build and boot result of this head (0562f23).

@xiaoxiang781216
xiaoxiang781216 merged commit 3fd1851 into apache:master Nov 10, 2026
52 checks passed
@ssekar15

Copy link
Copy Markdown
Contributor Author

@zhangyu-duck @casaroli @xiaoxiang781216 thank you for your time to review :) .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: tricore Issues related to the TriCore architecture from Infineon Board: tricore Size: M The size of the change in this PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants