Skip to content

Commit 8dfa3ea

Browse files
committed
Merge pull request #1709 from 0xc0170/fix_uvision_flags_asm
uvision - fix c/asm flags
2 parents 9cef243 + ded7d39 commit 8dfa3ea

File tree

1 file changed

+15
-12
lines changed
  • workspace_tools/toolchains

1 file changed

+15
-12
lines changed

workspace_tools/toolchains/arm.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"""
1717
import re
1818
from os.path import join
19+
import copy
1920

2021
from workspace_tools.toolchains import mbedToolchain
2122
from workspace_tools.settings import ARM_BIN, ARM_INC, ARM_LIB, MY_ARM_CLIB, ARM_CPPLIB
@@ -31,10 +32,10 @@ class ARM(mbedToolchain):
3132
DEP_PATTERN = re.compile('\S+:\s(?P<file>.+)\n')
3233

3334
DEFAULT_FLAGS = {
34-
'common': ["-c", "--gnu", "-Otime", "--split_sections", "--apcs=interwork",
35-
"--brief_diagnostics", "--restrict", "--multibyte_chars"],
35+
'common': ["--apcs=interwork",
36+
"--brief_diagnostics"],
3637
'asm': ['-I%s' % ARM_INC],
37-
'c': ["--md", "--no_depend_system_headers", '-I%s' % ARM_INC,
38+
'c': ["-c", "--gnu", "-Otime", "--restrict", "--multibyte_chars", "--split_sections", "--md", "--no_depend_system_headers", '-I%s' % ARM_INC,
3839
"--c99", "-D__ASSERT_MSG" ],
3940
'cxx': ["--cpp", "--no_rtti", "-D__ASSERT_MSG"],
4041
'ld': [],
@@ -54,18 +55,18 @@ def __init__(self, target, options=None, notify=None, macros=None, silent=False,
5455

5556
main_cc = join(ARM_BIN, "armcc")
5657

57-
self.flags = self.DEFAULT_FLAGS
58+
self.flags = copy.deepcopy(self.DEFAULT_FLAGS)
5859
self.flags['common'] += ["--cpu=%s" % cpu]
5960
if "save-asm" in self.options:
6061
self.flags['common'].extend(["--asm", "--interleave"])
6162

6263
if "debug-info" in self.options:
6364
self.flags['common'].append("-g")
64-
self.flags['common'].append("-O0")
65+
self.flags['c'].append("-O0")
6566
else:
66-
self.flags['common'].append("-O3")
67+
self.flags['c'].append("-O3")
6768

68-
self.asm = [main_cc] + self.flags['common'] + self.flags['asm']
69+
self.asm = [main_cc] + self.flags['common'] + self.flags['asm'] + self.flags['c']
6970
if not "analyze" in self.options:
7071
self.cc = [main_cc] + self.flags['common'] + self.flags['c']
7172
self.cppc = [main_cc] + self.flags['common'] + self.flags['c'] + self.flags['cxx']
@@ -162,12 +163,14 @@ class ARM_MICRO(ARM):
162163
def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False):
163164
ARM.__init__(self, target, options, notify, macros, silent, extra_verbose=extra_verbose)
164165

165-
# Compiler
166-
self.flags['asm'] += ["-D__MICROLIB"]
167-
self.flags['c'] += ["--library_type=microlib", "-D__MICROLIB"]
168-
self.flags['cxx'] += ["--library_type=microlib", "-D__MICROLIB"]
166+
# add microlib to the command line flags
167+
self.asm += ["-D__MICROLIB"]
168+
self.cc += ["--library_type=microlib", "-D__MICROLIB"]
169+
self.cppc += ["--library_type=microlib", "-D__MICROLIB"]
169170

170-
# Linker
171+
# the exporter uses --library_type flag to set microlib
172+
self.flags['c'] += ["--library_type=microlib"]
173+
self.flags['cxx'] += ["--library_type=microlib"]
171174
self.flags['ld'].append("--library_type=microlib")
172175

173176
# We had to patch microlib to add C++ support

0 commit comments

Comments
 (0)