parent
24227a9553
commit
7460292810
13 changed files with 593 additions and 3 deletions
@ -0,0 +1,26 @@ |
||||
# This file assumes that path to the Texas Instruments C20000 toolchain is added |
||||
# to the environment(PATH) variable, so that Meson can find |
||||
# cl2000 and ar2000 while building. |
||||
[binaries] |
||||
c = 'cl2000' |
||||
ar = 'ar2000' |
||||
strip = 'cl2000' |
||||
|
||||
[host_machine] |
||||
system = 'bare metal' |
||||
cpu_family = 'c2000' |
||||
cpu = 'c28x' |
||||
endian = 'little' |
||||
|
||||
[properties] |
||||
needs_exe_wrapper = true |
||||
c_args = [ |
||||
'-v28', |
||||
'-ml', |
||||
'-mt'] |
||||
c_link_args = [ |
||||
'-z', |
||||
'--rom_model', |
||||
'\f28004x_flash.cmd'] |
||||
cpp_args = [] |
||||
cpp_link_args = [] |
@ -0,0 +1,24 @@ |
||||
# This file assumes that path to the Microchip xc16 toolchain is added |
||||
# to the environment(PATH) variable, so that Meson can find |
||||
# xc16-gcc and xc16-ar while building. |
||||
[binaries] |
||||
c = 'xc16-gcc' |
||||
ar = 'xc16-ar' |
||||
strip = 'xc16-gcc' |
||||
|
||||
[host_machine] |
||||
system = 'bare metal' |
||||
cpu_family = 'dspic' |
||||
cpu = '33ep64mc203' |
||||
endian = 'little' |
||||
|
||||
[properties] |
||||
needs_exe_wrapper = true |
||||
c_args = [ |
||||
'-c', |
||||
'-mcpu=33EP64MC203', |
||||
'-omf=elf'] |
||||
c_link_args = [ |
||||
'-mcpu=33EP64MC203', |
||||
'-omf=elf', |
||||
'-Wl,--script=p33EP64MC203.gld,'] |
@ -0,0 +1,8 @@ |
||||
## Added Microchip XC16 C compiler support |
||||
Make sure compiler executables are setup correctly in your path |
||||
Compiler is available from the Microchip website for free |
||||
|
||||
|
||||
## Added Texas Instruments C2000 C/C++ compiler support |
||||
Make sure compiler executables are setup correctly in your path |
||||
Compiler is available from Texas Instruments website for free |
@ -0,0 +1,120 @@ |
||||
# Copyright 2012-2019 The Meson development team |
||||
|
||||
# Licensed 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. |
||||
|
||||
"""Representations specific to the Texas Instruments C2000 compiler family.""" |
||||
|
||||
import os |
||||
import typing as T |
||||
|
||||
from ...mesonlib import EnvironmentException |
||||
|
||||
if T.TYPE_CHECKING: |
||||
from ...environment import Environment |
||||
|
||||
c2000_buildtype_args = { |
||||
'plain': [], |
||||
'debug': [], |
||||
'debugoptimized': [], |
||||
'release': [], |
||||
'minsize': [], |
||||
'custom': [], |
||||
} # type: T.Dict[str, T.List[str]] |
||||
|
||||
c2000_optimization_args = { |
||||
'0': ['-O0'], |
||||
'g': ['-Ooff'], |
||||
'1': ['-O1'], |
||||
'2': ['-O2'], |
||||
'3': ['-O3'], |
||||
's': ['-04'] |
||||
} # type: T.Dict[str, T.List[str]] |
||||
|
||||
c2000_debug_args = { |
||||
False: [], |
||||
True: [] |
||||
} # type: T.Dict[bool, T.List[str]] |
||||
|
||||
|
||||
class C2000Compiler: |
||||
def __init__(self): |
||||
if not self.is_cross: |
||||
raise EnvironmentException('c2000 supports only cross-compilation.') |
||||
self.id = 'c2000' |
||||
# Assembly |
||||
self.can_compile_suffixes.add('asm') |
||||
default_warn_args = [] # type: T.List[str] |
||||
self.warn_args = {'0': [], |
||||
'1': default_warn_args, |
||||
'2': default_warn_args + [], |
||||
'3': default_warn_args + []} |
||||
|
||||
def get_pic_args(self) -> T.List[str]: |
||||
# PIC support is not enabled by default for c2000, |
||||
# if users want to use it, they need to add the required arguments explicitly |
||||
return [] |
||||
|
||||
def get_buildtype_args(self, buildtype: str) -> T.List[str]: |
||||
return c2000_buildtype_args[buildtype] |
||||
|
||||
def get_pch_suffix(self) -> str: |
||||
return 'pch' |
||||
|
||||
def get_pch_use_args(self, pch_dir: str, header: str) -> T.List[str]: |
||||
return [] |
||||
|
||||
# Override CCompiler.get_dependency_gen_args |
||||
def get_dependency_gen_args(self, outtarget: str, outfile: str) -> T.List[str]: |
||||
return [] |
||||
|
||||
def thread_flags(self, env: 'Environment') -> T.List[str]: |
||||
return [] |
||||
|
||||
def get_coverage_args(self) -> T.List[str]: |
||||
return [] |
||||
|
||||
def get_no_stdinc_args(self) -> T.List[str]: |
||||
return [] |
||||
|
||||
def get_no_stdlib_link_args(self) -> T.List[str]: |
||||
return [] |
||||
|
||||
def get_optimization_args(self, optimization_level: str) -> T.List[str]: |
||||
return c2000_optimization_args[optimization_level] |
||||
|
||||
def get_debug_args(self, is_debug: bool) -> T.List[str]: |
||||
return c2000_debug_args[is_debug] |
||||
|
||||
@classmethod |
||||
def unix_args_to_native(cls, args: T.List[str]) -> T.List[str]: |
||||
result = [] |
||||
for i in args: |
||||
if i.startswith('-D'): |
||||
i = '-define=' + i[2:] |
||||
if i.startswith('-I'): |
||||
i = '-include=' + i[2:] |
||||
if i.startswith('-Wl,-rpath='): |
||||
continue |
||||
elif i == '--print-search-dirs': |
||||
continue |
||||
elif i.startswith('-L'): |
||||
continue |
||||
result.append(i) |
||||
return result |
||||
|
||||
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): |
||||
if i[:9] == '-include=': |
||||
parameter_list[idx] = i[:9] + os.path.normpath(os.path.join(build_dir, i[9:])) |
||||
|
||||
return parameter_list |
@ -0,0 +1,123 @@ |
||||
# Copyright 2012-2019 The Meson development team |
||||
|
||||
# Licensed 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. |
||||
|
||||
"""Representations specific to the Microchip XC16 C compiler family.""" |
||||
|
||||
import os |
||||
import typing as T |
||||
|
||||
from ...mesonlib import EnvironmentException |
||||
|
||||
if T.TYPE_CHECKING: |
||||
from ...environment import Environment |
||||
|
||||
xc16_buildtype_args = { |
||||
'plain': [], |
||||
'debug': [], |
||||
'debugoptimized': [], |
||||
'release': [], |
||||
'minsize': [], |
||||
'custom': [], |
||||
} # type: T.Dict[str, T.List[str]] |
||||
|
||||
xc16_optimization_args = { |
||||
'0': ['-O0'], |
||||
'g': ['-O0'], |
||||
'1': ['-O1'], |
||||
'2': ['-O2'], |
||||
'3': ['-O3'], |
||||
's': ['-Os'] |
||||
} # type: T.Dict[str, T.List[str]] |
||||
|
||||
xc16_debug_args = { |
||||
False: [], |
||||
True: [] |
||||
} # type: T.Dict[bool, T.List[str]] |
||||
|
||||
|
||||
class Xc16Compiler: |
||||
def __init__(self): |
||||
if not self.is_cross: |
||||
raise EnvironmentException('xc16 supports only cross-compilation.') |
||||
self.id = 'xc16' |
||||
# Assembly |
||||
self.can_compile_suffixes.add('s') |
||||
default_warn_args = [] # type: T.List[str] |
||||
self.warn_args = {'0': [], |
||||
'1': default_warn_args, |
||||
'2': default_warn_args + [], |
||||
'3': default_warn_args + []} |
||||
|
||||
def get_always_args(self) -> T.List[str]: |
||||
return [] |
||||
|
||||
def get_pic_args(self) -> T.List[str]: |
||||
# PIC support is not enabled by default for xc16, |
||||
# if users want to use it, they need to add the required arguments explicitly |
||||
return [] |
||||
|
||||
def get_buildtype_args(self, buildtype: str) -> T.List[str]: |
||||
return xc16_buildtype_args[buildtype] |
||||
|
||||
def get_pch_suffix(self) -> str: |
||||
return 'pch' |
||||
|
||||
def get_pch_use_args(self, pch_dir: str, header: str) -> T.List[str]: |
||||
return [] |
||||
|
||||
# Override CCompiler.get_dependency_gen_args |
||||
def get_dependency_gen_args(self, outtarget: str, outfile: str) -> T.List[str]: |
||||
return [] |
||||
|
||||
def thread_flags(self, env: 'Environment') -> T.List[str]: |
||||
return [] |
||||
|
||||
def get_coverage_args(self) -> T.List[str]: |
||||
return [] |
||||
|
||||
def get_no_stdinc_args(self) -> T.List[str]: |
||||
return ['-nostdinc'] |
||||
|
||||
def get_no_stdlib_link_args(self) -> T.List[str]: |
||||
return ['--nostdlib'] |
||||
|
||||
def get_optimization_args(self, optimization_level: str) -> T.List[str]: |
||||
return xc16_optimization_args[optimization_level] |
||||
|
||||
def get_debug_args(self, is_debug: bool) -> T.List[str]: |
||||
return xc16_debug_args[is_debug] |
||||
|
||||
@classmethod |
||||
def unix_args_to_native(cls, args: T.List[str]) -> T.List[str]: |
||||
result = [] |
||||
for i in args: |
||||
if i.startswith('-D'): |
||||
i = '-D' + i[2:] |
||||
if i.startswith('-I'): |
||||
i = '-I' + i[2:] |
||||
if i.startswith('-Wl,-rpath='): |
||||
continue |
||||
elif i == '--print-search-dirs': |
||||
continue |
||||
elif i.startswith('-L'): |
||||
continue |
||||
result.append(i) |
||||
return result |
||||
|
||||
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): |
||||
if i[:9] == '-I': |
||||
parameter_list[idx] = i[:9] + os.path.normpath(os.path.join(build_dir, i[9:])) |
||||
|
||||
return parameter_list |
Loading…
Reference in new issue