mirror of https://github.com/ARMmbed/mbed-os.git
Enable export to uvision5 + armc6
parent
546dafbadc
commit
fa1bf57a4d
|
@ -34,7 +34,8 @@ from . import (lpcxpresso, ds5_5, iar, makefile, embitz, coide, kds, simplicity,
|
|||
cdt, vscode, gnuarmeclipse, qtcreator, cmake, nb, cces, codeblocks)
|
||||
|
||||
EXPORTERS = {
|
||||
u'uvision5': uvision.Uvision,
|
||||
u'uvision6': uvision.UvisionArmc6,
|
||||
u'uvision5': uvision.UvisionArmc5,
|
||||
u'make_gcc_arm': makefile.GccArm,
|
||||
u'make_armc5': makefile.Armc5,
|
||||
u'make_armc6': makefile.Armc6,
|
||||
|
|
|
@ -118,8 +118,6 @@ class Uvision(Exporter):
|
|||
project file (.uvprojx).
|
||||
The needed information can be viewed in uvision.tmpl
|
||||
"""
|
||||
NAME = 'uvision5'
|
||||
TOOLCHAIN = 'ARM'
|
||||
|
||||
POST_BINARY_WHITELIST = set([
|
||||
"MCU_NRF51Code.binary_hook",
|
||||
|
@ -131,22 +129,6 @@ class Uvision(Exporter):
|
|||
"NCS36510TargetCode.ncs36510_addfib"
|
||||
])
|
||||
|
||||
@classmethod
|
||||
def is_target_supported(cls, target_name):
|
||||
target = TARGET_MAP[target_name]
|
||||
if not (set(target.supported_toolchains).intersection(
|
||||
set(["ARM", "uARM"]))):
|
||||
return False
|
||||
if not DeviceCMSIS.check_supported(target_name):
|
||||
return False
|
||||
if "Cortex-A" in target.core:
|
||||
return False
|
||||
if not hasattr(target, "post_binary_hook"):
|
||||
return True
|
||||
if target.post_binary_hook['function'] in cls.POST_BINARY_WHITELIST:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
#File associations within .uvprojx file
|
||||
file_types = {'.cpp': 8, '.c': 1, '.s': 2,
|
||||
|
@ -177,22 +159,28 @@ class Uvision(Exporter):
|
|||
def format_flags(self):
|
||||
"""Format toolchain flags for Uvision"""
|
||||
flags = copy.deepcopy(self.flags)
|
||||
# to be preprocessed with armcc
|
||||
asm_flag_string = (
|
||||
'--cpreproc --cpreproc_opts=-D__ASSERT_MSG,' +
|
||||
",".join(filter(lambda f: f.startswith("-D"), flags['asm_flags'])))
|
||||
flags['asm_flags'] = asm_flag_string
|
||||
# All non-asm flags are in one template field
|
||||
c_flags = list(set(flags['c_flags'] + flags['cxx_flags'] +flags['common_flags']))
|
||||
ld_flags = list(set(flags['ld_flags'] ))
|
||||
# These flags are in template to be set by user i n IDE
|
||||
template = ["--no_vla", "--cpp", "--c99"]
|
||||
# Flag is invalid if set in template
|
||||
# Optimizations are also set in the template
|
||||
invalid_flag = lambda x: x in template or re.match("-O(\d|time)", x)
|
||||
flags['c_flags'] = [flag.replace('"','\\"') for flag in c_flags if not invalid_flag(flag)]
|
||||
flags['c_flags'] = " ".join(flags['c_flags'])
|
||||
flags['ld_flags'] = " ".join(flags['ld_flags'])
|
||||
|
||||
c_flags = set(
|
||||
flags['c_flags'] + flags['cxx_flags'] + flags['common_flags']
|
||||
)
|
||||
in_template = set(
|
||||
["--no_vla", "--cpp", "--c99", "-std=gnu99", "-std=g++98"]
|
||||
)
|
||||
|
||||
def valid_flag(x):
|
||||
return x not in in_template or not x.startswith("-O")
|
||||
|
||||
def is_define(s):
|
||||
return s.startswith("-D")
|
||||
|
||||
flags['c_flags'] = " ".join(f.replace('"', '\\"') for f in c_flags
|
||||
if (valid_flag(f) and not is_define(f)))
|
||||
flags['c_defines'] = " ".join(f[2:] for f in c_flags if is_define(f))
|
||||
flags['ld_flags'] = " ".join(set(flags['ld_flags']))
|
||||
return flags
|
||||
|
||||
def format_src(self, srcs):
|
||||
|
@ -244,6 +232,8 @@ class Uvision(Exporter):
|
|||
else:
|
||||
ctx['fpu_setting'] = 1
|
||||
ctx['fputype'] = self.format_fpu(core)
|
||||
ctx['armc6'] = int(self.TOOLCHAIN is 'ARMC6')
|
||||
ctx['toolchain_name'] = self.TOOLCHAIN_NAME
|
||||
ctx.update(self.format_flags())
|
||||
self.gen_file('uvision/uvision.tmpl', ctx, self.project_name+".uvprojx")
|
||||
self.gen_file('uvision/uvision_debug.tmpl', ctx, self.project_name + ".uvoptx")
|
||||
|
@ -285,3 +275,54 @@ class Uvision(Exporter):
|
|||
return -1
|
||||
else:
|
||||
return 0
|
||||
|
||||
class UvisionArmc5(Uvision):
|
||||
NAME = 'uvision5-armc5'
|
||||
TOOLCHAIN = 'ARM'
|
||||
TOOLCHAIN_NAME = ''
|
||||
|
||||
@classmethod
|
||||
def is_target_supported(cls, target_name):
|
||||
target = TARGET_MAP[target_name]
|
||||
if not (set(target.supported_toolchains).intersection(
|
||||
set(["ARM", "uARM"]))):
|
||||
return False
|
||||
if not DeviceCMSIS.check_supported(target_name):
|
||||
return False
|
||||
if "Cortex-A" in target.core:
|
||||
return False
|
||||
if not hasattr(target, "post_binary_hook"):
|
||||
return True
|
||||
if target.post_binary_hook['function'] in cls.POST_BINARY_WHITELIST:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
@classmethod
|
||||
def is_target_supported(cls, target_name):
|
||||
target = TARGET_MAP[target_name]
|
||||
return apply_supported_whitelist(
|
||||
cls.TOOLCHAIN, cls.POST_BINARY_WHITELIST, target) and\
|
||||
DeviceCMSIS.check_supported(target_name)
|
||||
|
||||
class UvisionArmc6(Uvision):
|
||||
NAME = 'uvision5-armc6'
|
||||
TOOLCHAIN = 'ARMC6'
|
||||
TOOLCHAIN_NAME = '6070000::V6.7::.\ARMCLANG'
|
||||
|
||||
@classmethod
|
||||
def is_target_supported(cls, target_name):
|
||||
target = TARGET_MAP[target_name]
|
||||
if not (set(target.supported_toolchains).intersection(
|
||||
set(["ARMC6"]))):
|
||||
return False
|
||||
if not DeviceCMSIS.check_supported(target_name):
|
||||
return False
|
||||
if "Cortex-A" in target.core:
|
||||
return False
|
||||
if not hasattr(target, "post_binary_hook"):
|
||||
return True
|
||||
if target.post_binary_hook['function'] in cls.POST_BINARY_WHITELIST:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
<TargetName>{{name}}</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
{% if toolchain_name %}
|
||||
<pCCUsed>{{toolchain_name}}</pCCUsed>
|
||||
{% endif %}
|
||||
<uAC6>{{armc6}}</uAC6>
|
||||
<TargetOption>
|
||||
<TargetCommonOption>
|
||||
<Device>{{device.dname}}</Device>
|
||||
|
@ -354,7 +358,7 @@
|
|||
<Optim>1</Optim>
|
||||
<oTime>0</oTime>
|
||||
<SplitLS>0</SplitLS>
|
||||
<OneElfS>0</OneElfS>
|
||||
<OneElfS>1</OneElfS>
|
||||
<Strict>0</Strict>
|
||||
<EnumInt>0</EnumInt>
|
||||
<PlainCh>0</PlainCh>
|
||||
|
@ -365,8 +369,8 @@
|
|||
<uSurpInc>0</uSurpInc>
|
||||
<uC99>1</uC99>
|
||||
<useXO>0</useXO>
|
||||
<v6Lang>1</v6Lang>
|
||||
<v6LangP>1</v6LangP>
|
||||
<v6Lang>4</v6Lang>
|
||||
<v6LangP>2</v6LangP>
|
||||
<vShortEn>1</vShortEn>
|
||||
<vShortWch>1</vShortWch>
|
||||
<v6Lto>0</v6Lto>
|
||||
|
@ -374,7 +378,7 @@
|
|||
<v6Rtti>0</v6Rtti>
|
||||
<VariousControls>
|
||||
<MiscControls>{{c_flags}}</MiscControls>
|
||||
<Define></Define>
|
||||
<Define>{{c_defines}}</Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>{{include_paths}}</IncludePath>
|
||||
</VariousControls>
|
||||
|
@ -434,5 +438,4 @@
|
|||
</Groups>
|
||||
</Target>
|
||||
</Targets>
|
||||
|
||||
</Project>
|
||||
|
|
Loading…
Reference in New Issue