From 9bbecc27abbba5f2905948c15707a49e1da5d601 Mon Sep 17 00:00:00 2001 From: chao an Date: Mon, 23 Sep 2024 16:18:01 +0800 Subject: [PATCH] cmake/tricore/tasking: add cmake build for tasking toolchain cmake build for tasking toolchain Signed-off-by: chao an --- CMakeLists.txt | 12 +- arch/tricore/src/CMakeLists.txt | 1 - arch/tricore/src/cmake/Toolchain.cmake | 130 +-------------- arch/tricore/src/cmake/ToolchainGnuc.cmake | 150 ++++++++++++++++++ arch/tricore/src/cmake/ToolchainTasking.cmake | 138 ++++++++++++++++ arch/tricore/src/cmake/platform.cmake | 57 +++---- arch/tricore/src/cmake/tc3xx.cmake | 7 +- arch/tricore/src/tc3xx/CMakeLists.txt | 8 + arch/tricore/src/tc3xx/tc3xx_libc.c | 2 - .../tc397/scripts/Lcf_Tasking_Tricore_Tc.lsl | 2 +- 10 files changed, 345 insertions(+), 162 deletions(-) create mode 100644 arch/tricore/src/cmake/ToolchainGnuc.cmake create mode 100644 arch/tricore/src/cmake/ToolchainTasking.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 702215b1a6..b841425bac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -485,7 +485,7 @@ if(MSVC) # data -wd4305 # 'context' : truncation from 'type1' to 'type2' ) -else() +elseif(NOT CONFIG_ARCH_TOOLCHAIN_TASKING) add_compile_options( # system wide warnings -Wall $<$:-Wstrict-prototypes> -Wshadow -Wundef @@ -640,9 +640,13 @@ set(nuttx_libs ${nuttx_kernel_libs} ${nuttx_system_libs} ${nuttx_apps_libs} if(NOT CONFIG_ARCH_SIM) # TODO: nostart/nodefault not applicable to nuttx toolchain - target_link_libraries( - nuttx PRIVATE ${NUTTX_EXTRA_FLAGS} -T${ldscript} -Wl,--start-group - ${nuttx_libs} -Wl,--end-group) + if(CONFIG_ARCH_TOOLCHAIN_TASKING) + target_link_libraries(nuttx PRIVATE --lsl-file=${ldscript} ${nuttx_libs}) + else() + target_link_libraries( + nuttx PRIVATE ${NUTTX_EXTRA_FLAGS} -T${ldscript} -Wl,--start-group + ${nuttx_libs} -Wl,--end-group) + endif() # generate binary outputs in different formats (.bin, .hex, etc) nuttx_generate_outputs(nuttx) diff --git a/arch/tricore/src/CMakeLists.txt b/arch/tricore/src/CMakeLists.txt index b40f984127..b756133b50 100644 --- a/arch/tricore/src/CMakeLists.txt +++ b/arch/tricore/src/CMakeLists.txt @@ -18,7 +18,6 @@ # # ############################################################################## -add_subdirectory(${ARCH_SUBDIR}) add_subdirectory(${NUTTX_CHIP_ABS_DIR} EXCLUDE_FROM_ALL exclude_chip) add_subdirectory(common) diff --git a/arch/tricore/src/cmake/Toolchain.cmake b/arch/tricore/src/cmake/Toolchain.cmake index ce461a8fac..df7aa17f8d 100644 --- a/arch/tricore/src/cmake/Toolchain.cmake +++ b/arch/tricore/src/cmake/Toolchain.cmake @@ -20,130 +20,8 @@ # Toolchain -set(CMAKE_SYSTEM_NAME Generic) -set(CMAKE_SYSTEM_VERSION 1) - -set(ARCH_SUBDIR) - -if(CONFIG_ARCH_TC3XX) # TC3XX - set(ARCH_SUBDIR tc3xx) -else() - set(ARCH_SUBDIR tc3xx) -endif() - -include(${ARCH_SUBDIR}) - -set(TOOLCHAIN_PREFIX tricore-elf) -set(CMAKE_LIBRARY_ARCHITECTURE ${TOOLCHAIN_PREFIX}) -set(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN_PREFIX}) -set(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN_PREFIX}) - -set(CMAKE_ASM_COMPILER ${TOOLCHAIN_PREFIX}-gcc) -set(CMAKE_C_COMPILER ${CMAKE_ASM_COMPILER}) -set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++) -set(CMAKE_STRIP ${TOOLCHAIN_PREFIX}-strip --strip-unneeded) -set(CMAKE_OBJCOPY ${TOOLCHAIN_PREFIX}-objcopy) -set(CMAKE_OBJDUMP ${TOOLCHAIN_PREFIX}-objdump) - -set(CMAKE_LINKER ${TOOLCHAIN_PREFIX}-gcc) -set(CMAKE_LD ${TOOLCHAIN_PREFIX}-gcc) -set(CMAKE_AR ${TOOLCHAIN_PREFIX}-gcc-ar) -set(CMAKE_NM ${TOOLCHAIN_PREFIX}-gcc-nm) -set(CMAKE_RANLIB ${TOOLCHAIN_PREFIX}-gcc-ranlib) - -# override the ARCHIVE command - -set(CMAKE_C_ARCHIVE_CREATE " rcs ") -set(CMAKE_CXX_ARCHIVE_CREATE " rcs ") -set(CMAKE_ASM_ARCHIVE_CREATE " rcs ") - -# Architecture flags - -add_compile_options(-fno-common) -add_compile_options(-Wall -Wshadow -Wundef) -add_compile_options(-nostdlib) - -if(CONFIG_DEBUG_CUSTOMOPT) - add_compile_options(${CONFIG_DEBUG_OPTLEVEL}) -elseif(CONFIG_DEBUG_FULLOPT) - add_compile_options(-Os) -endif() - -if(NOT CONFIG_DEBUG_NOOPT) - add_compile_options(-fno-strict-aliasing) -endif() - -if(CONFIG_FRAME_POINTER) - add_compile_options(-fno-omit-frame-pointer -fno-optimize-sibling-calls) -else() - add_compile_options(-fomit-frame-pointer) -endif() - -if(CONFIG_STACK_CANARIES) - add_compile_options(-fstack-protector-all) -endif() - -if(CONFIG_ARCH_COVERAGE) - add_compile_options(-fprofile-generate -ftest-coverage) -endif() - -# Optimization of unused sections - -if(CONFIG_DEBUG_OPT_UNUSED_SECTIONS) - add_link_options(-Wl,--gc-sections) - add_compile_options(-ffunction-sections -fdata-sections) -endif() - -# Debug --whole-archive - -if(CONFIG_DEBUG_LINK_WHOLE_ARCHIVE) - add_link_options(-Wl,--whole-archive) -endif() - -if(CONFIG_ENDIAN_BIG) - add_compile_options(-mbig-endian) -endif() - -# Link Time Optimization - -if(CONFIG_LTO_THIN) - add_compile_options(-flto=thin) -elseif(CONFIG_LTO_FULL) - add_compile_options(-flto) - if(CONFIG_ARCH_TOOLCHAIN_GNU) - add_compile_options(-fno-builtin) - add_compile_options(-fuse-linker-plugin) - endif() -endif() - -# Debug link map - -if(CONFIG_DEBUG_LINK_MAP) - add_link_options(-Wl,--cref -Wl,-Map=nuttx.map) -endif() - -if(CONFIG_DEBUG_SYMBOLS) - add_compile_options(-g) -endif() - -add_link_options(-Wl,--no-warn-rwx-segments) - -add_compile_options(-Wno-attributes -Wno-unknown-pragmas - $<$:-Wstrict-prototypes>) - -if(CONFIG_CXX_STANDARD) - add_compile_options($<$:-std=${CONFIG_CXX_STANDARD}>) -endif() - -if(NOT CONFIG_LIBCXXTOOLCHAIN) - add_compile_options($<$:-nostdinc++>) -endif() - -if(NOT CONFIG_CXX_EXCEPTION) - add_compile_options($<$:-fno-exceptions> - $<$:-fcheck-new>) -endif() - -if(NOT CONFIG_CXX_RTTI) - add_compile_options($<$:-fno-rtti>) +if(CONFIG_TRICORE_TOOLCHAIN_TASKING) + include(${CMAKE_CURRENT_LIST_DIR}/ToolchainTasking.cmake) +elseif(CONFIG_TRICORE_TOOLCHAIN_GNU) + include(${CMAKE_CURRENT_LIST_DIR}/ToolchainGnuc.cmake) endif() diff --git a/arch/tricore/src/cmake/ToolchainGnuc.cmake b/arch/tricore/src/cmake/ToolchainGnuc.cmake new file mode 100644 index 0000000000..d7f679383b --- /dev/null +++ b/arch/tricore/src/cmake/ToolchainGnuc.cmake @@ -0,0 +1,150 @@ +# ############################################################################## +# arch/tricore/src/cmake/Toolchain.cmake +# +# Licensed to the Apache Software Foundation (ASF) under one or more contributor +# license agreements. See the NOTICE file distributed with this work for +# additional information regarding copyright ownership. The ASF licenses this +# file to you under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +# +# ############################################################################## + +# Toolchain + +set(CMAKE_SYSTEM_NAME Generic) +set(CMAKE_SYSTEM_VERSION 1) + +set(ARCH_SUBDIR) + +if(CONFIG_ARCH_TC3XX) # TC3XX + set(ARCH_SUBDIR tc3xx) +else() + set(ARCH_SUBDIR tc3xx) +endif() + +include(${ARCH_SUBDIR}) + +set(TOOLCHAIN_PREFIX tricore-elf) +set(CMAKE_LIBRARY_ARCHITECTURE ${TOOLCHAIN_PREFIX}) +set(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN_PREFIX}) +set(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN_PREFIX}) + +set(CMAKE_ASM_COMPILER ${TOOLCHAIN_PREFIX}-gcc) +set(CMAKE_C_COMPILER ${CMAKE_ASM_COMPILER}) +set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++) +set(CMAKE_STRIP ${TOOLCHAIN_PREFIX}-strip --strip-unneeded) +set(CMAKE_OBJCOPY ${TOOLCHAIN_PREFIX}-objcopy) +set(CMAKE_OBJDUMP ${TOOLCHAIN_PREFIX}-objdump) +set(CMAKE_ASM_GENERATION_TOOL hldumparm) + +set(CMAKE_LINKER ${TOOLCHAIN_PREFIX}-gcc) +set(CMAKE_LD ${TOOLCHAIN_PREFIX}-gcc) +set(CMAKE_AR ${TOOLCHAIN_PREFIX}-gcc-ar) +set(CMAKE_NM ${TOOLCHAIN_PREFIX}-gcc-nm) +set(CMAKE_RANLIB ${TOOLCHAIN_PREFIX}-gcc-ranlib) + +# override the ARCHIVE command + +set(CMAKE_C_ARCHIVE_CREATE " rcs ") +set(CMAKE_CXX_ARCHIVE_CREATE " rcs ") +set(CMAKE_ASM_ARCHIVE_CREATE " rcs ") + +# Architecture flags + +add_compile_options(-fno-common) +add_compile_options(-Wall -Wshadow -Wundef) +add_compile_options(-nostdlib) + +if(CONFIG_DEBUG_CUSTOMOPT) + add_compile_options(${CONFIG_DEBUG_OPTLEVEL}) +elseif(CONFIG_DEBUG_FULLOPT) + add_compile_options(-Os) +endif() + +if(NOT CONFIG_DEBUG_NOOPT) + add_compile_options(-fno-strict-aliasing) +endif() + +if(CONFIG_FRAME_POINTER) + add_compile_options(-fno-omit-frame-pointer -fno-optimize-sibling-calls) +else() + add_compile_options(-fomit-frame-pointer) +endif() + +if(CONFIG_STACK_CANARIES) + add_compile_options(-fstack-protector-all) +endif() + +if(CONFIG_ARCH_COVERAGE) + add_compile_options(-fprofile-generate -ftest-coverage) +endif() + +# Optimization of unused sections + +if(CONFIG_DEBUG_OPT_UNUSED_SECTIONS) + add_link_options(-Wl,--gc-sections) + add_compile_options(-ffunction-sections -fdata-sections) +endif() + +# Debug --whole-archive + +if(CONFIG_DEBUG_LINK_WHOLE_ARCHIVE) + add_link_options(-Wl,--whole-archive) +endif() + +if(CONFIG_ENDIAN_BIG) + add_compile_options(-mbig-endian) +endif() + +# Link Time Optimization + +if(CONFIG_LTO_THIN) + add_compile_options(-flto=thin) +elseif(CONFIG_LTO_FULL) + add_compile_options(-flto) + if(CONFIG_ARCH_TOOLCHAIN_GNU) + add_compile_options(-fno-builtin) + add_compile_options(-fuse-linker-plugin) + endif() +endif() + +# Debug link map + +if(CONFIG_DEBUG_LINK_MAP) + add_link_options(-Wl,--cref -Wl,-Map=nuttx.map) +endif() + +if(CONFIG_DEBUG_SYMBOLS) + add_compile_options(-g) +endif() + +add_link_options(-Wl,--no-warn-rwx-segments) + +add_compile_options(-Wno-attributes -Wno-unknown-pragmas + $<$:-Wstrict-prototypes>) + +if(CONFIG_CXX_STANDARD) + add_compile_options($<$:-std=${CONFIG_CXX_STANDARD}>) +endif() + +if(NOT CONFIG_LIBCXXTOOLCHAIN) + add_compile_options($<$:-nostdinc++>) +endif() + +if(NOT CONFIG_CXX_EXCEPTION) + add_compile_options($<$:-fno-exceptions> + $<$:-fcheck-new>) +endif() + +if(NOT CONFIG_CXX_RTTI) + add_compile_options($<$:-fno-rtti>) +endif() diff --git a/arch/tricore/src/cmake/ToolchainTasking.cmake b/arch/tricore/src/cmake/ToolchainTasking.cmake new file mode 100644 index 0000000000..2fabf17fcb --- /dev/null +++ b/arch/tricore/src/cmake/ToolchainTasking.cmake @@ -0,0 +1,138 @@ +# ############################################################################## +# arch/tricore/src/cmake/Toolchain.cmake +# +# Licensed to the Apache Software Foundation (ASF) under one or more contributor +# license agreements. See the NOTICE file distributed with this work for +# additional information regarding copyright ownership. The ASF licenses this +# file to you under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +# +# ############################################################################## + +# Toolchain + +set(CMAKE_SYSTEM_NAME Generic) +set(CMAKE_SYSTEM_VERSION 1) + +set(ARCH_SUBDIR) + +if(CONFIG_ARCH_TC3XX) # TC3XX + set(ARCH_SUBDIR tc3xx) +else() + set(ARCH_SUBDIR tc3xx) +endif() + +include(${ARCH_SUBDIR}) + +set(CMAKE_ASM_COMPILER cctc) +set(CMAKE_C_COMPILER ${CMAKE_ASM_COMPILER}) +set(CMAKE_CXX_COMPILER cctc) +set(CMAKE_STRIP strip --strip-unneeded) +set(CMAKE_OBJCOPY echo) +set(CMAKE_OBJDUMP elfdump) + +set(CMAKE_LINKER cctc) +set(CMAKE_LD cctc) +set(CMAKE_AR artc -r) +set(CMAKE_NM nm) +set(CMAKE_RANLIB ranlib) + +# override the ARCHIVE command + +set(CMAKE_C_ARCHIVE_CREATE " rcs ") +set(CMAKE_CXX_ARCHIVE_CREATE " rcs ") +set(CMAKE_ASM_ARCHIVE_CREATE " rcs ") + +# Architecture flags + +add_compile_options(--lsl-core=vtc) +add_compile_options(--iso=99) +add_compile_options(--language=+gcc,+volatile,-strings,-kanji) + +if(CONFIG_DEBUG_CUSTOMOPT) + add_compile_options(${CONFIG_DEBUG_OPTLEVEL}) +elseif(CONFIG_DEBUG_FULLOPT) + add_compile_options(-Os) +endif() + +# pragma align <4> (default: 0) + +add_compile_options(--align=4) + +# Always use 32-bit integers for enumeration + +add_compile_options(--integer-enumeration) + +# tradeoff between speed (-t0) and size (-t4) (default: 4) + +add_compile_options(--tradeoff=2) + +# enable symbolic debug information + +if(CONFIG_DEBUG_SYMBOLS) + add_compile_options(--debug-info=default) + add_compile_options(--keep-temporary-files) + add_link_options(-g) +endif() + +# merge source code with assembly output + +add_compile_options(--source) + +# generate alignment depending on assume_if hints + +add_compile_options(--branch-target-align) + +# cmake-format: off +# Since nuttx uses too many of GNU extensions in the implementation of +# FPU-related library functions, which is not supported in tasking, so currently +# we cannot use FPU-related configurations to manage it. +# +# Just set fp-model to Double Precision: +# --fp-model[=,...] floating-point model (default: cFlnrSTz) +# 0 alias for --fp-model=CFLNRStZ (strict) +# 1 alias for --fp-model=cFLNRSTZ (precise) +# 2 alias for --fp-model=cFlnrSTz (fast-dp) +# 3 alias for --fp-model=cflnrSTz (fast-sp) +# cmake-format: on + +add_compile_options(--fp-model=2) +add_link_options(--fp-model=2) +add_link_options(-lfp_fpu) + +add_link_options(--hex-format=s -Wl-OtxYcL -Wl-mcrfiklsmnoduq) +add_link_options(-lrt) + +# cmake-format: off +# ctc W500: ["stdio/lib_libvsprintf.c" 884/29] expression without effect +# ctc W507: ["mm_heap/mm_malloc.c" 238/64] variable "nodesize" is possibly uninitialized +# ctc W508: ["misc/lib_impure.c" 1/1] empty source file +# ctc W525: ["getopt.c" 678/3] discarded 'const' qualifier at assignment: conversion from char const * to char * +# ctc W527: ["stdlib/lib_strtold.c" 565/23] constant of type "double" saturated +# ctc W526: ["include/sys/epoll.h" 87/5] enumeration constant shall be representable as 'int' +# ctc W529: ["wchar/lib_mbrtowc.c" 88/35] overflow in constant expression of type "unsigned long int" +# ctc W544: ["wqueue/kwork_thread.c" 210/32] unreachable code +# ctc W549: ["unistd/lib_getopt_common.c" 544/15] condition is always true +# ctc W553: ["vfs/fs_fcntl.c" 231/7] no 'break' or comment before case label +# ctc W557: ["common/tricore_main.c" 58/11] possible infinite loop +# ctc W560: ["tmpfs/fs_tmpfs.c" 232/25] possible truncation at implicit conversion to type "unsigned short int" +# ctc W562: ["mm_heap/mm_memalign.c" 70/20] unary minus applied to unsigned value +# ctc W558: ["include/nuttx/power/regulator.h" 224/36] struct/union/enum definition in parameter declaration +# ctc W587: ["stdlib/lib_strtold.c" 571/23] underflow on constant of type "double" +# ctc W588: ["misc/lib_glob.c" 150/13] dead assignment to "i" eliminated +# ctc W589: ["inode/fs_inodesearch.c" 72/8] pointer assumed to be nonzero - test removed +# cmake-format: on + +set(TASKING_WARNINGS + 500,507,508,525,526,527,529,544,549,553,560,562,557,558,587,588,589) + +add_compile_options(--pass-c=--no-warnings=${TASKING_WARNINGS}) diff --git a/arch/tricore/src/cmake/platform.cmake b/arch/tricore/src/cmake/platform.cmake index ce367e09cf..0c7ef6a60d 100644 --- a/arch/tricore/src/cmake/platform.cmake +++ b/arch/tricore/src/cmake/platform.cmake @@ -17,6 +17,7 @@ # the License. # # ############################################################################## + get_directory_property(TOOLCHAIN_DIR_FLAGS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_OPTIONS) @@ -36,37 +37,39 @@ endforeach() separate_arguments(CMAKE_C_FLAG_ARGS NATIVE_COMMAND ${CMAKE_C_FLAGS}) -execute_process( - COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS} - --print-libgcc-file-name - OUTPUT_STRIP_TRAILING_WHITESPACE - OUTPUT_VARIABLE extra_library) -list(APPEND EXTRA_LIB ${extra_library}) -if(NOT CONFIG_LIBM) +if(CONFIG_TRICORE_TOOLCHAIN_GNU) execute_process( COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS} - --print-file-name=libm.a + --print-libgcc-file-name OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE extra_library) list(APPEND EXTRA_LIB ${extra_library}) -endif() -if(CONFIG_LIBSUPCXX) - execute_process( - COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS} - --print-file-name=libsupc++.a - OUTPUT_STRIP_TRAILING_WHITESPACE - OUTPUT_VARIABLE extra_library) - list(APPEND EXTRA_LIB ${extra_library}) -endif() -if(CONFIG_ARCH_COVERAGE) - execute_process( - COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS} - --print-file-name=libgcov.a - OUTPUT_STRIP_TRAILING_WHITESPACE - OUTPUT_VARIABLE extra_library) - list(APPEND EXTRA_LIB ${extra_library}) -endif() + if(NOT CONFIG_LIBM) + execute_process( + COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS} + --print-file-name=libm.a + OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_VARIABLE extra_library) + list(APPEND EXTRA_LIB ${extra_library}) + endif() + if(CONFIG_LIBSUPCXX) + execute_process( + COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS} + --print-file-name=libsupc++.a + OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_VARIABLE extra_library) + list(APPEND EXTRA_LIB ${extra_library}) + endif() + if(CONFIG_ARCH_COVERAGE) + execute_process( + COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS} + --print-file-name=libgcov.a + OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_VARIABLE extra_library) + list(APPEND EXTRA_LIB ${extra_library}) + endif() -nuttx_add_extra_library(${EXTRA_LIB}) + nuttx_add_extra_library(${EXTRA_LIB}) -set(PREPROCES ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} -E -P -x c) + set(PREPROCES ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} -E -P -x c) +endif() diff --git a/arch/tricore/src/cmake/tc3xx.cmake b/arch/tricore/src/cmake/tc3xx.cmake index 56d2061a6e..06d95af528 100644 --- a/arch/tricore/src/cmake/tc3xx.cmake +++ b/arch/tricore/src/cmake/tc3xx.cmake @@ -21,7 +21,12 @@ set(PLATFORM_FLAGS) if(CONFIG_ARCH_CHIP_TC397) - list(APPEND PLATFORM_FLAGS -mcpu=tc39xx -mtc162) + if(CONFIG_TRICORE_TOOLCHAIN_TASKING) + add_compile_options(--cpu=tc39xb) + add_link_options(-Ctc39xb) + else() + list(APPEND PLATFORM_FLAGS -mcpu=tc39xx -mtc162) + endif() list(APPEND PLATFORM_FLAGS -I${NUTTX_CHIP_ABS_DIR}/tc397/Libraries/iLLD/TC39B/Tricore/Cpu/Std) list(APPEND PLATFORM_FLAGS diff --git a/arch/tricore/src/tc3xx/CMakeLists.txt b/arch/tricore/src/tc3xx/CMakeLists.txt index d27990acba..c4c37c2bc0 100644 --- a/arch/tricore/src/tc3xx/CMakeLists.txt +++ b/arch/tricore/src/tc3xx/CMakeLists.txt @@ -38,4 +38,12 @@ if(CONFIG_ARCH_CHIP_TC397) add_subdirectory(tc397) + if(CONFIG_TRICORE_TOOLCHAIN_TASKING) + nuttx_add_kernel_library(c_fpu) + target_sources(c_fpu PRIVATE tc3xx_libc.c) + target_link_options( + nuttx PRIVATE + --library-directory=${CMAKE_BINARY_DIR}/arch/tricore/src/exclude_chip) + endif() + endif() diff --git a/arch/tricore/src/tc3xx/tc3xx_libc.c b/arch/tricore/src/tc3xx/tc3xx_libc.c index 177f8ab474..3c5270296b 100644 --- a/arch/tricore/src/tc3xx/tc3xx_libc.c +++ b/arch/tricore/src/tc3xx/tc3xx_libc.c @@ -25,8 +25,6 @@ #include #include -#include "tricore_internal.h" - /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/boards/tricore/tc3xx/tc397/scripts/Lcf_Tasking_Tricore_Tc.lsl b/boards/tricore/tc3xx/tc397/scripts/Lcf_Tasking_Tricore_Tc.lsl index 22da9c0779..32392bf88d 100644 --- a/boards/tricore/tc3xx/tc397/scripts/Lcf_Tasking_Tricore_Tc.lsl +++ b/boards/tricore/tc3xx/tc397/scripts/Lcf_Tasking_Tricore_Tc.lsl @@ -18,7 +18,7 @@ * ****************************************************************************/ -#include "../../../include/nuttx/config.h" +#include "include/nuttx/config.h" #define LCF_CSA0_SIZE 40k #define LCF_USTACK0_SIZE CONFIG_IDLETHREAD_STACKSIZE