2014-01-12 08:03:46 +00:00
|
|
|
"""
|
|
|
|
mbed SDK
|
2016-07-26 20:30:59 +00:00
|
|
|
Copyright (c) 2014-2016 ARM Limited
|
2014-01-12 08:03:46 +00:00
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
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 os.path import splitext, basename
|
2018-02-21 15:43:19 +00:00
|
|
|
from os import remove
|
2014-01-12 08:03:46 +00:00
|
|
|
|
2017-07-11 16:15:31 +00:00
|
|
|
from tools.export.exporters import Exporter, deprecated_exporter
|
2017-01-17 18:12:24 +00:00
|
|
|
|
2014-01-12 08:03:46 +00:00
|
|
|
|
2017-07-11 16:15:31 +00:00
|
|
|
@deprecated_exporter
|
2014-01-12 08:03:46 +00:00
|
|
|
class CoIDE(Exporter):
|
|
|
|
NAME = 'CoIDE'
|
2014-03-18 10:52:34 +00:00
|
|
|
TOOLCHAIN = 'GCC_ARM'
|
2014-05-29 13:42:03 +00:00
|
|
|
|
2014-03-18 10:52:34 +00:00
|
|
|
TARGETS = [
|
|
|
|
'KL25Z',
|
|
|
|
'KL05Z',
|
2014-09-24 19:11:36 +00:00
|
|
|
'LPC1768',
|
|
|
|
'ARCH_PRO',
|
2015-03-20 00:32:51 +00:00
|
|
|
'ARCH_MAX',
|
2014-12-08 10:14:27 +00:00
|
|
|
'UBLOX_C027',
|
2014-12-31 15:08:01 +00:00
|
|
|
'NUCLEO_L053R8',
|
2014-11-16 16:10:47 +00:00
|
|
|
'NUCLEO_L152RE',
|
2014-11-22 11:18:31 +00:00
|
|
|
'NUCLEO_F030R8',
|
2015-10-01 12:03:52 +00:00
|
|
|
'NUCLEO_F042K6',
|
2015-03-21 19:22:09 +00:00
|
|
|
'NUCLEO_F070RB',
|
2014-11-22 13:56:30 +00:00
|
|
|
'NUCLEO_F072RB',
|
2014-12-30 23:55:07 +00:00
|
|
|
'NUCLEO_F091RC',
|
2014-12-31 15:34:20 +00:00
|
|
|
'NUCLEO_F103RB',
|
2014-11-16 17:24:57 +00:00
|
|
|
'NUCLEO_F302R8',
|
2015-10-12 09:34:06 +00:00
|
|
|
'NUCLEO_F303K8',
|
2015-03-17 01:13:23 +00:00
|
|
|
'NUCLEO_F303RE',
|
2014-10-03 23:55:52 +00:00
|
|
|
'NUCLEO_F334R8',
|
2014-09-19 19:12:17 +00:00
|
|
|
'NUCLEO_F401RE',
|
2015-10-27 12:50:52 +00:00
|
|
|
'NUCLEO_F410RB',
|
2014-10-05 21:05:16 +00:00
|
|
|
'NUCLEO_F411RE',
|
2015-04-26 00:28:24 +00:00
|
|
|
'NUCLEO_F446RE',
|
2014-12-31 15:08:01 +00:00
|
|
|
'DISCO_L053C8',
|
2014-12-31 16:46:32 +00:00
|
|
|
'DISCO_F051R8',
|
2014-12-31 16:17:50 +00:00
|
|
|
'DISCO_F100RB',
|
2014-11-14 08:56:20 +00:00
|
|
|
'DISCO_F303VC',
|
2014-12-30 23:55:07 +00:00
|
|
|
'DISCO_F334C8',
|
2015-01-01 20:12:11 +00:00
|
|
|
'DISCO_F401VC',
|
2014-12-30 23:55:07 +00:00
|
|
|
'DISCO_F407VG',
|
|
|
|
'DISCO_F429ZI',
|
2014-11-12 22:21:13 +00:00
|
|
|
'MTS_MDOT_F405RG',
|
2014-12-05 23:34:38 +00:00
|
|
|
'MTS_MDOT_F411RE',
|
2015-04-23 07:55:29 +00:00
|
|
|
'MOTE_L152RC',
|
2016-02-15 01:50:09 +00:00
|
|
|
'NZ32_SC151',
|
2014-03-18 10:52:34 +00:00
|
|
|
]
|
2014-05-29 13:42:03 +00:00
|
|
|
|
2014-01-12 10:34:35 +00:00
|
|
|
# seems like CoIDE currently supports only one type
|
2014-01-12 10:17:21 +00:00
|
|
|
FILE_TYPES = {
|
|
|
|
'c_sources':'1',
|
2014-01-12 10:34:35 +00:00
|
|
|
'cpp_sources':'1',
|
|
|
|
's_sources':'1'
|
2014-01-12 10:17:21 +00:00
|
|
|
}
|
2014-09-19 19:12:17 +00:00
|
|
|
FILE_TYPES2 = {
|
|
|
|
'headers':'1'
|
|
|
|
}
|
2014-01-12 08:03:46 +00:00
|
|
|
|
|
|
|
def generate(self):
|
2014-01-12 10:17:21 +00:00
|
|
|
self.resources.win_to_unix()
|
|
|
|
source_files = []
|
2018-01-12 21:46:44 +00:00
|
|
|
for r_type, n in CoIDE.FILE_TYPES.items():
|
2014-01-12 10:17:21 +00:00
|
|
|
for file in getattr(self.resources, r_type):
|
|
|
|
source_files.append({
|
2014-01-12 10:34:35 +00:00
|
|
|
'name': basename(file), 'type': n, 'path': file
|
2014-01-12 10:17:21 +00:00
|
|
|
})
|
2014-09-19 19:12:17 +00:00
|
|
|
header_files = []
|
2018-01-12 21:46:44 +00:00
|
|
|
for r_type, n in CoIDE.FILE_TYPES2.items():
|
2014-09-19 19:12:17 +00:00
|
|
|
for file in getattr(self.resources, r_type):
|
|
|
|
header_files.append({
|
|
|
|
'name': basename(file), 'type': n, 'path': file
|
|
|
|
})
|
2014-01-12 08:03:46 +00:00
|
|
|
|
|
|
|
libraries = []
|
|
|
|
for lib in self.resources.libraries:
|
|
|
|
l, _ = splitext(basename(lib))
|
|
|
|
libraries.append(l[3:])
|
|
|
|
|
2014-09-28 12:40:50 +00:00
|
|
|
if self.resources.linker_script is None:
|
|
|
|
self.resources.linker_script = ''
|
|
|
|
|
2014-01-12 08:03:46 +00:00
|
|
|
ctx = {
|
2016-07-20 19:43:09 +00:00
|
|
|
'name': self.project_name,
|
2014-01-12 10:17:21 +00:00
|
|
|
'source_files': source_files,
|
2014-09-19 19:12:17 +00:00
|
|
|
'header_files': header_files,
|
2014-01-12 08:03:46 +00:00
|
|
|
'include_paths': self.resources.inc_dirs,
|
|
|
|
'scatter_file': self.resources.linker_script,
|
2014-01-27 18:18:48 +00:00
|
|
|
'library_paths': self.resources.lib_dirs,
|
2014-01-12 08:03:46 +00:00
|
|
|
'object_files': self.resources.objects,
|
2014-01-12 10:17:21 +00:00
|
|
|
'libraries': libraries,
|
2016-08-08 20:01:24 +00:00
|
|
|
'symbols': self.toolchain.get_symbols()
|
2014-01-12 08:03:46 +00:00
|
|
|
}
|
|
|
|
target = self.target.lower()
|
|
|
|
|
|
|
|
# Project file
|
2017-01-17 18:12:24 +00:00
|
|
|
self.gen_file('coide/%s.coproj.tmpl' % target, ctx, '%s.coproj' % self.project_name)
|
2018-02-21 15:43:19 +00:00
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def clean(project_name):
|
|
|
|
remove('%s.coproj' % project_name)
|