diff --git a/tools/toolchains/arm.py b/tools/toolchains/arm.py index 6d8afbfb1a..5aa7ae5124 100644 --- a/tools/toolchains/arm.py +++ b/tools/toolchains/arm.py @@ -114,11 +114,14 @@ class ARM(mbedToolchain): 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 diff --git a/tools/toolchains/gcc.py b/tools/toolchains/gcc.py index e41f9dbb9c..72a1ea9863 100644 --- a/tools/toolchains/gcc.py +++ b/tools/toolchains/gcc.py @@ -165,11 +165,14 @@ class GCC(mbedToolchain): 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_conifg_option(config_header) return opts @hook_tool diff --git a/tools/toolchains/iar.py b/tools/toolchains/iar.py index 605a13350b..a5538b1a01 100644 --- a/tools/toolchains/iar.py +++ b/tools/toolchains/iar.py @@ -126,8 +126,12 @@ class IAR(mbedToolchain): 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, for_asm=False): - opts = ['-D%s' % d for d in defines] + ['-f', self.get_inc_file(includes)] + opts = ['-f', self.get_inc_file(includes)] + config_header = self.get_config_header() if for_asm: # The assembler doesn't support '--preinclude', so we need to add # the macros directly @@ -135,7 +139,7 @@ class IAR(mbedToolchain): else: 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