2016-07-20 19:43:09 +00:00
|
|
|
"""The generic interface for all exporters.
|
2013-08-06 13:38:00 +00:00
|
|
|
"""
|
2016-07-20 19:43:09 +00:00
|
|
|
# mbed SDK
|
2016-07-26 20:30:59 +00:00
|
|
|
# Copyright (c) 2011-2016 ARM Limited
|
2016-07-20 19:43:09 +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.
|
2013-02-18 15:32:11 +00:00
|
|
|
import os, tempfile
|
2013-08-16 15:39:30 +00:00
|
|
|
from os.path import join, exists, basename
|
2015-02-13 20:02:04 +00:00
|
|
|
from shutil import copytree, rmtree, copy
|
2016-04-05 08:59:45 +00:00
|
|
|
import yaml
|
2013-02-18 15:32:11 +00:00
|
|
|
|
2016-08-22 16:23:58 +00:00
|
|
|
from tools.export import uvision4, uvision5, codered, makefile, ds5_5, iar
|
2016-07-20 19:43:09 +00:00
|
|
|
from tools.export import emblocks, coide, kds, simplicityv3, atmelstudio
|
2016-09-27 21:08:17 +00:00
|
|
|
from tools.export import sw4stm32, e2studio, zip, eclipse
|
2016-07-20 19:43:09 +00:00
|
|
|
from tools.export.exporters import OldLibrariesException, FailedBuildException
|
2016-06-09 20:34:53 +00:00
|
|
|
from tools.targets import TARGET_NAMES, EXPORT_MAP, TARGET_MAP
|
2013-02-18 15:32:11 +00:00
|
|
|
|
2015-11-30 19:48:24 +00:00
|
|
|
from project_generator_definitions.definitions import ProGenDef
|
|
|
|
|
2013-02-18 15:32:11 +00:00
|
|
|
EXPORTERS = {
|
2016-09-03 08:44:15 +00:00
|
|
|
'uvision': uvision5.Uvision5,
|
|
|
|
'uvision4': uvision4.Uvision4, # deprecated - to be removed in future version
|
2016-04-19 14:46:19 +00:00
|
|
|
'uvision5': uvision5.Uvision5,
|
2014-04-01 15:23:19 +00:00
|
|
|
'lpcxpresso': codered.CodeRed,
|
2016-08-22 22:30:38 +00:00
|
|
|
'gcc_arm': makefile.GccArm,
|
|
|
|
'make_gcc_arm': makefile.GccArm,
|
|
|
|
'make_armc5': makefile.Armc5,
|
|
|
|
'make_iar': makefile.IAR,
|
2013-02-18 15:32:11 +00:00
|
|
|
'ds5_5': ds5_5.DS5_5,
|
2014-01-12 08:03:46 +00:00
|
|
|
'iar': iar.IAREmbeddedWorkbench,
|
2014-10-06 13:25:59 +00:00
|
|
|
'emblocks' : emblocks.IntermediateFile,
|
2014-06-11 15:30:43 +00:00
|
|
|
'coide' : coide.CoIDE,
|
|
|
|
'kds' : kds.KDS,
|
2015-04-27 18:11:02 +00:00
|
|
|
'simplicityv3' : simplicityv3.SimplicityV3,
|
2015-11-25 09:32:20 +00:00
|
|
|
'atmelstudio' : atmelstudio.AtmelStudio,
|
2016-01-20 13:24:32 +00:00
|
|
|
'sw4stm32' : sw4stm32.Sw4STM32,
|
2016-04-12 08:52:14 +00:00
|
|
|
'e2studio' : e2studio.E2Studio,
|
2016-09-27 21:08:17 +00:00
|
|
|
'zip' : zip.ZIP
|
2013-02-18 15:32:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ERROR_MESSAGE_UNSUPPORTED_TOOLCHAIN = """
|
|
|
|
Sorry, the target %s is not currently supported on the %s toolchain.
|
|
|
|
Please refer to <a href='/handbook/Exporting-to-offline-toolchains' target='_blank'>Exporting to offline toolchains</a> for more information.
|
|
|
|
"""
|
|
|
|
|
|
|
|
ERROR_MESSAGE_NOT_EXPORT_LIBS = """
|
|
|
|
To export this project please <a href='http://mbed.org/compiler/?import=http://mbed.org/users/mbed_official/code/mbed-export/k&mode=lib' target='_blank'>import the export version of the mbed library</a>.
|
|
|
|
"""
|
|
|
|
|
2016-07-20 19:43:09 +00:00
|
|
|
def mcu_ide_matrix(verbose_html=False):
|
|
|
|
"""Shows target map using prettytable
|
2014-01-12 08:03:46 +00:00
|
|
|
|
2016-07-20 19:43:09 +00:00
|
|
|
Keyword argumets:
|
|
|
|
verbose_html - print the matrix in html format
|
2013-08-16 15:39:30 +00:00
|
|
|
"""
|
2016-07-20 19:43:09 +00:00
|
|
|
supported_ides = sorted(EXPORTERS.keys())
|
|
|
|
# Only use it in this function so building works without extra modules
|
|
|
|
from prettytable import PrettyTable, ALL
|
2014-12-30 18:26:43 +00:00
|
|
|
|
|
|
|
# All tests status table print
|
2016-07-20 19:43:09 +00:00
|
|
|
table_printer = PrettyTable(["Platform"] + supported_ides)
|
2014-12-30 18:26:43 +00:00
|
|
|
# Align table
|
2016-07-20 19:43:09 +00:00
|
|
|
for col in supported_ides:
|
|
|
|
table_printer.align[col] = "c"
|
|
|
|
table_printer.align["Platform"] = "l"
|
2014-12-30 18:26:43 +00:00
|
|
|
|
|
|
|
perm_counter = 0
|
|
|
|
for target in sorted(TARGET_NAMES):
|
|
|
|
row = [target] # First column is platform name
|
|
|
|
for ide in supported_ides:
|
|
|
|
text = "-"
|
|
|
|
if target in EXPORTERS[ide].TARGETS:
|
2016-01-20 13:24:32 +00:00
|
|
|
if verbose_html:
|
|
|
|
text = "✓"
|
|
|
|
else:
|
2014-12-30 18:26:43 +00:00
|
|
|
text = "x"
|
|
|
|
perm_counter += 1
|
|
|
|
row.append(text)
|
2016-07-20 19:43:09 +00:00
|
|
|
table_printer.add_row(row)
|
2014-12-30 18:26:43 +00:00
|
|
|
|
2016-07-20 19:43:09 +00:00
|
|
|
table_printer.border = True
|
|
|
|
table_printer.vrules = ALL
|
|
|
|
table_printer.hrules = ALL
|
2014-12-30 18:26:43 +00:00
|
|
|
# creates a html page in a shorter format suitable for readme.md
|
2016-07-20 19:43:09 +00:00
|
|
|
if verbose_html:
|
|
|
|
result = table_printer.get_html_string()
|
|
|
|
else:
|
|
|
|
result = table_printer.get_string()
|
2014-12-30 18:26:43 +00:00
|
|
|
result += "\n"
|
|
|
|
result += "Total IDEs: %d\n"% (len(supported_ides))
|
2016-07-20 19:43:09 +00:00
|
|
|
if verbose_html:
|
|
|
|
result += "<br>"
|
|
|
|
result += "Total platforms: %d\n"% (len(TARGET_NAMES))
|
|
|
|
if verbose_html:
|
|
|
|
result += "<br>"
|
2014-12-30 18:26:43 +00:00
|
|
|
result += "Total permutations: %d"% (perm_counter)
|
2016-07-20 19:43:09 +00:00
|
|
|
if verbose_html:
|
|
|
|
result = result.replace("&", "&")
|
2014-12-30 18:26:43 +00:00
|
|
|
return result
|