Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: export/exporters.py
- Revision:
- 29:1210849dba19
- Parent:
- 24:25bff2709c20
- Child:
- 31:8ea194f6145b
diff -r e080013bb94e -r 1210849dba19 export/exporters.py
--- a/export/exporters.py Mon Aug 29 10:55:42 2016 +0100
+++ b/export/exporters.py Mon Aug 29 11:18:36 2016 +0100
@@ -43,7 +43,7 @@
self.build_url_resolver = build_url_resolver
jinja_loader = FileSystemLoader(os.path.dirname(os.path.abspath(__file__)))
self.jinja_environment = Environment(loader=jinja_loader)
- self.extra_symbols = extra_symbols
+ self.extra_symbols = extra_symbols if extra_symbols else []
self.config_macros = []
self.sources_relative = sources_relative
self.config_header = None
@@ -59,6 +59,11 @@
def progen_flags(self):
if not hasattr(self, "_progen_flag_cache") :
self._progen_flag_cache = dict([(key + "_flags", value) for key,value in self.flags.iteritems()])
+ asm_defines = ["-D"+symbol for symbol in self.toolchain.get_symbols(True)]
+ c_defines = ["-D" + symbol for symbol in self.toolchain.get_symbols()]
+ self._progen_flag_cache['asm_flags'] += asm_defines
+ self._progen_flag_cache['c_flags'] += c_defines
+ self._progen_flag_cache['cxx_flags'] += c_defines
if self.config_header:
self._progen_flag_cache['c_flags'] += self.toolchain.get_config_option(self.config_header)
self._progen_flag_cache['cxx_flags'] += self.toolchain.get_config_option(self.config_header)
@@ -196,6 +201,7 @@
self.config_header = self.toolchain.MBED_CONFIG_FILE_NAME
config.get_config_data_header(join(trg_path, self.config_header))
self.config_macros = []
+ self.resources.inc_dirs.append(".")
else:
# And add the configuration macros to the toolchain
self.config_macros = config.get_config_data_macros()
@@ -213,11 +219,16 @@
""" This function returns symbols which must be exported.
Please add / overwrite symbols in each exporter separately
"""
- symbols = self.toolchain.get_symbols() + self.config_macros
+
# We have extra symbols from e.g. libraries, we want to have them also added to export
- if add_extra_symbols:
- if self.extra_symbols is not None:
- symbols.extend(self.extra_symbols)
+ extra = self.extra_symbols if add_extra_symbols else []
+ if hasattr(self, "MBED_CONFIG_HEADER_SUPPORTED") and self.MBED_CONFIG_HEADER_SUPPORTED:
+ # If the config header is supported, we will preinclude it and do not not
+ # need the macros as preprocessor flags
+ return extra
+
+ symbols = self.toolchain.get_symbols(True) + self.toolchain.get_symbols() \
+ + self.config_macros + extra
return symbols
def zip_working_directory_and_clean_up(tempdirectory=None, destination=None, program_name=None, clean=True):
