EmBlocks EIX plugin support

pull/521/head
EmBlocks 2014-09-30 16:27:09 +02:00
parent dadf009f87
commit e57f488b53
4 changed files with 132 additions and 1 deletions

View File

@ -20,7 +20,7 @@ from os import makedirs
from shutil import copytree, rmtree
from workspace_tools.utils import mkdir
from workspace_tools.export import uvision4, codesourcery, codered, gccarm, ds5_5, iar, coide, kds
from workspace_tools.export import uvision4, codesourcery, codered, gccarm, ds5_5, iar, emblocks, coide, kds
from workspace_tools.export.exporters import zip_working_directory_and_clean_up, OldLibrariesException
from workspace_tools.targets import EXPORT_MAP
@ -31,6 +31,7 @@ EXPORTERS = {
'gcc_arm': gccarm.GccArm,
'ds5_5': ds5_5.DS5_5,
'iar': iar.IAREmbeddedWorkbench,
'emblocks' : emblocks.IntermediateFile,
'coide' : coide.CoIDE,
'kds' : kds.KDS,
}

View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Project emblocks_ix="1.0.0" name="{{name}}">
<Target name="{{name}}" target="{{target}}">
<Source name="mbed.org" version="1.0.0">
<Toolchain name="{{toolchain}}"/>
<CC>
{% for s in cc_org %}<Switch name="{{s}}"/>
{% endfor %}
</CC>
<CPPC>
{% for s in cppc_org %}<Switch name="{{s}}"/>
{% endfor %}
</CPPC>
<Symbols>
{% for s in symbols %}<Symbol name="{{s}}"/>
{% endfor %}
</Symbols>
<LD>
{% for s in ld_org %}<Switch name="{{s}}"/>
{% endfor %}
</LD>
<Addobjects>
{% for s in object_files %}<Addobject name="{{s}}"/>
{% endfor %}
</Addobjects>
<Syslibs>
{% for s in sys_libs %}<Library name="{{s}}"/>
{% endfor %}
</Syslibs>
<Scriptfile path="{{script_file}}"/>
</Source>
<Assembler>
</Assembler>
<Compiler>
<Includepaths>
{% for s in include_paths %}<Includepath path="{{s}}"/>
{% endfor %}
</Includepaths>
<Symbols>
</Symbols>
</Compiler>
<Linker>
<Libraries>
{% for s in libraries %}<Library name="{{s}}"/>
{% endfor %}
</Libraries>
<Librarypaths>
{% for s in library_paths %}<Librarypath path="{{s}}"/>
{% endfor %}
</Librarypaths>
</Linker>
<Files>
{% for f in source_files %}<File name="{{f.name}}" type="{{f.type}}"/>
{% endfor %}
</Files>
</Target>
</Project>

View File

@ -0,0 +1,57 @@
from exporters import Exporter
from os.path import splitext, basename
from workspace_tools.targets import TARGET_NAMES
class IntermediateFile(Exporter):
NAME = 'EmBlocks'
TOOLCHAIN = 'GCC_ARM'
# we support all targets (is handled on IDE side)
TARGETS = TARGET_NAMES
FILE_TYPES = {
'headers': 'h',
'c_sources': 'c',
's_sources': 'a',
'cpp_sources': 'cpp'
}
def generate(self):
self.resources.win_to_unix()
source_files = []
for r_type, n in IntermediateFile.FILE_TYPES.iteritems():
for file in getattr(self.resources, r_type):
source_files.append({
'name': file, 'type': n
})
libraries = []
for lib in self.resources.libraries:
l, _ = splitext(basename(lib))
libraries.append(l[3:])
if self.resources.linker_script is None:
self.resources.linker_script = ''
ctx = {
'name': self.program_name,
'target': self.target,
'toolchain': self.toolchain.name,
'source_files': source_files,
'include_paths': self.resources.inc_dirs,
'script_file': self.resources.linker_script,
'library_paths': self.resources.lib_dirs,
'libraries': libraries,
'symbols': self.toolchain.get_symbols(),
'object_files': self.resources.objects,
'sys_libs': self.toolchain.sys_libs,
'cc_org': self.toolchain.cc[1:],
'ld_org': self.toolchain.ld[1:],
'cppc_org': self.toolchain.cppc[1:]
}
# EmBlocks intermediate file template
self.gen_file('emblocks.eix.tmpl', ctx, '%s.eix' % self.program_name)

View File

@ -76,6 +76,22 @@ if __name__ == '__main__':
setup_test_user_prj()
for toolchain, target in [
('emblocks', 'LPC1768'),
('emblocks', 'LPC1549'),
('emblocks', 'LPC1114'),
('emblocks', 'LPC11U35_401'),
('emblocks', 'LPC11U35_501'),
('emblocks', 'LPCCAPPUCCINO'),
('emblocks', 'LPC2368'),
('emblocks', 'STM32F407'),
('emblocks', 'DISCO_F100RB'),
('emblocks', 'DISCO_F051R8'),
('emblocks', 'DISCO_F407VG'),
('emblocks', 'DISCO_F303VC'),
('emblocks', 'NRF51822'),
('emblocks', 'NUCLEO_F401RE'),
('emblocks', 'NUCLEO_F411RE'),
('coide', 'KL05Z'),
('coide', 'KL25Z'),
('coide', 'LPC1768'),