Genericise TI compiler and add MSP430 support

pull/9512/merge
William Toohey 3 years ago committed by Jussi Pakkanen
parent 316cf3a717
commit b4d9b2551c
  1. 25
      cross/msp430.txt
  2. 5
      docs/markdown/Reference-tables.md
  3. 8
      docs/markdown/snippets/ti_compilers.md
  4. 4
      mesonbuild/build.py
  5. 4
      mesonbuild/compilers/__init__.py
  6. 25
      mesonbuild/compilers/c.py
  7. 21
      mesonbuild/compilers/cpp.py
  8. 48
      mesonbuild/compilers/detect.py
  9. 47
      mesonbuild/compilers/mixins/ti.py
  10. 1
      mesonbuild/envconfig.py
  11. 4
      mesonbuild/linkers/__init__.py
  12. 24
      mesonbuild/linkers/linkers.py

@ -0,0 +1,25 @@
# This file assumes that path to the Texas Instruments MSP430 toolchain is added
# to the environment(PATH) variable, so that Meson can find
# cl430 and ar430 while building.
[binaries]
c = cl430
ar = ar430
strip = strip430
[host_machine]
system = 'baremetal'
cpu_family = 'msp430'
endian = 'little'
[built-in options]
c_args = [
'-vmsp',
'--printf_support=minimal']
c_link_args = [
'--rom_model',
'-llibc.a',]
cpp_args = []
cpp_link_args = []
[properties]
needs_exe_wrapper = true

@ -9,7 +9,6 @@ These are return values of the `get_id` (Compiler family) and
| ----- | --------------- | --------------- | | ----- | --------------- | --------------- |
| arm | ARM compiler | | | arm | ARM compiler | |
| armclang | ARMCLANG compiler | | | armclang | ARMCLANG compiler | |
| c2000 | Texas Instruments C2000 compiler | |
| ccomp | The CompCert formally-verified C compiler | | | ccomp | The CompCert formally-verified C compiler | |
| ccrx | Renesas RX Family C/C++ compiler | | | ccrx | Renesas RX Family C/C++ compiler | |
| clang | The Clang compiler | gcc | | clang | The Clang compiler | gcc |
@ -32,6 +31,8 @@ These are return values of the `get_id` (Compiler family) and
| pgi | Portland PGI C/C++/Fortran compilers | | | pgi | Portland PGI C/C++/Fortran compilers | |
| rustc | Rust compiler | | | rustc | Rust compiler | |
| sun | Sun Fortran compiler | | | sun | Sun Fortran compiler | |
| c2000 | Texas Instruments C/C++ Compiler (C2000) | |
| ti | Texas Instruments C/C++ Compiler | |
| valac | Vala compiler | | | valac | Vala compiler | |
| xc16 | Microchip XC16 C compiler | | | xc16 | Microchip XC16 C compiler | |
| cython | The Cython compiler | | | cython | The Cython compiler | |
@ -55,6 +56,7 @@ These are return values of the `get_linker_id` method in a compiler object.
| rlink | The Renesas linker, used with CCrx only | | rlink | The Renesas linker, used with CCrx only |
| xc16-ar | The Microchip linker, used with XC16 only | | xc16-ar | The Microchip linker, used with XC16 only |
| ar2000 | The Texas Instruments linker, used with C2000 only | | ar2000 | The Texas Instruments linker, used with C2000 only |
| ti-ar | The Texas Instruments linker |
| armlink | The ARM linker (arm and armclang compilers) | | armlink | The ARM linker (arm and armclang compilers) |
| pgi | Portland/Nvidia PGI | | pgi | Portland/Nvidia PGI |
| nvlink | Nvidia Linker used with cuda | | nvlink | Nvidia Linker used with cuda |
@ -97,6 +99,7 @@ set in the cross file.
| microblaze | MicroBlaze processor | | microblaze | MicroBlaze processor |
| mips | 32 bit MIPS processor | | mips | 32 bit MIPS processor |
| mips64 | 64 bit MIPS processor | | mips64 | 64 bit MIPS processor |
| msp430 | 16 bit MSP430 processor |
| parisc | HP PA-RISC processor | | parisc | HP PA-RISC processor |
| pic24 | 16 bit Microchip PIC24 | | pic24 | 16 bit Microchip PIC24 |
| ppc | 32 bit PPC processors | | ppc | 32 bit PPC processors |

@ -0,0 +1,8 @@
## Added support for Texas Instruments MSP430 and ARM compilers
Meson now supports the TI [MSP430](https://www.ti.com/tool/MSP-CGT) and
[ARM](https://www.ti.com/tool/ARM-CGT) toolchains. The compiler and linker are
identified as `ti` and `ti-ar`, respectively. To maintain backwards
compatibility with existing build definitions, the [C2000
toolchain](https://www.ti.com/tool/C2000-CGT) is still identified as `c2000` and
`ar2000`.

@ -1776,8 +1776,8 @@ class Executable(BuildTarget):
self.suffix = 'abs' self.suffix = 'abs'
elif ('c' in self.compilers and self.compilers['c'].get_id().startswith('xc16')): elif ('c' in self.compilers and self.compilers['c'].get_id().startswith('xc16')):
self.suffix = 'elf' self.suffix = 'elf'
elif ('c' in self.compilers and self.compilers['c'].get_id().startswith('c2000') or elif ('c' in self.compilers and self.compilers['c'].get_id() in ('ti', 'c2000') or
'cpp' in self.compilers and self.compilers['cpp'].get_id().startswith('c2000')): 'cpp' in self.compilers and self.compilers['cpp'].get_id() in ('ti', 'c2000')):
self.suffix = 'out' self.suffix = 'out'
else: else:
self.suffix = environment.machines[for_machine].get_exe_suffix() self.suffix = environment.machines[for_machine].get_exe_suffix()

@ -120,6 +120,8 @@ __all__ = [
'CompCertCCompiler', 'CompCertCCompiler',
'C2000CCompiler', 'C2000CCompiler',
'C2000CPPCompiler', 'C2000CPPCompiler',
'TICCompiler',
'TICPPCompiler',
'SunFortranCompiler', 'SunFortranCompiler',
'SwiftCompiler', 'SwiftCompiler',
'ValaCompiler', 'ValaCompiler',
@ -188,6 +190,7 @@ from .c import (
Xc16CCompiler, Xc16CCompiler,
CompCertCCompiler, CompCertCCompiler,
C2000CCompiler, C2000CCompiler,
TICCompiler,
VisualStudioCCompiler, VisualStudioCCompiler,
) )
from .cpp import ( from .cpp import (
@ -206,6 +209,7 @@ from .cpp import (
PGICPPCompiler, PGICPPCompiler,
CcrxCPPCompiler, CcrxCPPCompiler,
C2000CPPCompiler, C2000CPPCompiler,
TICPPCompiler,
VisualStudioCPPCompiler, VisualStudioCPPCompiler,
) )
from .cs import MonoCompiler, VisualStudioCsCompiler from .cs import MonoCompiler, VisualStudioCsCompiler

@ -23,7 +23,7 @@ from .mixins.clike import CLikeCompiler
from .mixins.ccrx import CcrxCompiler from .mixins.ccrx import CcrxCompiler
from .mixins.xc16 import Xc16Compiler from .mixins.xc16 import Xc16Compiler
from .mixins.compcert import CompCertCompiler from .mixins.compcert import CompCertCompiler
from .mixins.c2000 import C2000Compiler from .mixins.ti import TICompiler
from .mixins.arm import ArmCompiler, ArmclangCompiler from .mixins.arm import ArmCompiler, ArmclangCompiler
from .mixins.visualstudio import MSVCCompiler, ClangClCompiler from .mixins.visualstudio import MSVCCompiler, ClangClCompiler
from .mixins.gnu import GnuCompiler from .mixins.gnu import GnuCompiler
@ -685,7 +685,7 @@ class CompCertCCompiler(CompCertCompiler, CCompiler):
path = '.' path = '.'
return ['-I' + path] return ['-I' + path]
class C2000CCompiler(C2000Compiler, CCompiler): class TICCompiler(TICompiler, CCompiler):
def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice,
is_cross: bool, info: 'MachineInfo', is_cross: bool, info: 'MachineInfo',
exe_wrapper: T.Optional['ExternalProgram'] = None, exe_wrapper: T.Optional['ExternalProgram'] = None,
@ -693,7 +693,7 @@ class C2000CCompiler(C2000Compiler, CCompiler):
full_version: T.Optional[str] = None): full_version: T.Optional[str] = None):
CCompiler.__init__(self, exelist, version, for_machine, is_cross, CCompiler.__init__(self, exelist, version, for_machine, is_cross,
info, exe_wrapper, linker=linker, full_version=full_version) info, exe_wrapper, linker=linker, full_version=full_version)
C2000Compiler.__init__(self) TICompiler.__init__(self)
# Override CCompiler.get_always_args # Override CCompiler.get_always_args
def get_always_args(self) -> T.List[str]: def get_always_args(self) -> T.List[str]:
@ -716,19 +716,6 @@ class C2000CCompiler(C2000Compiler, CCompiler):
args.append('--' + std.value) args.append('--' + std.value)
return args return args
def get_compile_only_args(self) -> T.List[str]: class C2000CCompiler(TICCompiler):
return [] # Required for backwards compat with projects created before ti-cgt support existed
id = 'c2000'
def get_no_optimization_args(self) -> T.List[str]:
return ['-Ooff']
def get_output_args(self, target: str) -> T.List[str]:
return [f'--output_file={target}']
def get_werror_args(self) -> T.List[str]:
return ['-change_message=error']
def get_include_args(self, path: str, is_system: bool) -> T.List[str]:
if path == '':
path = '.'
return ['--include_path=' + path]

@ -30,7 +30,7 @@ from .compilers import (
from .c_function_attributes import CXX_FUNC_ATTRIBUTES, C_FUNC_ATTRIBUTES from .c_function_attributes import CXX_FUNC_ATTRIBUTES, C_FUNC_ATTRIBUTES
from .mixins.clike import CLikeCompiler from .mixins.clike import CLikeCompiler
from .mixins.ccrx import CcrxCompiler from .mixins.ccrx import CcrxCompiler
from .mixins.c2000 import C2000Compiler from .mixins.ti import TICompiler
from .mixins.arm import ArmCompiler, ArmclangCompiler from .mixins.arm import ArmCompiler, ArmclangCompiler
from .mixins.visualstudio import MSVCCompiler, ClangClCompiler from .mixins.visualstudio import MSVCCompiler, ClangClCompiler
from .mixins.gnu import GnuCompiler from .mixins.gnu import GnuCompiler
@ -839,14 +839,14 @@ class CcrxCPPCompiler(CcrxCompiler, CPPCompiler):
def get_compiler_check_args(self, mode: CompileCheckMode) -> T.List[str]: def get_compiler_check_args(self, mode: CompileCheckMode) -> T.List[str]:
return [] return []
class C2000CPPCompiler(C2000Compiler, CPPCompiler): class TICPPCompiler(TICompiler, CPPCompiler):
def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool,
info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None,
linker: T.Optional['DynamicLinker'] = None, linker: T.Optional['DynamicLinker'] = None,
full_version: T.Optional[str] = None): full_version: T.Optional[str] = None):
CPPCompiler.__init__(self, exelist, version, for_machine, is_cross, CPPCompiler.__init__(self, exelist, version, for_machine, is_cross,
info, exe_wrapper, linker=linker, full_version=full_version) info, exe_wrapper, linker=linker, full_version=full_version)
C2000Compiler.__init__(self) TICompiler.__init__(self)
def get_options(self) -> 'KeyedOptionDictType': def get_options(self) -> 'KeyedOptionDictType':
opts = CPPCompiler.get_options(self) opts = CPPCompiler.get_options(self)
@ -862,13 +862,12 @@ class C2000CPPCompiler(C2000Compiler, CPPCompiler):
args.append('--' + std.value) args.append('--' + std.value)
return args return args
def get_no_optimization_args(self) -> T.List[str]: def get_always_args(self) -> T.List[str]:
return ['-Ooff'] return []
def get_output_args(self, target: str) -> T.List[str]: def get_option_link_args(self, options: 'KeyedOptionDictType') -> T.List[str]:
return [f'--output_file={target}'] return []
def get_include_args(self, path: str, is_system: bool) -> T.List[str]: class C2000CPPCompiler(TICPPCompiler):
if path == '': # Required for backwards compat with projects created before ti-cgt support existed
path = '.' id = 'c2000'
return ['--include_path=' + path]

@ -33,6 +33,8 @@ from ..linkers import (
CompCertDynamicLinker, CompCertDynamicLinker,
C2000Linker, C2000Linker,
C2000DynamicLinker, C2000DynamicLinker,
TILinker,
TIDynamicLinker,
DLinker, DLinker,
NAGDynamicLinker, NAGDynamicLinker,
NvidiaHPC_DynamicLinker, NvidiaHPC_DynamicLinker,
@ -68,6 +70,7 @@ from .c import (
Xc16CCompiler, Xc16CCompiler,
CompCertCCompiler, CompCertCCompiler,
C2000CCompiler, C2000CCompiler,
TICCompiler,
VisualStudioCCompiler, VisualStudioCCompiler,
) )
from .cpp import ( from .cpp import (
@ -87,6 +90,7 @@ from .cpp import (
PGICPPCompiler, PGICPPCompiler,
CcrxCPPCompiler, CcrxCPPCompiler,
C2000CPPCompiler, C2000CPPCompiler,
TICPPCompiler,
VisualStudioCPPCompiler, VisualStudioCPPCompiler,
) )
from .cs import MonoCompiler, VisualStudioCsCompiler from .cs import MonoCompiler, VisualStudioCsCompiler
@ -295,9 +299,11 @@ def detect_static_linker(env: 'Environment', compiler: Compiler) -> StaticLinker
linkers = default_linkers linkers = default_linkers
popen_exceptions = {} popen_exceptions = {}
for linker in linkers: for linker in linkers:
if not {'lib', 'lib.exe', 'llvm-lib', 'llvm-lib.exe', 'xilib', 'xilib.exe'}.isdisjoint(linker): linker_name = os.path.basename(linker[0])
if any(os.path.basename(x) in {'lib', 'lib.exe', 'llvm-lib', 'llvm-lib.exe', 'xilib', 'xilib.exe'} for x in linker):
arg = '/?' arg = '/?'
elif not {'ar2000', 'ar2000.exe'}.isdisjoint(linker): elif linker_name in {'ar2000', 'ar2000.exe', 'ar430', 'ar430.exe', 'armar', 'armar.exe'}:
arg = '?' arg = '?'
else: else:
arg = '--version' arg = '--version'
@ -312,7 +318,7 @@ def detect_static_linker(env: 'Environment', compiler: Compiler) -> StaticLinker
return VisualStudioLinker(linker, getattr(compiler, 'machine', None)) return VisualStudioLinker(linker, getattr(compiler, 'machine', None))
if 'ar-Error-Unknown switch: --version' in err: if 'ar-Error-Unknown switch: --version' in err:
return PGIStaticLinker(linker) return PGIStaticLinker(linker)
if p.returncode == 0 and ('armar' in linker or 'armar.exe' in linker): if p.returncode == 0 and 'armar' in linker_name:
return ArmarLinker(linker) return ArmarLinker(linker)
if 'DMD32 D Compiler' in out or 'DMD64 D Compiler' in out: if 'DMD32 D Compiler' in out or 'DMD64 D Compiler' in out:
assert isinstance(compiler, DCompiler) assert isinstance(compiler, DCompiler)
@ -323,12 +329,15 @@ def detect_static_linker(env: 'Environment', compiler: Compiler) -> StaticLinker
if 'GDC' in out and ' based on D ' in out: if 'GDC' in out and ' based on D ' in out:
assert isinstance(compiler, DCompiler) assert isinstance(compiler, DCompiler)
return DLinker(linker, compiler.arch) return DLinker(linker, compiler.arch)
if err.startswith('Renesas') and ('rlink' in linker or 'rlink.exe' in linker): if err.startswith('Renesas') and 'rlink' in linker_name:
return CcrxLinker(linker) return CcrxLinker(linker)
if out.startswith('GNU ar') and ('xc16-ar' in linker or 'xc16-ar.exe' in linker): if out.startswith('GNU ar') and 'xc16-ar' in linker_name:
return Xc16Linker(linker) return Xc16Linker(linker)
if out.startswith('TMS320C2000') and ('ar2000' in linker or 'ar2000.exe' in linker): if 'Texas Instruments Incorporated' in out:
return C2000Linker(linker) if 'ar2000' in linker_name:
return C2000Linker(linker)
else:
return TILinker(linker)
if out.startswith('The CompCert'): if out.startswith('The CompCert'):
return CompCertLinker(linker) return CompCertLinker(linker)
if p.returncode == 0: if p.returncode == 0:
@ -397,7 +406,8 @@ def _detect_c_or_cpp_compiler(env: 'Environment', lang: str, for_machine: Machin
arg = '--version' arg = '--version'
elif 'ccomp' in compiler_name: elif 'ccomp' in compiler_name:
arg = '-version' arg = '-version'
elif 'cl2000' in compiler_name: elif compiler_name in {'cl2000', 'cl2000.exe', 'cl430', 'cl430.exe', 'armcl', 'armcl.exe'}:
# TI compiler
arg = '-version' arg = '-version'
elif compiler_name in {'icl', 'icl.exe'}: elif compiler_name in {'icl', 'icl.exe'}:
# if you pass anything to icl you get stuck in a pager # if you pass anything to icl you get stuck in a pager
@ -602,6 +612,20 @@ def _detect_c_or_cpp_compiler(env: 'Environment', lang: str, for_machine: Machin
return cls( return cls(
ccache + compiler, version, for_machine, is_cross, info, ccache + compiler, version, for_machine, is_cross, info,
exe_wrap, full_version=full_version, linker=l) exe_wrap, full_version=full_version, linker=l)
if 'TMS320C2000 C/C++' in out or 'MSP430 C/C++' in out or 'TI ARM C/C++ Compiler' in out:
lnk : T.Union[T.Type[C2000DynamicLinker], T.Type[TIDynamicLinker]]
if 'TMS320C2000 C/C++' in out:
cls = C2000CCompiler if lang == 'c' else C2000CPPCompiler
lnk = C2000DynamicLinker
else:
cls = TICCompiler if lang == 'c' else TICPPCompiler
lnk = TIDynamicLinker
env.coredata.add_lang_args(cls.language, cls, for_machine, env)
linker = lnk(compiler, for_machine, version=version)
return cls(
ccache + compiler, version, for_machine, is_cross, info,
exe_wrap, full_version=full_version, linker=linker)
if 'ARM' in out: if 'ARM' in out:
cls = ArmCCompiler if lang == 'c' else ArmCPPCompiler cls = ArmCCompiler if lang == 'c' else ArmCPPCompiler
env.coredata.add_lang_args(cls.language, cls, for_machine, env) env.coredata.add_lang_args(cls.language, cls, for_machine, env)
@ -633,14 +657,6 @@ def _detect_c_or_cpp_compiler(env: 'Environment', lang: str, for_machine: Machin
ccache + compiler, version, for_machine, is_cross, info, ccache + compiler, version, for_machine, is_cross, info,
exe_wrap, full_version=full_version, linker=linker) exe_wrap, full_version=full_version, linker=linker)
if 'TMS320C2000 C/C++' in out:
cls = C2000CCompiler if lang == 'c' else C2000CPPCompiler
env.coredata.add_lang_args(cls.language, cls, for_machine, env)
linker = C2000DynamicLinker(compiler, for_machine, version=version)
return cls(
ccache + compiler, version, for_machine, is_cross, info,
exe_wrap, full_version=full_version, linker=linker)
_handle_exceptions(popen_exceptions, compilers) _handle_exceptions(popen_exceptions, compilers)
raise EnvironmentException(f'Unknown compiler {compilers}') raise EnvironmentException(f'Unknown compiler {compilers}')

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
"""Representations specific to the Texas Instruments C2000 compiler family.""" """Representations specific to the Texas Instruments compiler family."""
import os import os
import typing as T import typing as T
@ -29,7 +29,7 @@ else:
# do). This gives up DRYer type checking, with no runtime impact # do). This gives up DRYer type checking, with no runtime impact
Compiler = object Compiler = object
c2000_buildtype_args = { ti_buildtype_args = {
'plain': [], 'plain': [],
'debug': [], 'debug': [],
'debugoptimized': [], 'debugoptimized': [],
@ -38,7 +38,7 @@ c2000_buildtype_args = {
'custom': [], 'custom': [],
} # type: T.Dict[str, T.List[str]] } # type: T.Dict[str, T.List[str]]
c2000_optimization_args = { ti_optimization_args = {
'0': ['-O0'], '0': ['-O0'],
'g': ['-Ooff'], 'g': ['-Ooff'],
'1': ['-O1'], '1': ['-O1'],
@ -47,22 +47,22 @@ c2000_optimization_args = {
's': ['-04'] 's': ['-04']
} # type: T.Dict[str, T.List[str]] } # type: T.Dict[str, T.List[str]]
c2000_debug_args = { ti_debug_args = {
False: [], False: [],
True: ['-g'] True: ['-g']
} # type: T.Dict[bool, T.List[str]] } # type: T.Dict[bool, T.List[str]]
class C2000Compiler(Compiler): class TICompiler(Compiler):
id = 'c2000' id = 'ti'
def __init__(self) -> None: def __init__(self) -> None:
if not self.is_cross: if not self.is_cross:
raise EnvironmentException('c2000 supports only cross-compilation.') raise EnvironmentException('TI compilers only support cross-compilation.')
self.can_compile_suffixes.add('asm') # Assembly self.can_compile_suffixes.add('asm') # Assembly
self.can_compile_suffixes.add('cla') # Control Law Accelerator (CLA) self.can_compile_suffixes.add('cla') # Control Law Accelerator (CLA) used in C2000
default_warn_args = [] # type: T.List[str] default_warn_args = [] # type: T.List[str]
self.warn_args = {'0': [], self.warn_args = {'0': [],
@ -71,12 +71,12 @@ class C2000Compiler(Compiler):
'3': default_warn_args + []} # type: T.Dict[str, T.List[str]] '3': default_warn_args + []} # type: T.Dict[str, T.List[str]]
def get_pic_args(self) -> T.List[str]: def get_pic_args(self) -> T.List[str]:
# PIC support is not enabled by default for c2000, # PIC support is not enabled by default for TI compilers,
# if users want to use it, they need to add the required arguments explicitly # if users want to use it, they need to add the required arguments explicitly
return [] return []
def get_buildtype_args(self, buildtype: str) -> T.List[str]: def get_buildtype_args(self, buildtype: str) -> T.List[str]:
return c2000_buildtype_args[buildtype] return ti_buildtype_args[buildtype]
def get_pch_suffix(self) -> str: def get_pch_suffix(self) -> str:
return 'pch' return 'pch'
@ -97,10 +97,27 @@ class C2000Compiler(Compiler):
return [] return []
def get_optimization_args(self, optimization_level: str) -> T.List[str]: def get_optimization_args(self, optimization_level: str) -> T.List[str]:
return c2000_optimization_args[optimization_level] return ti_optimization_args[optimization_level]
def get_debug_args(self, is_debug: bool) -> T.List[str]: def get_debug_args(self, is_debug: bool) -> T.List[str]:
return c2000_debug_args[is_debug] return ti_debug_args[is_debug]
def get_compile_only_args(self) -> T.List[str]:
return []
def get_no_optimization_args(self) -> T.List[str]:
return ['-Ooff']
def get_output_args(self, target: str) -> T.List[str]:
return [f'--output_file={target}']
def get_werror_args(self) -> T.List[str]:
return ['--emit_warnings_as_errors']
def get_include_args(self, path: str, is_system: bool) -> T.List[str]:
if path == '':
path = '.'
return ['-I=' + path]
@classmethod @classmethod
def unix_args_to_native(cls, args: T.List[str]) -> T.List[str]: def unix_args_to_native(cls, args: T.List[str]) -> T.List[str]:
@ -108,8 +125,6 @@ class C2000Compiler(Compiler):
for i in args: for i in args:
if i.startswith('-D'): if i.startswith('-D'):
i = '--define=' + i[2:] i = '--define=' + i[2:]
if i.startswith('-I'):
i = '--include_path=' + i[2:]
if i.startswith('-Wl,-rpath='): if i.startswith('-Wl,-rpath='):
continue continue
elif i == '--print-search-dirs': elif i == '--print-search-dirs':
@ -121,8 +136,8 @@ class C2000Compiler(Compiler):
def compute_parameters_with_absolute_paths(self, parameter_list: T.List[str], build_dir: str) -> T.List[str]: def compute_parameters_with_absolute_paths(self, parameter_list: T.List[str], build_dir: str) -> T.List[str]:
for idx, i in enumerate(parameter_list): for idx, i in enumerate(parameter_list):
if i[:14] == '--include_path': if i[:15] == '--include_path=':
parameter_list[idx] = i[:14] + os.path.normpath(os.path.join(build_dir, i[14:])) parameter_list[idx] = i[:15] + os.path.normpath(os.path.join(build_dir, i[15:]))
if i[:2] == '-I': if i[:2] == '-I':
parameter_list[idx] = i[:2] + os.path.normpath(os.path.join(build_dir, i[2:])) parameter_list[idx] = i[:2] + os.path.normpath(os.path.join(build_dir, i[2:]))

@ -53,6 +53,7 @@ known_cpu_families = (
'microblaze', 'microblaze',
'mips', 'mips',
'mips64', 'mips64',
'msp430',
'parisc', 'parisc',
'pic24', 'pic24',
'ppc', 'ppc',

@ -31,6 +31,7 @@ from .linkers import (
Xc16Linker, Xc16Linker,
CompCertLinker, CompCertLinker,
C2000Linker, C2000Linker,
TILinker,
AIXArLinker, AIXArLinker,
PGIStaticLinker, PGIStaticLinker,
NvidiaHPC_StaticLinker, NvidiaHPC_StaticLinker,
@ -48,6 +49,7 @@ from .linkers import (
Xc16DynamicLinker, Xc16DynamicLinker,
CompCertDynamicLinker, CompCertDynamicLinker,
C2000DynamicLinker, C2000DynamicLinker,
TIDynamicLinker,
ArmDynamicLinker, ArmDynamicLinker,
ArmClangDynamicLinker, ArmClangDynamicLinker,
QualcommLLVMDynamicLinker, QualcommLLVMDynamicLinker,
@ -89,6 +91,7 @@ __all__ = [
'Xc16Linker', 'Xc16Linker',
'CompCertLinker', 'CompCertLinker',
'C2000Linker', 'C2000Linker',
'TILinker',
'AIXArLinker', 'AIXArLinker',
'PGIStaticLinker', 'PGIStaticLinker',
'NvidiaHPC_StaticLinker', 'NvidiaHPC_StaticLinker',
@ -106,6 +109,7 @@ __all__ = [
'Xc16DynamicLinker', 'Xc16DynamicLinker',
'CompCertDynamicLinker', 'CompCertDynamicLinker',
'C2000DynamicLinker', 'C2000DynamicLinker',
'TIDynamicLinker',
'ArmDynamicLinker', 'ArmDynamicLinker',
'ArmClangDynamicLinker', 'ArmClangDynamicLinker',
'QualcommLLVMDynamicLinker', 'QualcommLLVMDynamicLinker',

@ -288,11 +288,11 @@ class CompCertLinker(StaticLinker):
return [f'-o{target}'] return [f'-o{target}']
class C2000Linker(StaticLinker): class TILinker(StaticLinker):
def __init__(self, exelist: T.List[str]): def __init__(self, exelist: T.List[str]):
super().__init__(exelist) super().__init__(exelist)
self.id = 'ar2000' self.id = 'ti-ar'
def can_linker_accept_rsp(self) -> bool: def can_linker_accept_rsp(self) -> bool:
return False return False
@ -304,6 +304,11 @@ class C2000Linker(StaticLinker):
return ['-r'] return ['-r']
class C2000Linker(TILinker):
# Required for backwards compat with projects created before ti-cgt support existed
id = 'ar2000'
class AIXArLinker(ArLikeLinker): class AIXArLinker(ArLikeLinker):
id = 'aixar' id = 'aixar'
std_args = ['-csr', '-Xany'] std_args = ['-csr', '-Xany']
@ -971,15 +976,15 @@ class CompCertDynamicLinker(DynamicLinker):
install_rpath: str) -> T.Tuple[T.List[str], T.Set[bytes]]: install_rpath: str) -> T.Tuple[T.List[str], T.Set[bytes]]:
return ([], set()) return ([], set())
class C2000DynamicLinker(DynamicLinker): class TIDynamicLinker(DynamicLinker):
"""Linker for Texas Instruments C2000 compiler.""" """Linker for Texas Instruments compiler family."""
id = 'cl2000' id = 'ti'
def __init__(self, exelist: T.List[str], for_machine: mesonlib.MachineChoice, def __init__(self, exelist: T.List[str], for_machine: mesonlib.MachineChoice,
*, version: str = 'unknown version'): *, version: str = 'unknown version'):
super().__init__(exelist or ['cl2000.exe'], for_machine, '', [], super().__init__(exelist, for_machine, '', [],
version=version) version=version)
def get_link_whole_for(self, args: T.List[str]) -> T.List[str]: def get_link_whole_for(self, args: T.List[str]) -> T.List[str]:
@ -1000,7 +1005,7 @@ class C2000DynamicLinker(DynamicLinker):
return ['-z', f'--output_file={outputname}'] return ['-z', f'--output_file={outputname}']
def get_search_args(self, dirname: str) -> 'T.NoReturn': def get_search_args(self, dirname: str) -> 'T.NoReturn':
raise OSError('cl2000.exe does not have a search dir argument') raise OSError('TI compilers do not have a search dir argument')
def get_allow_undefined_args(self) -> T.List[str]: def get_allow_undefined_args(self) -> T.List[str]:
return [] return []
@ -1009,6 +1014,11 @@ class C2000DynamicLinker(DynamicLinker):
return [] return []
class C2000DynamicLinker(TIDynamicLinker):
# Required for backwards compat with projects created before ti-cgt support existed
id = 'cl2000'
class ArmDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker): class ArmDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker):
"""Linker for the ARM compiler.""" """Linker for the ARM compiler."""

Loading…
Cancel
Save