Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ CTestTestfile.cmake
*.dep
*.o
*.axf
*.elf
*.map
*.a
*.htm
Expand Down
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,27 +94,27 @@ The master branch has the most recent code with all new features and bug fixes.

### ThreadX
```
arc_em cortex_a12 cortex_m0 cortex_r4
arc_hs cortex_a15 cortex_m23 cortex_r5
arm11 cortex_a17 cortex_m3 cortex_r7
arm9 cortex_a34 cortex_m33
c667x cortex_a35 cortex_m4
linux cortex_a5 cortex_m55
risc-v32 cortex_a53 cortex_m7
rxv1 cortex_a55 cortex_m85
rxv2 cortex_a57
rxv3 cortex_a5x
win32 cortex_a65
xtensa cortex_a65ae
cortex_a7
cortex_a72
cortex_a73
cortex_a75
cortex_a76
cortex_a76ae
cortex_a77
cortex_a8
cortex_a9
arc_em cortex_a12 cortex_m0 cortex_r4
arc_hs cortex_a15 cortex_m23 cortex_r5
arm11 cortex_a17 cortex_m3 cortex_r7
arm9 cortex_a34 cortex_m33
c667x cortex_a35 cortex_m4
linux cortex_a5 cortex_m55
risc-v32 cortex_a53 cortex_m7
rxv1 cortex_a55 cortex_m85
rxv2 cortex_a57
rxv3 cortex_a5x
tricore_tc1_6_2 cortex_a65
win32 cortex_a65ae
xtensa cortex_a7
cortex_a72
cortex_a73
cortex_a75
cortex_a76
cortex_a76ae
cortex_a77
cortex_a8
cortex_a9
```

### ThreadX Modules
Expand Down
44 changes: 44 additions & 0 deletions cmake/tricore_tc1_6_2.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright (c) 2026 safecubed GmbH
# Copyright (c) 2026 Eclipse ThreadX contributors
#
# This program and the accompanying materials are made available under the
# terms of the MIT License which is available at
# https://opensource.org/licenses/MIT.
#
# SPDX-License-Identifier: MIT

# Portions of this file were generated with AI assistance.

# Toolchain file for the TriCore TC1.6.2 port (Infineon AURIX TC3) with the
# AURIX GCC.
#
# The port uses no driver library. See
# ports/tricore_tc1_6_2/gnu/readme_threadx.txt.

set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR tricore)

set(THREADX_ARCH "tricore_tc1_6_2")
set(THREADX_TOOLCHAIN "gnu")

set(CMAKE_C_COMPILER tricore-elf-gcc)
set(CMAKE_CXX_COMPILER tricore-elf-g++)
set(AS tricore-elf-as)
set(AR tricore-elf-ar)
set(OBJCOPY tricore-elf-objcopy)
set(OBJDUMP tricore-elf-objdump)
set(SIZE tricore-elf-size)

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)

set(CMAKE_C_FLAGS "-mcpu=tc38xx -std=c99 -fno-common -fstrict-volatile-bitfields -fdata-sections -ffunction-sections" CACHE INTERNAL "c compiler flags")
set(CMAKE_EXE_LINKER_FLAGS "-mcpu=tc38xx -Wl,--gc-sections" CACHE INTERNAL "exe link flags")
set(CMAKE_C_FLAGS_DEBUG "-O0 -g3" CACHE INTERNAL "c debug compiler flags")
set(CMAKE_C_FLAGS_RELEASE "-O0" CACHE INTERNAL "c release compiler flags")

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.

Release, RelWithDebInfo, and MinSizeRel all use -O0, so production builds are unoptimized. Please set appropriate optimization flags and verify the context-switch tests with those settings.

set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O0 -g3" CACHE INTERNAL "c relwithdebinfo compiler flags")
set(CMAKE_C_FLAGS_MINSIZEREL "-O0" CACHE INTERNAL "c minsizerel compiler flags")
18 changes: 18 additions & 0 deletions ports/tricore_tc1_6_2/gnu/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
target_sources(${PROJECT_NAME}
PRIVATE
# {{BEGIN_TARGET_SOURCES}}
${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_context_restore.c
${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_context_save.c
${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_interrupt_control.c
${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_schedule.c
${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_stack_build.c
${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_system_return.c
${CMAKE_CURRENT_LIST_DIR}/src/tx_timer_interrupt.c
# {{END_TARGET_SOURCES}}
)

target_include_directories(${PROJECT_NAME}
SYSTEM
PUBLIC
${CMAKE_CURRENT_LIST_DIR}/inc
)
57 changes: 57 additions & 0 deletions ports/tricore_tc1_6_2/gnu/example_build/build_threadx_sample.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
@echo off
rem ##########################################################################
rem Copyright (c) 2026 safecubed GmbH
rem Copyright (c) 2026 Eclipse ThreadX contributors
rem
rem This program and the accompanying materials are made available under the
rem terms of the MIT License which is available at
rem https://opensource.org/licenses/MIT.
rem
rem SPDX-License-Identifier: MIT
rem ##########################################################################

rem Portions of this file were generated with AI assistance.

rem Builds the ThreadX library tx.a and sample_threadx.elf for the AURIX TC375
rem Lite Kit without a driver library, as build_threadx_sample.sh does. The
rem start-up code is crt0-tc38xx.o of the AURIX GCC: the compiler has no TC37x
rem device, and the TC38x start-up code applies to the TC375 unchanged.
rem sample_threadx.ld replaces the memory description of the TC38x.
rem
rem CROSS_COMPILE selects the toolchain prefix. The default is the AURIX GCC
rem (tricore-elf-), which shall be on PATH.

setlocal EnableExtensions
cd /d "%~dp0"

if not defined CROSS_COMPILE set "CROSS_COMPILE=tricore-elf-"
set "CC=%CROSS_COMPILE%gcc"
rem tricore-elf-ar loads lib\bfd-plugins\libdep.a, which is no DLL.
set "AR=%CROSS_COMPILE%gcc-ar"

set "THREADX_ROOT=..\..\..\.."
set "BUILD_DIR=build"

set "CFLAGS=-mcpu=tc38xx -std=c99 -O0 -g3 -Wall -fmessage-length=0 -fno-common -fdata-sections -ffunction-sections"
set "INCLUDES=-I%THREADX_ROOT%/common/inc -I../inc"

if exist "%BUILD_DIR%" rmdir /s /q "%BUILD_DIR%"
mkdir "%BUILD_DIR%\tx" "%BUILD_DIR%\sample" || exit /b 1
del /q tx.a sample_threadx.elf sample_threadx.map 2>nul

rem The archiver reads the object list from a response file. The response file
rem uses forward slashes, because the archiver treats a backslash in it as an
rem escape character.
for %%f in (..\src\*.c %THREADX_ROOT%\common\src\*.c) do (
"%CC%" %CFLAGS% %INCLUDES% -c "%%f" -o "%BUILD_DIR%/tx/%%~nf.o" || exit /b 1
echo %BUILD_DIR%/tx/%%~nf.o>>"%BUILD_DIR%\tx.rsp"
)
"%AR%" -r tx.a @%BUILD_DIR%/tx.rsp || exit /b 1

for %%f in (sample_threadx.c tx_initialize_low_level.c) do (
"%CC%" %CFLAGS% %INCLUDES% -c "%%f" -o "%BUILD_DIR%/sample/%%~nf.o" || exit /b 1
)

"%CC%" -mcpu=tc38xx -T sample_threadx.ld -Wl,--gc-sections -Wl,-Map=sample_threadx.map ^
-o sample_threadx.elf %BUILD_DIR%/sample/sample_threadx.o ^
%BUILD_DIR%/sample/tx_initialize_low_level.o tx.a || exit /b 1
53 changes: 53 additions & 0 deletions ports/tricore_tc1_6_2/gnu/example_build/build_threadx_sample.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash
##############################################################################
# Copyright (c) 2026 safecubed GmbH
# Copyright (c) 2026 Eclipse ThreadX contributors
#
# This program and the accompanying materials are made available under the
# terms of the MIT License which is available at
# https://opensource.org/licenses/MIT.
#
# SPDX-License-Identifier: MIT
##############################################################################

# Portions of this file were generated with AI assistance.

# Builds the ThreadX library tx.a and sample_threadx.elf for the AURIX TC375
# Lite Kit without a driver library. The start-up code is crt0-tc38xx.o of
# the AURIX GCC: the compiler has no TC37x device, and the TC38x start-up
# code applies to the TC375 unchanged. sample_threadx.ld replaces the memory
# description of the TC38x.
#
# CROSS_COMPILE selects the toolchain prefix. The default is the AURIX GCC
# (tricore-elf-), which shall be on PATH.

set -e
cd "$(dirname "$0")"

: "${CROSS_COMPILE:=tricore-elf-}"
CC="${CROSS_COMPILE}gcc"
AR="${CROSS_COMPILE}ar"

THREADX_ROOT="../../../.."
BUILD_DIR="build"

CFLAGS="-mcpu=tc38xx -std=c99 -O0 -g3 -Wall -fmessage-length=0 -fno-common \
-fdata-sections -ffunction-sections"
INCLUDES="-I${THREADX_ROOT}/common/inc -I../inc"

rm -rf "${BUILD_DIR}"
mkdir -p "${BUILD_DIR}/tx" "${BUILD_DIR}/sample"
rm -f tx.a sample_threadx.elf sample_threadx.map

for src in ../src/*.c "${THREADX_ROOT}"/common/src/*.c; do
"${CC}" ${CFLAGS} ${INCLUDES} -c "${src}" -o "${BUILD_DIR}/tx/$(basename "${src%.c}").o"
done
"${AR}" -r tx.a "${BUILD_DIR}"/tx/*.o

for src in sample_threadx.c tx_initialize_low_level.c; do
obj="${BUILD_DIR}/sample/$(basename "${src%.c}").o"
"${CC}" ${CFLAGS} ${INCLUDES} -c "${src}" -o "${obj}"
done

"${CC}" -mcpu=tc38xx -T sample_threadx.ld -Wl,--gc-sections -Wl,-Map=sample_threadx.map \
-o sample_threadx.elf "${BUILD_DIR}"/sample/*.o tx.a
Loading