@@ -43,7 +43,7 @@ def __init__(self, target, inputDir, program_name, build_url_resolver, extra_sym
43
43
self .build_url_resolver = build_url_resolver
44
44
jinja_loader = FileSystemLoader (os .path .dirname (os .path .abspath (__file__ )))
45
45
self .jinja_environment = Environment (loader = jinja_loader )
46
- self .extra_symbols = extra_symbols
46
+ self .extra_symbols = extra_symbols if extra_symbols else []
47
47
self .config_macros = []
48
48
self .sources_relative = sources_relative
49
49
self .config_header = None
@@ -59,6 +59,11 @@ def flags(self):
59
59
def progen_flags (self ):
60
60
if not hasattr (self , "_progen_flag_cache" ) :
61
61
self ._progen_flag_cache = dict ([(key + "_flags" , value ) for key ,value in self .flags .iteritems ()])
62
+ asm_defines = ["-D" + symbol for symbol in self .toolchain .get_symbols (True )]
63
+ c_defines = ["-D" + symbol for symbol in self .toolchain .get_symbols ()]
64
+ self ._progen_flag_cache ['asm_flags' ] += asm_defines
65
+ self ._progen_flag_cache ['c_flags' ] += c_defines
66
+ self ._progen_flag_cache ['cxx_flags' ] += c_defines
62
67
if self .config_header :
63
68
self ._progen_flag_cache ['c_flags' ] += self .toolchain .get_config_option (self .config_header )
64
69
self ._progen_flag_cache ['cxx_flags' ] += self .toolchain .get_config_option (self .config_header )
@@ -214,11 +219,16 @@ def get_symbols(self, add_extra_symbols=True):
214
219
""" This function returns symbols which must be exported.
215
220
Please add / overwrite symbols in each exporter separately
216
221
"""
217
- symbols = self . toolchain . get_symbols () + self . config_macros
222
+
218
223
# We have extra symbols from e.g. libraries, we want to have them also added to export
219
- if add_extra_symbols :
220
- if self .extra_symbols is not None :
221
- symbols .extend (self .extra_symbols )
224
+ extra = self .extra_symbols if add_extra_symbols else []
225
+ if hasattr (self , "MBED_CONFIG_HEADER_SUPPORTED" ) and self .MBED_CONFIG_HEADER_SUPPORTED :
226
+ # If the config header is supported, we will preinclude it and do not not
227
+ # need the macros as preprocessor flags
228
+ return extra
229
+
230
+ symbols = self .toolchain .get_symbols (True ) + self .toolchain .get_symbols () \
231
+ + self .config_macros + extra
222
232
return symbols
223
233
224
234
def zip_working_directory_and_clean_up (tempdirectory = None , destination = None , program_name = None , clean = True ):
0 commit comments