@@ -43,7 +43,7 @@ def __init__(self, target, inputDir, program_name, build_url_resolver, extra_sym
4343 self .build_url_resolver = build_url_resolver
4444 jinja_loader = FileSystemLoader (os .path .dirname (os .path .abspath (__file__ )))
4545 self .jinja_environment = Environment (loader = jinja_loader )
46- self .extra_symbols = extra_symbols
46+ self .extra_symbols = extra_symbols if extra_symbols else []
4747 self .config_macros = []
4848 self .sources_relative = sources_relative
4949 self .config_header = None
@@ -59,6 +59,11 @@ def flags(self):
5959 def progen_flags (self ):
6060 if not hasattr (self , "_progen_flag_cache" ) :
6161 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
6267 if self .config_header :
6368 self ._progen_flag_cache ['c_flags' ] += self .toolchain .get_config_option (self .config_header )
6469 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):
214219 """ This function returns symbols which must be exported.
215220 Please add / overwrite symbols in each exporter separately
216221 """
217- symbols = self . toolchain . get_symbols () + self . config_macros
222+
218223 # 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
222232 return symbols
223233
224234def zip_working_directory_and_clean_up (tempdirectory = None , destination = None , program_name = None , clean = True ):
0 commit comments