Skip to content

arch/tricore: Program the system timer without the iLLD (3/n) - #21518

Merged
xiaoxiang781216 merged 3 commits into
apache:masterfrom
linumiz:native-2.3-stm
Nov 11, 2026
Merged

xiaoxiang781216 merged 3 commits into
apache:masterfrom
linumiz:native-2.3-stm

Conversation

@parthitce

@parthitce parthitce commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The TriCore system timer (tricore_systimer.c) drives the STM through the
Infineon iLLD IfxStm driver, and the chip timer setup passes it the iLLD
MODULE_STM0 and SRC names. On TC4xx those names do not exist, so the
build aliases them to MODULE_CPU0 and SRC_STMCPU0_SR2 on the command line.
tricore_systimer.c also defines its own IFX_CFG_CPU_CLOCK_FREQUENCY,
which redefines the iLLD one.

This series adds the STM base, interrupt, register offsets and bits of
CPU0 for TC3xx and TC4xx to a new internal header,
src/common/tricore_stm.h (checked against the TC39xB and TC4Dx iLLD
headers). They are kept out of the public arch/chip/chip.h. On TC4xx the STM is part of the CPU SFR space
and has a single 64-bit timer register. The system timer now programs the
STM registers directly, the same way IfxStm did: hard suspend on halt,
CMP0 on the timer bits [31:0] raising STMIR0. The TC4xx aliases are gone,
and IfxStm.c and IfxStm_cfg.c are no longer built.

Dependency

Depends on #21504.

Impact

TriCore only (arch/tricore).

  • New arch/tricore/src/common/tricore_stm.h holds the STM definitions
    of both chips.
  • tricore_systimer_initialize takes the STM base as a uintptr_t.
  • IfxStm.c and IfxStm_cfg.c are dropped from the make and cmake builds,
    and the TC4xx MODULE_STM0/SRC_STM0SR0 alias defines are removed.
  • No functional change intended: the STM registers 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 about the
    IFX_CFG_CPU_CLOCK_FREQUENCY redefinition in tricore_systimer.c 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

Runtime, ostest (all four on dca24a78322, the same code with the STM
definitions in chip.h; TC4x7 GCC rerun on the tip d8b775a):

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 dca24a78322 Nov  6 2026 16:12:47 tricore a2g-tc397-5v-tft
nsh> ostest
...
user_main: Exiting
ostest_main: Exiting with status 0

@parthitce parthitce changed the title Native 2.3 stm arch/tricore: Program the system timer without the iLLD Nov 6, 2026
@parthitce

Copy link
Copy Markdown
Contributor Author

Apart from top 3 commits, all the rest is from dependency PR's.

@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 body says "- arch/tricore/include/tc3xx/chip.h and tc4xx/chip.h get the STM" definitions, but the series adds arch/tricore/src/common/tricore_stm.h and does not change chip.h.
Fix: name tricore_stm.h in the Summary and Impact sections.

@xiaoxiang781216

Copy link
Copy Markdown
Contributor

@parthitce please rebase your patch.

@github-actions github-actions Bot added Arch: tricore Issues related to the TriCore architecture from Infineon Size: L The size of the change in this PR is large Board: tricore labels 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.

xiaoxiang781216
xiaoxiang781216 previously approved these changes Nov 8, 2026
@github-actions github-actions Bot added Size: M The size of the change in this PR is medium and removed Size: L The size of the change in this PR is large labels Nov 10, 2026
@parthitce parthitce changed the title arch/tricore: Program the system timer without the iLLD arch/tricore: Program the system timer without the iLLD (3/n) Nov 10, 2026
The system timer driver reaches the STM only through the iLLD IfxStm
driver and its MODULE_STM0 and SRC names.  Add tricore_stm.h with the
STM base, interrupt, register offsets and bits of CPU0 for TC3xx and
TC4xx, as checked against the TC39xB and TC4Dx iLLD headers.  On TC4xx
the STM is part of the CPU SFR space, has a single 64-bit timer register
and places CMP0OS at bit 1.

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
tricore_systimer.c drives the STM through IfxStm, and the timer setup
passes it the iLLD MODULE_STM0 and SRC names, which TC4xx aliases to
MODULE_CPU0 and SRC_STMCPU0_SR2 on the command line.  Program the STM
registers directly with the new STM definitions instead, the same way
IfxStm did: hard suspend on halt, CMP0 on the timer bits [31:0] raising
STMIR0.  Rename the local IFX_CFG_CPU_CLOCK_FREQUENCY, which redefined
the iLLD one, and drop the TC4xx aliases.

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
Nothing calls the IfxStm functions any more, since the system timer
programs the STM itself, so drop IfxStm.c and IfxStm_cfg.c from the
TC3xx and TC4xx builds.

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
@ssekar15

Copy link
Copy Markdown
Contributor

@casaroli @zhangyu-duck rebased to latest.

@xiaoxiang781216
xiaoxiang781216 merged commit 3117ab1 into apache:master Nov 11, 2026
53 checks passed
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 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