Skip to content

arch/tricore: Set up the watchdogs and clocks without the iLLD (4/n) - #21519

Merged
GUIDINGLI merged 3 commits into
apache:masterfrom
linumiz:native-2.4-clock
Nov 13, 2026
Merged

GUIDINGLI merged 3 commits into
apache:masterfrom
linumiz:native-2.4-clock

Conversation

@ssekar15

@ssekar15 ssekar15 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

TriCore disables the watchdogs and sets up the clocks through the Infineon
iLLD. core0_main disables the CPU and the safety (TC3xx) or system (TC4xx)
watchdog with IfxScuWdt or IfxWtu, and the startup code sets up the
oscillator, the PLLs and the clock dividers with IfxScuCcu_init (TC3xx)
or IfxClock_init (TC4xx) and their default configurations.

This series adds tricore_wdt_disable for each chip family, which drives
the SCU WDT or WTU registers directly, and tricore_clockconfig, which the
startup code now calls instead of the iLLD clock init. It runs the same
sequence with the clock, SMU and DMU registers and the same settings: on
TC3xx a 20 MHz crystal and the system PLL at 300 MHz, on TC4xx the flash
wait states, a 25 MHz crystal, the ramp oscillator and the system PLL at
500 MHz. All watchdog and clock registers end up with the same values as
before.

NuttX itself no longer calls the iLLD clock and watchdog drivers after
this series, but IfxScuCcu.c, IfxClock.c, IfxScuWdt.c and IfxWtu.c stay
in the build. Other iLLD drivers that are still built use them: IfxAsclin
takes the ASCLIN clock frequency from them for the baud rate, and IfxCpu,
IfxPort, IfxPmsPm, IfxPmsEvr, IfxScuRcu, IfxScuEru and IfxSmu use their
frequency and ENDINIT helpers. The clock hook also stays in the iLLD
startup configuration (Ifx_Cfg_Ssw), as the startup code is still the
iLLD one. These go with the native UART and startup steps that follow.

Dependency

Depends on #21518.

Impact

TriCore only (arch/tricore).

  • New chip files tc3xx_wdt.c, tc3xx_clockconfig.c, tc4xx_wdt.c and
    tc4xx_clockconfig.c, with their register definitions in
    src/tc3xx/hardware (tc3xx_wdt.h, tc3xx_clock.h, tc3xx_smu.h) and
    src/tc4xx/hardware (tc4xx_wdt.h, tc4xx_clock.h, tc4xx_smu.h,
    tc4xx_dmu.h).
  • The iLLD startup configuration (Ifx_Cfg_Ssw.h for TC3xx, Ifx_Cfg_Ssw.c
    for TC4xx) calls tricore_clockconfig for the PLL init.
  • IfxScuCcu_init and IfxClock_init are no longer linked. IfxScuCcu.c,
    IfxClock.c, IfxScuWdt.c and IfxWtu.c are still built for the iLLD UART
    driver and startup code, until those are replaced.
  • No functional change intended.

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 register definitions were moved into the hardware headers after the
board tests; the disassembly of tc3xx_wdt.o, tc3xx_clockconfig.o,
tc4xx_wdt.o and tc4xx_clockconfig.o is identical before and after the move.

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 3db1dd17fbf, the same code before the last rebase):

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

@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
@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

MemBrowse Memory Report · Explore what changed →

arduino-mega2560

  • flash: .data +13 B, .text +1,124 B (+1.7%, 68,124 B / 262,144 B, total: 26% used)
  • sram: .data +13 B (+0.5%, 2,817 B / 8,192 B, total: 34% used)

esp32-devkitc

  • ROM: .dram0.data +16 B, .flash.rodata +48 B, .flash.text +1,428 B (+1.1%, 131,708 B / 4,194,272 B, total: 3% used)
  • dram0_0_seg: .dram0.data +16 B (+0.2%, 10,056 B / 180,736 B, total: 6% used)
  • drom0_0_seg: .flash.rodata +48 B (+0.3%, 13,884 B / 4,194,272 B, total: 0% used)
  • irom0_0_seg: .flash.text +1,428 B (+1.5%, 97,580 B / 3,342,304 B, total: 3% used)

hifive1-revb

  • flash: .data +16 B, .text +1,236 B (+1.4%, 87,720 B / 4,194,304 B, total: 2% used)
  • sram: .bss +16 B, .data +16 B (+0.8%, 3,996 B / 16,384 B, total: 24% used)

mirtoo

  • kseg0_progmem: .data +16 B, .text +1,484 B (+2.2%, 70,636 B / 131,072 B, total: 54% used)
  • kseg1_datamem: .data +16 B (+0.6%, 2,620 B / 32,256 B, total: 8% used)

qemu-armv8a

  • Code: .rodata +48 B, .text.dir_allocate +72 B, .text.dir_read +120 B, .text.exec_module +4 B, .text.file_fstat +16 B, .text.file_vioctl +16 B, .text.file_vopen +12 B, .text.group_signal +12 B, .text.group_signal_handler +8 B, .text.lib_dumpvhandler +8 B, .text.mm_initialize_heap +8 B, .text.nx_pthread_exit +4 B, .text.nx_stat +16 B, .text.nxsig_action +240 B, .text.nxsig_dispatch +20 B, .text.nxsig_dispatch_unmasked +4 B, .text.nxsig_kill +4 B, .text.nxsig_notification_source +4 B, .text.nxsig_tcbdispatch +60 B, .text.nxsig_tgkill +4 B, .text.nxtask_exithook +4 B, .text.pl011_txint +20 B, .text.procfs_enum -4 B, .text.procfs_fstat +8 B, .text.procfs_open +20 B, .text.procfs_opendir +52 B, .text.procfs_readdir +44 B, .text.procfs_stat +32 B, .text.pthread_sigqueue +4 B, .text.romfs_closedir +80 B, .text.romfs_opendir +12 B, .text.sigqueue +4 B, .text.tmpfs_open +28 B, .text.uart_close +20 B, .text.uart_ioctl +136 B, .text.uart_open +32 B, .text.uart_poll +28 B, .text.uart_poll_notify +12 B, .text.uart_putchars +36 B, .text.uart_putxmitbuf +64 B, .text.uart_readv +108 B, .text.uart_register +8 B, .text.uart_tcdrain.isra.0 +52 B, .text.uart_writev +80 B, .text.uart_xmitchars +36 B, .text.umm_initialize -4 B, .text.uptime_dup +8 B, .text.uptime_read -12 B (+0.6%, 366,420 B)
  • Data: .data.g_uart1port +24 B (+0.0%, 77,941 B)

qemu-intel64

  • Code: .text +2,683 B (+0.0%, 8,699,171 B)
  • Data: .data +32 B, .rodata +224 B (+0.2%, 127,001 B)

rx65n-rsk2mb

  • RAM: .data +16 B (+0.2%, 6,736 B / 262,144 B, total: 3% used)
  • ROM: .rodata +8 B, .text +1,024 B (+1.1%, 93,092 B / 2,097,152 B, total: 4% used)

s698pm-dkit

  • Code: .text +4,032 B (+1.0%, 395,168 B)
  • Data: .data +48 B (+0.4%, 11,995 B)

stm32-nucleo-f103rb

  • flash: .data +16 B, .text +824 B (+2.4%, 36,204 B / 131,072 B, total: 28% used)
  • sram: .data +16 B (+0.6%, 2,484 B / 20,480 B, total: 12% used)

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

acassis
acassis previously approved these changes Nov 6, 2026

@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 has an older copy of the #21518 timer commits (8a116e4 puts the STM definitions in arch/tricore/include/tc3xx/chip.h and tc4xx/chip.h; #21518 now adds arch/tricore/src/common/tricore_stm.h), so it conflicts with #21518 in tricore_systimer.c and tc3xx/tc4xx_timerisr.c.
Fix: rebase the three watchdog and clock commits on the current #21518 head.

@ssekar15 ssekar15 changed the title arch/tricore: Set up the watchdogs and clocks without the iLLD arch/tricore: Set up the watchdogs and clocks without the iLLD (4/n) Nov 8, 2026
@michallenc
michallenc requested a review from casaroli November 9, 2026 15:26
casaroli
casaroli previously approved these changes Nov 9, 2026

@xiaoxiang781216 xiaoxiang781216 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.

let's merge #21504 first.

Comment thread arch/tricore/src/common/tricore_stm.h Resolved
@ssekar15

Copy link
Copy Markdown
Contributor Author

@casaroli rebased to latest, please review/approve.

@ssekar15

Copy link
Copy Markdown
Contributor Author

@xiaoxiang781216 ready to merge, please review/merge

@xiaoxiang781216

Copy link
Copy Markdown
Contributor

@xiaoxiang781216 ready to merge, please review/merge

look at this comment: #21519 (comment)

@ssekar15

Copy link
Copy Markdown
Contributor Author

@xiaoxiang781216 ready to merge, please review/merge

look at this comment: #21519 (comment)

addressed

@ssekar15

Copy link
Copy Markdown
Contributor Author

@acassis @casaroli ping for review

ssekar15 and others added 3 commits November 13, 2026 09:07
core0_main disables the CPU and the safety (TC3xx) or system (TC4xx)
watchdog through IfxScuWdt or IfxWtu.  Add tricore_wdt_disable for each
chip family, which does the same with the SCU WDT or WTU registers: read
the password, clear ENDINIT (TC3xx) or unlock CTRLA (TC4xx), request the
disable and lock again.

Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
The startup code sets up the TC3xx oscillator, PLLs and clock dividers
with the iLLD IfxScuCcu_init and its TC39xB default configuration.  Add
tricore_clockconfig, which runs the same sequence with the SCU and SMU
registers: switch to the backup clock, set up the 20 MHz crystal and
both PLLs, wait for the lock, switch back, set the clock dividers and
raise the system PLL to 300 MHz in steps.  The startup code now calls it.
The clock registers end up with the same values as with IfxScuCcu_init.

Co-authored-by: Parthiban Nallathambi <parthiban@linumiz.com>
Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
The startup code sets up the TC4xx flash wait states, clock dividers,
oscillators and PLLs with the iLLD IfxClock_init and its TC4Dx default
configuration.  Add tricore_clockconfig for TC4xx, which runs the same
sequence with the clock, SMU and DMU registers: set the wait states and
dividers, power up the 25 MHz crystal and the ramp oscillator, set up
both PLLs, ramp the system clock up and switch both clocks to the PLLs.
The long waits service the watchdogs, as IfxClock does.  The clock
registers end up with the same values as with IfxClock_init.

Co-authored-by: Parthiban Nallathambi <parthiban@linumiz.com>
Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
@ssekar15

Copy link
Copy Markdown
Contributor Author

adding @GUIDINGLI

@GUIDINGLI
GUIDINGLI merged commit 2c7259f into apache:master Nov 13, 2026
55 of 71 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: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants