@@ -30,6 +30,16 @@ class ARM(mbedToolchain):
30
30
DIAGNOSTIC_PATTERN = re .compile ('"(?P<file>[^"]+)", line (?P<line>\d+)( \(column (?P<column>\d+)\)|): (?P<severity>Warning|Error): (?P<message>.+)' )
31
31
DEP_PATTERN = re .compile ('\S+:\s(?P<file>.+)\n ' )
32
32
33
+ DEFAULT_FLAGS = {
34
+ 'common' : ["-c" , "--gnu" , "-Otime" , "--split_sections" , "--apcs=interwork" ,
35
+ "--brief_diagnostics" , "--restrict" , "--multibyte_chars" ],
36
+ 'asm' : ['-I%s' % ARM_INC ],
37
+ 'c' : ["--md" , "--no_depend_system_headers" , '-I%s' % ARM_INC ,
38
+ "--c99" , "-D__ASSERT_MSG" ],
39
+ 'cxx' : ["--cpp" , "--no_rtti" , "-D__ASSERT_MSG" ],
40
+ 'ld' : [],
41
+ }
42
+
33
43
def __init__ (self , target , options = None , notify = None , macros = None , silent = False , extra_verbose = False ):
34
44
mbedToolchain .__init__ (self , target , options , notify , macros , silent , extra_verbose = extra_verbose )
35
45
@@ -43,33 +53,25 @@ def __init__(self, target, options=None, notify=None, macros=None, silent=False,
43
53
cpu = target .core
44
54
45
55
main_cc = join (ARM_BIN , "armcc" )
46
- common = ["-c" ,
47
- "--cpu=%s" % cpu , "--gnu" ,
48
- "-Otime" , "--split_sections" , "--apcs=interwork" ,
49
- "--brief_diagnostics" , "--restrict" , "--multibyte_chars"
50
- ]
51
56
57
+ self .flags = self .DEFAULT_FLAGS
58
+ self .flags ['common' ] += ["--cpu=%s" % cpu ]
52
59
if "save-asm" in self .options :
53
- common .extend (["--asm" , "--interleave" ])
60
+ self . flags [ ' common' ] .extend (["--asm" , "--interleave" ])
54
61
55
62
if "debug-info" in self .options :
56
- common .append ("-g" )
57
- common .append ("-O0" )
63
+ self . flags [ ' common' ] .append ("-g" )
64
+ self . flags [ ' common' ] .append ("-O0" )
58
65
else :
59
- common .append ("-O3" )
60
-
61
- common_c = [
62
- "--md" , "--no_depend_system_headers" ,
63
- '-I%s' % ARM_INC
64
- ]
66
+ self .flags ['common' ].append ("-O3" )
65
67
66
- self .asm = [main_cc ] + common + [ '-I%s' % ARM_INC ]
68
+ self .asm = [main_cc ] + self . flags [ ' common' ] + self . flags [ 'asm' ]
67
69
if not "analyze" in self .options :
68
- self .cc = [main_cc ] + common + common_c + [ "--c99" ]
69
- self .cppc = [main_cc ] + common + common_c + [ "--cpp" , "--no_rtti" ]
70
+ self .cc = [main_cc ] + self . flags [ ' common' ] + self . flags [ 'c' ]
71
+ self .cppc = [main_cc ] + self . flags [ ' common' ] + self . flags [ 'c' ] + self . flags [ 'cxx' ]
70
72
else :
71
- self .cc = [join (GOANNA_PATH , "goannacc" ), "--with-cc=" + main_cc .replace ('\\ ' , '/' ), "--dialect=armcc" , '--output-format="%s"' % self .GOANNA_FORMAT ] + common + common_c + [ "--c99" ]
72
- self .cppc = [join (GOANNA_PATH , "goannac++" ), "--with-cxx=" + main_cc .replace ('\\ ' , '/' ), "--dialect=armcc" , '--output-format="%s"' % self .GOANNA_FORMAT ] + common + common_c + [ "--cpp" , "--no_rtti" ]
73
+ self .cc = [join (GOANNA_PATH , "goannacc" ), "--with-cc=" + main_cc .replace ('\\ ' , '/' ), "--dialect=armcc" , '--output-format="%s"' % self .GOANNA_FORMAT ] + self . flags [ ' common' ] + self . flags [ 'c' ]
74
+ self .cppc = [join (GOANNA_PATH , "goannac++" ), "--with-cxx=" + main_cc .replace ('\\ ' , '/' ), "--dialect=armcc" , '--output-format="%s"' % self .GOANNA_FORMAT ] + self . flags [ ' common' ] + self . flags [ 'c' ] + self . flags [ 'cxx' ]
73
75
74
76
self .ld = [join (ARM_BIN , "armlink" )]
75
77
self .sys_libs = []
@@ -151,8 +153,6 @@ def binary(self, resources, elf, bin):
151
153
class ARM_STD (ARM ):
152
154
def __init__ (self , target , options = None , notify = None , macros = None , silent = False , extra_verbose = False ):
153
155
ARM .__init__ (self , target , options , notify , macros , silent , extra_verbose = extra_verbose )
154
- self .cc += ["-D__ASSERT_MSG" ]
155
- self .cppc += ["-D__ASSERT_MSG" ]
156
156
self .ld .append ("--libpath=%s" % ARM_LIB )
157
157
158
158
@@ -163,17 +163,17 @@ def __init__(self, target, options=None, notify=None, macros=None, silent=False,
163
163
ARM .__init__ (self , target , options , notify , macros , silent , extra_verbose = extra_verbose )
164
164
165
165
# Compiler
166
- self .asm += ["-D__MICROLIB" ]
167
- self .cc += ["--library_type=microlib" , "-D__MICROLIB" , "-D__ASSERT_MSG " ]
168
- self .cppc += ["--library_type=microlib" , "-D__MICROLIB" , "-D__ASSERT_MSG " ]
166
+ self .flags [ ' asm' ] += ["-D__MICROLIB" ]
167
+ self .flags [ 'c' ] += ["--library_type=microlib" , "-D__MICROLIB" ]
168
+ self .flags [ 'cxx' ] += ["--library_type=microlib" , "-D__MICROLIB" ]
169
169
170
170
# Linker
171
- self .ld .append ("--library_type=microlib" )
171
+ self .flags [ 'ld' ] .append ("--library_type=microlib" )
172
172
173
173
# We had to patch microlib to add C++ support
174
174
# In later releases this patch should have entered mainline
175
175
if ARM_MICRO .PATCHED_LIBRARY :
176
- self .ld .append ("--noscanlib" )
176
+ self .flags [ 'ld' ] .append ("--noscanlib" )
177
177
178
178
# System Libraries
179
179
self .sys_libs .extend ([join (MY_ARM_CLIB , lib + ".l" ) for lib in ["mc_p" , "mf_p" , "m_ps" ]])
0 commit comments