From 195aa488e37769ea9f66817e00119e19ca96bff0 Mon Sep 17 00:00:00 2001 From: Josef Angstenberger Date: Sun, 12 Jul 2020 03:04:50 +0200 Subject: Compiler/TI: Detect architecture --- Modules/CMakePlatformId.h.in | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in index 40668a3..0b81c88 100644 --- a/Modules/CMakePlatformId.h.in +++ b/Modules/CMakePlatformId.h.in @@ -206,6 +206,24 @@ # else /* unknown architecture */ # define ARCHITECTURE_ID "" # endif + +#elif defined(__TI_COMPILER_VERSION__) +# if defined(__TI_ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__MSP430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__TMS320C28XX__) +# define ARCHITECTURE_ID "TMS320C28x" + +# elif defined(__TMS320C6X__) || defined(_TMS320C6X) +# define ARCHITECTURE_ID "TMS320C6x" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + #else # define ARCHITECTURE_ID #endif @@ -283,4 +301,3 @@ char const info_simulate_version[] = { array rather than assigning a pointer to a static array. */ char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; - -- cgit v0.12 From a548a522305152a8d732f95a4977928e487c5f57 Mon Sep 17 00:00:00 2001 From: Josef Angstenberger Date: Sat, 11 Jul 2020 16:19:09 +0200 Subject: Compiler/TI: Refactor C/CXX to use a common file --- Modules/Compiler/TI-C.cmake | 18 ++---------------- Modules/Compiler/TI-CXX.cmake | 17 ++--------------- Modules/Compiler/TI.cmake | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 31 deletions(-) create mode 100644 Modules/Compiler/TI.cmake diff --git a/Modules/Compiler/TI-C.cmake b/Modules/Compiler/TI-C.cmake index b060ee9..8ea01b5 100644 --- a/Modules/Compiler/TI-C.cmake +++ b/Modules/Compiler/TI-C.cmake @@ -1,22 +1,8 @@ -set(CMAKE_LIBRARY_PATH_FLAG "--search_path=") -set(CMAKE_LINK_LIBRARY_FLAG "--library=") -set(CMAKE_INCLUDE_FLAG_C "--include_path=") +include(Compiler/TI) +__compiler_ti(C) set(CMAKE_C90_STANDARD_COMPILE_OPTION "--c89") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "--c89 --relaxed_ansi") set(CMAKE_C99_STANDARD_COMPILE_OPTION "--c99") set(CMAKE_C99_EXTENSION_COMPILE_OPTION "--c99 --relaxed_ansi") - -set(CMAKE_DEPFILE_FLAGS_C "--preproc_with_compile --preproc_dependency=") - -set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " --compile_only --skip_assembler --c_file= --output_file=") -set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " --preproc_only --c_file= --output_file=") - -set(CMAKE_C_COMPILE_OBJECT " --compile_only --c_file= --output_file=") -set(CMAKE_C_ARCHIVE_CREATE " qr ") -set(CMAKE_C_ARCHIVE_APPEND " qa ") -set(CMAKE_C_LINK_EXECUTABLE " --run_linker --output_file= --map_file=.map ") -set(CMAKE_ASM_RESPONSE_FILE_FLAG "--cmd_file=") -set(CMAKE_C_RESPONSE_FILE_FLAG "--cmd_file=") -set(CMAKE_C_RESPONSE_FILE_LINK_FLAG " ") diff --git a/Modules/Compiler/TI-CXX.cmake b/Modules/Compiler/TI-CXX.cmake index 7836543..c08d9a1 100644 --- a/Modules/Compiler/TI-CXX.cmake +++ b/Modules/Compiler/TI-CXX.cmake @@ -1,15 +1,2 @@ -set(CMAKE_LIBRARY_PATH_FLAG "--search_path=") -set(CMAKE_LINK_LIBRARY_FLAG "--library=") -set(CMAKE_INCLUDE_FLAG_CXX "--include_path=") - -set(CMAKE_DEPFILE_FLAGS_CXX "--preproc_with_compile --preproc_dependency=") - -set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " --compile_only --skip_assembler --cpp_file= --output_file=") -set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " --preproc_only --cpp_file= --output_file=") - -set(CMAKE_CXX_COMPILE_OBJECT " --compile_only --cpp_file= --output_file=") -set(CMAKE_CXX_ARCHIVE_CREATE " qr ") -set(CMAKE_CXX_ARCHIVE_APPEND " qa ") -set(CMAKE_CXX_LINK_EXECUTABLE " --run_linker --output_file= --map_file=.map ") -set(CMAKE_CXX_RESPONSE_FILE_FLAG "--cmd_file=") -set(CMAKE_CXX_RESPONSE_FILE_LINK_FLAG " ") +include(Compiler/TI) +__compiler_ti(CXX) diff --git a/Modules/Compiler/TI.cmake b/Modules/Compiler/TI.cmake new file mode 100644 index 0000000..5e1e1e6 --- /dev/null +++ b/Modules/Compiler/TI.cmake @@ -0,0 +1,35 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple languages; use include blocker. +if(__COMPILER_TI) + return() +endif() +set(__COMPILER_TI 1) + +macro(__compiler_ti lang) + string(TOLOWER ${lang} prefix) + if("x${lang}" STREQUAL "xCXX") + set(prefix "cpp") + endif() + + set(CMAKE_${lang}_RESPONSE_FILE_FLAG "--cmd_file=") + set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG " ") + + set(CMAKE_INCLUDE_FLAG_${lang} "--include_path=") + set(CMAKE_DEPFILE_FLAGS_${lang} "--preproc_with_compile --preproc_dependency=") + + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE " --preproc_only --${prefix}_file= --output_file=") + set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE " --compile_only --skip_assembler --${prefix}_file= --output_file=") + + set(CMAKE_${lang}_COMPILE_OBJECT " --compile_only --${prefix}_file= --output_file=") + + set(CMAKE_${lang}_ARCHIVE_CREATE " qr ") + set(CMAKE_${lang}_ARCHIVE_APPEND " qa ") + + set(CMAKE_${lang}_LINK_EXECUTABLE " --run_linker --output_file= --map_file=.map ") +endmacro() + +set(CMAKE_LIBRARY_PATH_FLAG "--search_path=") +set(CMAKE_LINK_LIBRARY_FLAG "--library=") -- cgit v0.12 From ef528f10bf7e9fe6a2c0f043102c24e76212f542 Mon Sep 17 00:00:00 2001 From: Josef Angstenberger Date: Sat, 11 Jul 2020 16:26:17 +0200 Subject: Compiler/TI: Sync ASM settings to C/CXX For assembler the same compiler executable is used as for C/CXX. So the setting shall be kept in sync. --- Modules/Compiler/TI-ASM.cmake | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Modules/Compiler/TI-ASM.cmake b/Modules/Compiler/TI-ASM.cmake index a566d70..01965d2 100644 --- a/Modules/Compiler/TI-ASM.cmake +++ b/Modules/Compiler/TI-ASM.cmake @@ -1,8 +1,4 @@ -set(CMAKE_LIBRARY_PATH_FLAG "--search_path=") -set(CMAKE_LINK_LIBRARY_FLAG "--library=") -set(CMAKE_INCLUDE_FLAG_ASM "--include_path=") - -set(CMAKE_ASM_COMPILE_OBJECT " --compile_only --asm_file= --output_file=") -set(CMAKE_ASM_LINK_EXECUTABLE " --run_linker --output_file= ") +include(Compiler/TI) +__compiler_ti(ASM) set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS asm;s;abs) -- cgit v0.12 From 763b44e51909674f87bbacc8fb3400254fad074c Mon Sep 17 00:00:00 2001 From: Josef Angstenberger Date: Sat, 11 Jul 2020 16:32:09 +0200 Subject: Compiler/TI: Avoid usage of ranlib If a ranlib executable has been found it is used for finishing an archive. In case of the TI compiler the archive file gets corrupted. Fixes: #14876 --- Modules/Compiler/TI.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/Compiler/TI.cmake b/Modules/Compiler/TI.cmake index 5e1e1e6..59dd585 100644 --- a/Modules/Compiler/TI.cmake +++ b/Modules/Compiler/TI.cmake @@ -27,6 +27,7 @@ macro(__compiler_ti lang) set(CMAKE_${lang}_ARCHIVE_CREATE " qr ") set(CMAKE_${lang}_ARCHIVE_APPEND " qa ") + set(CMAKE_${lang}_ARCHIVE_FINISH "") set(CMAKE_${lang}_LINK_EXECUTABLE " --run_linker --output_file= --map_file=.map ") endmacro() -- cgit v0.12 From 5dec322f3385ae7642f898a1e9d39affb79ca5e6 Mon Sep 17 00:00:00 2001 From: Josef Angstenberger Date: Sat, 11 Jul 2020 18:19:34 +0200 Subject: Compiler/TI: Add compiler flags to linker By adding the compiler flags via `` to the linker call, the linker can decide which default library to use. CMake replaces `` by the content of `CMAKE__FLAGS`. So any relevant flag needs to be defined in this variable, preferably in a toolchain file. The compiler flags have to be specified before the `--run_linker` flag and the linker flags afterwards. Replaces Merge-request !4890 --- Modules/Compiler/TI.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Compiler/TI.cmake b/Modules/Compiler/TI.cmake index 59dd585..c985b96 100644 --- a/Modules/Compiler/TI.cmake +++ b/Modules/Compiler/TI.cmake @@ -29,7 +29,7 @@ macro(__compiler_ti lang) set(CMAKE_${lang}_ARCHIVE_APPEND " qa ") set(CMAKE_${lang}_ARCHIVE_FINISH "") - set(CMAKE_${lang}_LINK_EXECUTABLE " --run_linker --output_file= --map_file=.map ") + set(CMAKE_${lang}_LINK_EXECUTABLE " --run_linker --output_file= --map_file=.map ") endmacro() set(CMAKE_LIBRARY_PATH_FLAG "--search_path=") -- cgit v0.12 From 98fea8205e4a5251871edafba427fd7d100e5db9 Mon Sep 17 00:00:00 2001 From: Josef Angstenberger Date: Sat, 11 Jul 2020 18:56:06 +0200 Subject: Compiler/TI: Avoid response file usage for linker The object and library files have to be listed after the `--run-linker` flag. But after this flag the `--cmd_file` flag for response files cannot be used any more. Putting the whole command line into a response file would work, but this is not supported by CMake (yet). --- Modules/Compiler/TI.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Modules/Compiler/TI.cmake b/Modules/Compiler/TI.cmake index c985b96..9f2e813 100644 --- a/Modules/Compiler/TI.cmake +++ b/Modules/Compiler/TI.cmake @@ -15,7 +15,6 @@ macro(__compiler_ti lang) endif() set(CMAKE_${lang}_RESPONSE_FILE_FLAG "--cmd_file=") - set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG " ") set(CMAKE_INCLUDE_FLAG_${lang} "--include_path=") set(CMAKE_DEPFILE_FLAGS_${lang} "--preproc_with_compile --preproc_dependency=") @@ -29,6 +28,11 @@ macro(__compiler_ti lang) set(CMAKE_${lang}_ARCHIVE_APPEND " qa ") set(CMAKE_${lang}_ARCHIVE_FINISH "") + # After the --run_linker flag a response file is not possible + set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "") + set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_LIBRARIES 0) + set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 0) + set(CMAKE_${lang}_LINK_EXECUTABLE " --run_linker --output_file= --map_file=.map ") endmacro() -- cgit v0.12