16
16
"""
17
17
import re
18
18
from os .path import join
19
+ import copy
19
20
20
21
from workspace_tools .toolchains import mbedToolchain
21
22
from workspace_tools .settings import ARM_BIN , ARM_INC , ARM_LIB , MY_ARM_CLIB , ARM_CPPLIB
@@ -31,10 +32,10 @@ class ARM(mbedToolchain):
31
32
DEP_PATTERN = re .compile ('\S+:\s(?P<file>.+)\n ' )
32
33
33
34
DEFAULT_FLAGS = {
34
- 'common' : ["-c" , "--gnu" , "-Otime" , "--split_sections" , "- -apcs=interwork" ,
35
- "--brief_diagnostics" , "--restrict" , "--multibyte_chars" ],
35
+ 'common' : ["--apcs=interwork" ,
36
+ "--brief_diagnostics" ],
36
37
'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 ,
38
39
"--c99" , "-D__ASSERT_MSG" ],
39
40
'cxx' : ["--cpp" , "--no_rtti" , "-D__ASSERT_MSG" ],
40
41
'ld' : [],
@@ -54,18 +55,18 @@ def __init__(self, target, options=None, notify=None, macros=None, silent=False,
54
55
55
56
main_cc = join (ARM_BIN , "armcc" )
56
57
57
- self .flags = self .DEFAULT_FLAGS
58
+ self .flags = copy . deepcopy ( self .DEFAULT_FLAGS )
58
59
self .flags ['common' ] += ["--cpu=%s" % cpu ]
59
60
if "save-asm" in self .options :
60
61
self .flags ['common' ].extend (["--asm" , "--interleave" ])
61
62
62
63
if "debug-info" in self .options :
63
64
self .flags ['common' ].append ("-g" )
64
- self .flags ['common ' ].append ("-O0" )
65
+ self .flags ['c ' ].append ("-O0" )
65
66
else :
66
- self .flags ['common ' ].append ("-O3" )
67
+ self .flags ['c ' ].append ("-O3" )
67
68
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' ]
69
70
if not "analyze" in self .options :
70
71
self .cc = [main_cc ] + self .flags ['common' ] + self .flags ['c' ]
71
72
self .cppc = [main_cc ] + self .flags ['common' ] + self .flags ['c' ] + self .flags ['cxx' ]
@@ -162,12 +163,14 @@ class ARM_MICRO(ARM):
162
163
def __init__ (self , target , options = None , notify = None , macros = None , silent = False , extra_verbose = False ):
163
164
ARM .__init__ (self , target , options , notify , macros , silent , extra_verbose = extra_verbose )
164
165
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" ]
169
170
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" ]
171
174
self .flags ['ld' ].append ("--library_type=microlib" )
172
175
173
176
# We had to patch microlib to add C++ support
0 commit comments