1414See the License for the specific language governing permissions and
1515limitations under the License.
1616"""
17- from exporters import Exporter
1817from os .path import splitext , basename
19- from tools .targets import TARGETS
18+ from tools .targets import TARGET_MAP
19+ from tools .export .exporters import Exporter
2020
21- # filter all the GCC_ARM targets out of the target list
22- gccTargets = []
23- for t in TARGETS :
24- if 'GCC_ARM' in t .supported_toolchains :
25- gccTargets .append (t .name )
26-
27- class IntermediateFile (Exporter ):
28- NAME = 'EmBlocks'
21+ class EmBitz (Exporter ):
22+ NAME = 'EmBitz'
2923 TOOLCHAIN = 'GCC_ARM'
3024
31- # we support all GCC targets (is handled on IDE side )
32- TARGETS = gccTargets
25+ TARGETS = [ target for target , obj in TARGET_MAP . iteritems ( )
26+ if "GCC_ARM" in obj . supported_toolchains ]
3327
3428 MBED_CONFIG_HEADER_SUPPORTED = True
3529
@@ -41,10 +35,14 @@ class IntermediateFile(Exporter):
4135 }
4236
4337
38+ @staticmethod
39+ def _remove_symbols (sym_list ):
40+ return [s for s in sym_list if not s .startswith ("-D" )]
41+
4442 def generate (self ):
4543 self .resources .win_to_unix ()
4644 source_files = []
47- for r_type , n in IntermediateFile .FILE_TYPES .iteritems ():
45+ for r_type , n in self .FILE_TYPES .iteritems ():
4846 for file in getattr (self .resources , r_type ):
4947 source_files .append ({
5048 'name' : file , 'type' : n
@@ -71,10 +69,11 @@ def generate(self):
7169 'symbols' : self .toolchain .get_symbols (),
7270 'object_files' : self .resources .objects ,
7371 'sys_libs' : self .toolchain .sys_libs ,
74- 'cc_org' : self .flags ['common_flags' ] + self .flags ['c_flags' ],
75- 'ld_org' : self .flags ['common_flags' ] + self .flags ['ld_flags' ],
76- 'cppc_org' : self .flags ['common_flags' ] + self .flags ['cxx_flags' ]
72+ 'cc_org' : (self .flags ['common_flags' ] +
73+ self ._remove_symbols (self .flags ['c_flags' ])),
74+ 'ld_org' : self .flags ['ld_flags' ],
75+ 'cppc_org' : (self .flags ['common_flags' ] +
76+ self ._remove_symbols (self .flags ['cxx_flags' ]))
7777 }
7878
79- # EmBlocks intermediate file template
80- self .gen_file ('emblocks.eix.tmpl' , ctx , '%s.eix' % self .project_name )
79+ self .gen_file ('embitz/eix.tmpl' , ctx , '%s.eix' % self .project_name )
0 commit comments