Skip to content

Update exporters to include and use mbed_conf.h #1964

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion tools/export/exporters.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def __init__(self, target, inputDir, program_name, build_url_resolver, extra_sym
self.jinja_environment = Environment(loader=jinja_loader)
self.extra_symbols = extra_symbols
self.config_macros = []
self.config_header = None

def get_toolchain(self):
return self.TOOLCHAIN
Expand All @@ -47,6 +48,9 @@ def flags(self):
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()])
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)
return self._progen_flag_cache

def __scan_and_copy(self, src_path, trg_path):
Expand Down Expand Up @@ -168,7 +172,10 @@ def scan_and_copy_resources(self, prj_paths, trg_path, relative=False):

# And add the configuration macros to the toolchain
self.config_macros = config.get_config_data_macros()


# Add the configuration file to the target directory
self.config_header = "mbed_conf.h"
cfg.get_config_data_header(join(trg_path, self.config_header))
Copy link
Contributor

@0xc0170 0xc0170 Jun 17, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cfg is not defined in this context NameError: global name 'cfg' is not defined. should be config

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're right. the rebase renamed it to config.

# Check the existence of a binary build of the mbed library for the desired target
# This prevents exporting the mbed libraries from source
# if not self.toolchain.mbed_libs:
Expand Down
5 changes: 4 additions & 1 deletion tools/toolchains/arm.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,14 @@ def get_dep_option(self, object):
dep_path = base + '.d'
return ["--depend", dep_path]

def get_config_option(self, config_header) :
return ['--preinclude', config_header]

def get_compile_options(self, defines, includes):
opts = ['-D%s' % d for d in defines] + ['--via', self.get_inc_file(includes)]
config_header = self.get_config_header()
if config_header is not None:
opts = opts + ['--preinclude', config_header]
opts = opts + self.get_config_option(config_header)
return opts

@hook_tool
Expand Down
5 changes: 4 additions & 1 deletion tools/toolchains/gcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,14 @@ def get_dep_option(self, object):
dep_path = base + '.d'
return ["-MD", "-MF", dep_path]

def get_config_option(self, config_header):
return ['-include', config_header]

def get_compile_options(self, defines, includes):
opts = ['-D%s' % d for d in defines] + ['@%s' % self.get_inc_file(includes)]
config_header = self.get_config_header()
if config_header is not None:
opts = opts + ['-include', config_header]
opts = opts + self.get_config_option(config_header)
return opts

@hook_tool
Expand Down
5 changes: 4 additions & 1 deletion tools/toolchains/iar.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,14 @@ def cc_extra(self, object):
base, _ = splitext(object)
return ["-l", base + '.s.txt']

def get_config_option(self, config_header):
return ['--preinclude', config_header]

def get_compile_options(self, defines, includes):
opts = ['-D%s' % d for d in defines] + ['-f', self.get_inc_file(includes)]
config_header = self.get_config_header()
if config_header is not None:
opts = opts + ['--preinclude', config_header]
opts = opts + self.get_config_option(config_header)
return opts

@hook_tool
Expand Down