µVision export: Add ARMC6 `-std` handling

This is limited to ARMC6 because as of µVision V5.27 you can't set C++11
for ARMC5.

Also current µVision does not support gnu++14. We should be able to get
is as `<default>`, as it is the default for ARM Compiler 6.10-6.12,
but this option does not work as documented and actually requests
gnu++89 explicitly. So gnu++14 is mapped to gnu++11.
pull/10427/head
Kevin Bracey 2019-04-18 14:33:59 +03:00
parent 5b859c47ee
commit 85041025cc
2 changed files with 30 additions and 2 deletions

View File

@ -288,6 +288,34 @@ class Uvision(Exporter):
ctx['fputype'] = self.format_fpu(ctx['device'].core)
ctx['armc6'] = int(self.TOOLCHAIN is 'ARMC6')
ctx['toolchain_name'] = self.TOOLCHAIN_NAME
std = [flag for flag in self.flags['c_flags'] if flag.startswith("-std=")]
if len(std) >= 1:
std = std[-1][len('-std='):]
else:
std = None
c_std = {
'c89': 1, 'gnu89': 2,
'c90': 1, 'gnu90': 2,
'c99': 3, 'gnu99': 4,
'c11': 5, 'gnu11': 6,
}
ctx['v6_lang'] = c_std.get(std, 0)
std = [flag for flag in self.flags['cxx_flags'] if flag.startswith("-std=")]
if len(std) >= 1:
std = std[-1][len('-std='):]
else:
std = None
cpp_std = {
'c++98': 1, 'gnu++98': 2,
'c++03': 5, 'gnu++03': 2, # UVision 5.27.1.0 does not support gnu++03 - fall back to gnu++98
'c++11': 3, 'gnu++11': 4,
'c++14': 6, 'gnu++14': 4, # UVision 5.27.1.0 does not support gnu++14 - should be able to get it as compiler default, but that doesn't work as documented and requests gnu++98. So fall back to gnu++11
'c++17': 6, 'gnu++17': 4, # UVision 5.27.1.0 does not support c++17/gnu++17 - fall back to c++14/gnu++11
}
ctx['v6_lang_p'] = cpp_std.get(std, 0)
ctx.update(self.format_flags())
self.gen_file(
'uvision/uvision.tmpl', ctx, self.project_name + ".uvprojx"

View File

@ -369,8 +369,8 @@
<uSurpInc>0</uSurpInc>
<uC99>1</uC99>
<useXO>0</useXO>
<v6Lang>4</v6Lang>
<v6LangP>2</v6LangP>
<v6Lang>{{v6_lang}}</v6Lang>
<v6LangP>{{v6_lang_p}}</v6LangP>
<vShortEn>1</vShortEn>
<vShortWch>1</vShortWch>
<v6Lto>0</v6Lto>