diff --git a/tools/export/__init__.py b/tools/export/__init__.py index d419077451..6bbf9e8f6e 100644 --- a/tools/export/__init__.py +++ b/tools/export/__init__.py @@ -16,7 +16,7 @@ # limitations under the License. from tools.export import codered, ds5_5, iar, makefile -from tools.export import emblocks, coide, kds, simplicityv3, atmelstudio +from tools.export import embitz, coide, kds, simplicityv3, atmelstudio from tools.export import sw4stm32, e2studio, zip, cmsis, uvision, cdt from tools.targets import TARGET_NAMES @@ -30,7 +30,7 @@ EXPORTERS = { 'make_iar': makefile.IAR, 'ds5_5': ds5_5.DS5_5, 'iar': iar.IAR, - 'emblocks' : emblocks.IntermediateFile, + 'embitz' : embitz.EmBitz, 'coide' : coide.CoIDE, 'kds' : kds.KDS, 'simplicityv3' : simplicityv3.SimplicityV3, diff --git a/tools/export/emblocks.py b/tools/export/embitz/__init__.py similarity index 70% rename from tools/export/emblocks.py rename to tools/export/embitz/__init__.py index 9e24199452..338b996f8b 100644 --- a/tools/export/emblocks.py +++ b/tools/export/embitz/__init__.py @@ -14,22 +14,16 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ -from exporters import Exporter from os.path import splitext, basename -from tools.targets import TARGETS +from tools.targets import TARGET_MAP +from tools.export.exporters import Exporter -# filter all the GCC_ARM targets out of the target list -gccTargets = [] -for t in TARGETS: - if 'GCC_ARM' in t.supported_toolchains: - gccTargets.append(t.name) - -class IntermediateFile(Exporter): - NAME = 'EmBlocks' +class EmBitz(Exporter): + NAME = 'EmBitz' TOOLCHAIN = 'GCC_ARM' - # we support all GCC targets (is handled on IDE side) - TARGETS = gccTargets + TARGETS = [target for target, obj in TARGET_MAP.iteritems() + if "GCC_ARM" in obj.supported_toolchains] MBED_CONFIG_HEADER_SUPPORTED = True @@ -41,10 +35,14 @@ class IntermediateFile(Exporter): } + @staticmethod + def _remove_symbols(sym_list): + return [s for s in sym_list if not s.startswith("-D")] + def generate(self): self.resources.win_to_unix() source_files = [] - for r_type, n in IntermediateFile.FILE_TYPES.iteritems(): + for r_type, n in self.FILE_TYPES.iteritems(): for file in getattr(self.resources, r_type): source_files.append({ 'name': file, 'type': n @@ -71,10 +69,11 @@ class IntermediateFile(Exporter): 'symbols': self.toolchain.get_symbols(), 'object_files': self.resources.objects, 'sys_libs': self.toolchain.sys_libs, - 'cc_org': self.flags['common_flags'] + self.flags['c_flags'], - 'ld_org': self.flags['common_flags'] + self.flags['ld_flags'], - 'cppc_org': self.flags['common_flags'] + self.flags['cxx_flags'] + 'cc_org': (self.flags['common_flags'] + + self._remove_symbols(self.flags['c_flags'])), + 'ld_org': self.flags['ld_flags'], + 'cppc_org': (self.flags['common_flags'] + + self._remove_symbols(self.flags['cxx_flags'])) } - # EmBlocks intermediate file template - self.gen_file('emblocks.eix.tmpl', ctx, '%s.eix' % self.project_name) + self.gen_file('embitz/eix.tmpl', ctx, '%s.eix' % self.project_name) diff --git a/tools/export/emblocks.eix.tmpl b/tools/export/embitz/eix.tmpl similarity index 100% rename from tools/export/emblocks.eix.tmpl rename to tools/export/embitz/eix.tmpl