arch: add TriCore architecture and Infineon AURIX platform support#19041
arch: add TriCore architecture and Infineon AURIX platform support#19041parthitce wants to merge 12 commits into
Conversation
The iLLD path requires an external SDK download at build time. An upstream tree cannot depend on a build-time network fetch, and the requirement also prevents any offline build. The chip-per-name directories under arch/tricore/src and boards/tricore were built around that iLLD path. Removing them together with the SDK lets the following commits introduce a family-based layout against a clean slate. Co-Authored-By: Saravanan Sekar <saravanan@linumiz.com> Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
The arch code introduced in the following commits is organized by family: arch/tricore/src/tc3x and arch/tricore/src/tc4x hold the code shared across the TC3X and TC4X chip variants respectively. On AURIX all chips in a family share their ISA and peripherals, so the family-shared code is the bulk of the port. Restructure Kconfig to match: the user selects a family first (ARCH_CHIP_FAMILY_TC3X or ARCH_CHIP_FAMILY_TC4X) and then picks a chip inside it. The selectors then mirror the directory layout. Only the TC1.8 ISA has its own Kconfig symbol (TRICORE_TC18), which TC4X selects; TC3X runs as the !TRICORE_TC18 fallback in assembly. Co-Authored-By: Parthiban Nallathambi <parthiban@linumiz.com> Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
GCC and HighTec clang are the two toolchains that build the TriCore port today. GCC (tricore-elf-gcc, AURIX GCC) is the open toolchain published by Infineon. HighTec clang is the only LLVM build that currently targets TriCore and consumes a HighTec license at runtime. Wire each with a Kconfig selector and a matching dispatcher under Toolchain.defs and Toolchain.cmake so a board picks its toolchain once at configure time. The earlier Tasking dispatcher is removed in the same commit because the upstream port does not include a configuration that builds under Tasking. Co-Authored-By: Saravanan Sekar <saravanan@linumiz.com> Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
Add TriCore architecture port supporting the TC1.6P core (AURIX TC3X family) and the TC1.8P core (AURIX TC4X family) from Infineon. Includes reset vector, context switching using TriCore upper and lower context save areas (CSA), interrupt management with the BIV vector table, trap and exception handling with the BTV vector table, syscall interface, and linker scripts for both GCC and HighTec clang. The TC3X and TC4X families share the same trap and interrupt model, so the core paths sit under arch/tricore/src/common and serve both families. Watchdog disable diverges between the families (ENDINIT password rotation on TC3X, CCU on TC4X) and lives in small per-family helpers under tc3x/ and tc4x/. Co-Authored-By: Parthiban Nallathambi <parthiban@linumiz.com> Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
A tick source is required to drive the scheduler and any sleep or timeout primitive. The System Timer (STM) is always present on both AURIX families, runs from the SCU clock and has the resolution and range the scheduler expects, so it is the natural tick source for the port. Use the oneshot lower-half binding so the same driver serves tickless and periodic configurations without a second timer. Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
The SCU PLL has to be brought up at boot so peripherals run at their intended rate. UART baud, STM tick interval and every other timed peripheral derive from the SCU clock tree, so the port configures the PLL before any driver starts. The TC3X SCU registers that select the PLL source and dividers are write-protected by the SCU watchdog ENDINIT bit, which is itself guarded by a per-watchdog password. Without rotating the password and clearing ENDINIT, the clock writes are silently dropped and the PLL never reaches the requested frequency. Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
The SCU PLL has to be brought up at boot so peripherals run at their intended rate. TC4X configures the PLL and clock tree through the Clock Control Unit (CCU). Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
Peripherals need their input and output pads muxed to the right alternate function before they can move signals. Add GPIO pinmux helpers for both AURIX families so peripheral drivers added later in the series can call aurix_config_gpio() at init time and then talk to the line. Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
Generic UART interface driver for the ASCLIN serial peripheral on the AURIX family. A single driver serves both TC3X and TC4X. Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
TC375 Lite Kit board support for the AURIX TC3X family. Only UART is supported; NSH defconfigs provided for both GCC and HighTec clang toolchains. Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
TC4D7 Lite Kit board support for the AURIX TC4X family. Only UART is supported; NSH defconfigs provided for both GCC and HighTec clang toolchains. Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
Cover the feature matrix per AURIX family, architecture notes (CSA context switching, interrupt and trap dispatch), toolchain options (GCC and HighTec LLVM), source layout under arch/tricore/src, and the supported drivers (ASCLIN UART, GPIO, STM). Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
| @@ -1,139 +0,0 @@ | |||
| # ############################################################################## | |||
| # arch/tricore/src/cmake/ToolchainTasking.cmake | |||
There was a problem hiding this comment.
why drop Tasking toolchain support
There was a problem hiding this comment.
We do not have Tasking toolchain access, we will update PR with Tasking.
| #define EXTERN extern | ||
| #endif | ||
|
|
||
| int setjmp(jmp_buf env); |
There was a problem hiding this comment.
why remove setjmp/longjmp implementation
There was a problem hiding this comment.
implementation is still part of libs/libc/machine/tricore/arch_setjmp.c, header file removed accidentally.
There was a problem hiding this comment.
for the code which modify the original code, it's better to keep the new implementation and removed one in the same patch (one patch modify one standalone function), so the reviewer can compare the implementation side by side to ensure the new implementation doesn't lose the functionality or introduce the break change.
| @@ -0,0 +1,147 @@ | |||
| /**************************************************************************** | |||
| * arch/tricore/src/common/tricore-llvm.ld | |||
There was a problem hiding this comment.
why add board/chip specific ld in arch common code
There was a problem hiding this comment.
current NuttX follows the ld file in board directory which is more of duplicated, idea is to keep common ld file specific to SoC and difference/fragments shall be kept in board. IMHO moving ld to aurix is valid, suggest.
| @@ -1,524 +0,0 @@ | |||
| /**************************************************************************** | |||
| * arch/tricore/src/common/tricore_cache.c | |||
There was a problem hiding this comment.
why remove the cache code
There was a problem hiding this comment.
removed as iLLD reference. Current PR holds without cache support, will be added in follow-up PR.
| @@ -1,412 +0,0 @@ | |||
| /**************************************************************************** | |||
| * arch/tricore/src/common/tricore_hwdebug.c | |||
There was a problem hiding this comment.
why remove hwdebug code
| @@ -1,1244 +0,0 @@ | |||
| /**************************************************************************** | |||
| * arch/tricore/src/common/tricore_mpu.c | |||
There was a problem hiding this comment.
why remove mpu code
|
@parthitce your pr removes many functionality (cache, mpu, hwdebug, perf, setjmp/longjmp, tasking compiler), please organize your patch that any change to the origin code need split to the small but self-contained patch and describe the reason you make this change clearly. |
linguini1
left a comment
There was a problem hiding this comment.
This is great news! But same comments as Xiang; could you please split this change into multiple PRs?
Also for your test section, please link directly to the test logs :)
| ############################################################################ | ||
|
|
||
| ifeq ($(CONFIG_TRICORE_TOOLCHAIN_TASKING),y) | ||
| include $(TOPDIR)/arch/tricore/src/common/ToolchainTasking.defs |
There was a problem hiding this comment.
Why was the TASKING toolchain removed?
There was a problem hiding this comment.
We do not have Tasking toolchain access, we will update PR with Tasking.
@xiaoxiang781216 Thanks for the quick review. Tasking: Regarding the tasking support, we should be enable them back. This was mainly because of missing licensed access to it.
Currently commits are logically grouped. Let us know if this needs spliting. |
@linguini1 This is the base architecture changes and the commits are logically grouped. Splitting into multiple PR's isn't possible as the current scope is to have a working TriCore + SoC + Board.
otest and other basic test coverages are done. Which specific logs needs to be attached? Console or general test reports? |
Yes, you need split the big patch which modify the current code base into small one like this:
and ensure the build and boot still work after applying each patch. |
Each commit must pass the CI builds and not break anything as an atomic unit. So in theory if your commits follow that, each one could be a separate PR, which is much easier to review :)
Those logs are fine! I just wasn't able to find them quickly via your link. It's best if you attach them as files to the PR and/or copy paste them as text. Probably the former is best. |
Summary
This PR adds support for the TriCore architecture used in the Infineon AURIX TC3X (TC1.6P core) and TC4X (TC1.8P core) SoC families. It also adds support for two evaluation boards, the AURIX Lite Kit TC375 and the AURIX Lite Kit TC4D7.
The TriCore code that was in apache/nuttx before this change depends on the iLLD vendor SDK that has to be downloaded at build time. That arrangement does not fit an upstream tree and breaks any offline build. The chip-per-name directory layout under arch/tricore/src and boards/tricore was built around that iLLD path and only ever held two boards that do not build on current master and are not in CI.
This PR removes the iLLD path along with those legacy directories and replaces them with a family-first layout under arch/tricore/src: common, aurix (shared peripherals), tc3x and tc4x. The new port uses direct SFR access and works with both GNU GCC (tricore-elf-gcc) and the HighTec LLVM compiler.
Impact
Testing
Host machine: Linux x86_64.
Toolchains:
Boards used on real hardware:
Hardware boot and NSH:
ostest with CONFIG_TESTING_OSTEST=y and CONFIG_TESTING_OSTEST_LOOPS=2:
Subtests exercised by ostest include mutex_test, sched_lock, cond_test, cancel_test (pthread_join against a cancelled thread), robust_test (robust mutexes), the round-robin scheduler test with two get_primes threads, and task_restart. The thread-heavy workload exercises the CSA allocator on every task and thread creation.
Style and compliance:
Full boot and ostest logs from both boards are kept in the local test output directory.
All the downstream efforts are tracked at https://gitlab.com/linumiz/infineon/release
Signed-off-by: Saravanan Sekar saravanan@linumiz.com
Signed-off-by: Parthiban Nallathambi parthiban@linumiz.com