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)
|
cdt, vscode, gnuarmeclipse, qtcreator, cmake, nb, cces, codeblocks)
|
||||||
|
|
||||||
EXPORTERS = {
|
EXPORTERS = {
|
||||||
u'uvision5': uvision.Uvision,
|
u'uvision6': uvision.UvisionArmc6,
|
||||||
|
u'uvision5': uvision.UvisionArmc5,
|
||||||
u'make_gcc_arm': makefile.GccArm,
|
u'make_gcc_arm': makefile.GccArm,
|
||||||
u'make_armc5': makefile.Armc5,
|
u'make_armc5': makefile.Armc5,
|
||||||
u'make_armc6': makefile.Armc6,
|
u'make_armc6': makefile.Armc6,
|
||||||
|
|
|
@ -118,8 +118,6 @@ class Uvision(Exporter):
|
||||||
project file (.uvprojx).
|
project file (.uvprojx).
|
||||||
The needed information can be viewed in uvision.tmpl
|
The needed information can be viewed in uvision.tmpl
|
||||||
"""
|
"""
|
||||||
NAME = 'uvision5'
|
|
||||||
TOOLCHAIN = 'ARM'
|
|
||||||
|
|
||||||
POST_BINARY_WHITELIST = set([
|
POST_BINARY_WHITELIST = set([
|
||||||
"MCU_NRF51Code.binary_hook",
|
"MCU_NRF51Code.binary_hook",
|
||||||
|
@ -131,22 +129,6 @@ class Uvision(Exporter):
|
||||||
"NCS36510TargetCode.ncs36510_addfib"
|
"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 associations within .uvprojx file
|
||||||
file_types = {'.cpp': 8, '.c': 1, '.s': 2,
|
file_types = {'.cpp': 8, '.c': 1, '.s': 2,
|
||||||
|
@ -177,22 +159,28 @@ class Uvision(Exporter):
|
||||||
def format_flags(self):
|
def format_flags(self):
|
||||||
"""Format toolchain flags for Uvision"""
|
"""Format toolchain flags for Uvision"""
|
||||||
flags = copy.deepcopy(self.flags)
|
flags = copy.deepcopy(self.flags)
|
||||||
# to be preprocessed with armcc
|
|
||||||
asm_flag_string = (
|
asm_flag_string = (
|
||||||
'--cpreproc --cpreproc_opts=-D__ASSERT_MSG,' +
|
'--cpreproc --cpreproc_opts=-D__ASSERT_MSG,' +
|
||||||
",".join(filter(lambda f: f.startswith("-D"), flags['asm_flags'])))
|
",".join(filter(lambda f: f.startswith("-D"), flags['asm_flags'])))
|
||||||
flags['asm_flags'] = asm_flag_string
|
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']))
|
c_flags = set(
|
||||||
ld_flags = list(set(flags['ld_flags'] ))
|
flags['c_flags'] + flags['cxx_flags'] + flags['common_flags']
|
||||||
# These flags are in template to be set by user i n IDE
|
)
|
||||||
template = ["--no_vla", "--cpp", "--c99"]
|
in_template = set(
|
||||||
# Flag is invalid if set in template
|
["--no_vla", "--cpp", "--c99", "-std=gnu99", "-std=g++98"]
|
||||||
# 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)]
|
def valid_flag(x):
|
||||||
flags['c_flags'] = " ".join(flags['c_flags'])
|
return x not in in_template or not x.startswith("-O")
|
||||||
flags['ld_flags'] = " ".join(flags['ld_flags'])
|
|
||||||
|
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
|
return flags
|
||||||
|
|
||||||
def format_src(self, srcs):
|
def format_src(self, srcs):
|
||||||
|
@ -244,6 +232,8 @@ class Uvision(Exporter):
|
||||||
else:
|
else:
|
||||||
ctx['fpu_setting'] = 1
|
ctx['fpu_setting'] = 1
|
||||||
ctx['fputype'] = self.format_fpu(core)
|
ctx['fputype'] = self.format_fpu(core)
|
||||||
|
ctx['armc6'] = int(self.TOOLCHAIN is 'ARMC6')
|
||||||
|
ctx['toolchain_name'] = self.TOOLCHAIN_NAME
|
||||||
ctx.update(self.format_flags())
|
ctx.update(self.format_flags())
|
||||||
self.gen_file('uvision/uvision.tmpl', ctx, self.project_name+".uvprojx")
|
self.gen_file('uvision/uvision.tmpl', ctx, self.project_name+".uvprojx")
|
||||||
self.gen_file('uvision/uvision_debug.tmpl', ctx, self.project_name + ".uvoptx")
|
self.gen_file('uvision/uvision_debug.tmpl', ctx, self.project_name + ".uvoptx")
|
||||||
|
@ -285,3 +275,54 @@ class Uvision(Exporter):
|
||||||
return -1
|
return -1
|
||||||
else:
|
else:
|
||||||
return 0
|
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>
|
<TargetName>{{name}}</TargetName>
|
||||||
<ToolsetNumber>0x4</ToolsetNumber>
|
<ToolsetNumber>0x4</ToolsetNumber>
|
||||||
<ToolsetName>ARM-ADS</ToolsetName>
|
<ToolsetName>ARM-ADS</ToolsetName>
|
||||||
|
{% if toolchain_name %}
|
||||||
|
<pCCUsed>{{toolchain_name}}</pCCUsed>
|
||||||
|
{% endif %}
|
||||||
|
<uAC6>{{armc6}}</uAC6>
|
||||||
<TargetOption>
|
<TargetOption>
|
||||||
<TargetCommonOption>
|
<TargetCommonOption>
|
||||||
<Device>{{device.dname}}</Device>
|
<Device>{{device.dname}}</Device>
|
||||||
|
@ -354,7 +358,7 @@
|
||||||
<Optim>1</Optim>
|
<Optim>1</Optim>
|
||||||
<oTime>0</oTime>
|
<oTime>0</oTime>
|
||||||
<SplitLS>0</SplitLS>
|
<SplitLS>0</SplitLS>
|
||||||
<OneElfS>0</OneElfS>
|
<OneElfS>1</OneElfS>
|
||||||
<Strict>0</Strict>
|
<Strict>0</Strict>
|
||||||
<EnumInt>0</EnumInt>
|
<EnumInt>0</EnumInt>
|
||||||
<PlainCh>0</PlainCh>
|
<PlainCh>0</PlainCh>
|
||||||
|
@ -365,8 +369,8 @@
|
||||||
<uSurpInc>0</uSurpInc>
|
<uSurpInc>0</uSurpInc>
|
||||||
<uC99>1</uC99>
|
<uC99>1</uC99>
|
||||||
<useXO>0</useXO>
|
<useXO>0</useXO>
|
||||||
<v6Lang>1</v6Lang>
|
<v6Lang>4</v6Lang>
|
||||||
<v6LangP>1</v6LangP>
|
<v6LangP>2</v6LangP>
|
||||||
<vShortEn>1</vShortEn>
|
<vShortEn>1</vShortEn>
|
||||||
<vShortWch>1</vShortWch>
|
<vShortWch>1</vShortWch>
|
||||||
<v6Lto>0</v6Lto>
|
<v6Lto>0</v6Lto>
|
||||||
|
@ -374,7 +378,7 @@
|
||||||
<v6Rtti>0</v6Rtti>
|
<v6Rtti>0</v6Rtti>
|
||||||
<VariousControls>
|
<VariousControls>
|
||||||
<MiscControls>{{c_flags}}</MiscControls>
|
<MiscControls>{{c_flags}}</MiscControls>
|
||||||
<Define></Define>
|
<Define>{{c_defines}}</Define>
|
||||||
<Undefine></Undefine>
|
<Undefine></Undefine>
|
||||||
<IncludePath>{{include_paths}}</IncludePath>
|
<IncludePath>{{include_paths}}</IncludePath>
|
||||||
</VariousControls>
|
</VariousControls>
|
||||||
|
@ -434,5 +438,4 @@
|
||||||
</Groups>
|
</Groups>
|
||||||
</Target>
|
</Target>
|
||||||
</Targets>
|
</Targets>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
Loading…
Reference in New Issue