Daiki Kato / mbed-os-lychee

Dependents:   mbed-os-example-blinky-gr-lychee GR-Boads_Camera_sample GR-Boards_Audio_Recoder GR-Boads_Camera_DisplayApp ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers __init__.py Source File

__init__.py

00001 """The generic interface for all exporters.
00002 """
00003 # mbed SDK
00004 # Copyright (c) 2011-2016 ARM Limited
00005 #
00006 # Licensed under the Apache License, Version 2.0 (the "License");
00007 # you may not use this file except in compliance with the License.
00008 # You may obtain a copy of the License at
00009 #
00010 #     http://www.apache.org/licenses/LICENSE-2.0
00011 #
00012 # Unless required by applicable law or agreed to in writing, software
00013 # distributed under the License is distributed on an "AS IS" BASIS,
00014 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015 # See the License for the specific language governing permissions and
00016 # limitations under the License.
00017 
00018 from tools.export import lpcxpresso, ds5_5, iar, makefile
00019 from tools.export import embitz, coide, kds, simplicity, atmelstudio
00020 from tools.export import sw4stm32, e2studio, zip, cmsis, uvision, cdt
00021 from tools.export import gnuarmeclipse
00022 from tools.targets import TARGET_NAMES
00023 
00024 EXPORTERS = {
00025     'uvision5': uvision.Uvision,
00026     'uvision': uvision.Uvision,
00027     'lpcxpresso': lpcxpresso.LPCXpresso,
00028     'gcc_arm': makefile.GccArm,
00029     'make_gcc_arm': makefile.GccArm,
00030     'make_armc5': makefile.Armc5,
00031     'make_iar': makefile.IAR,
00032     'ds5_5': ds5_5.DS5_5,
00033     'iar': iar.IAR,
00034     'embitz' : embitz.EmBitz,
00035     'coide' : coide.CoIDE,
00036     'kds' : kds.KDS,
00037     'simplicityv3' : simplicity.SimplicityV3,
00038     'atmelstudio' : atmelstudio.AtmelStudio,
00039     'sw4stm32'    : sw4stm32.Sw4STM32,
00040     'e2studio' : e2studio.E2Studio,
00041     'eclipse_gcc_arm'  : cdt.EclipseGcc,
00042     'eclipse_iar'      : cdt.EclipseIAR,
00043     'eclipse_armc5'    : cdt.EclipseArmc5,
00044     'gnuarmeclipse': gnuarmeclipse.GNUARMEclipse,
00045     'zip' : zip.ZIP,
00046     'cmsis'    : cmsis.CMSIS
00047 }
00048 
00049 ERROR_MESSAGE_UNSUPPORTED_TOOLCHAIN = """
00050 Sorry, the target %s is not currently supported on the %s toolchain.
00051 Please refer to <a href='/handbook/Exporting-to-offline-toolchains' target='_blank'>Exporting to offline toolchains</a> for more information.
00052 """
00053 
00054 ERROR_MESSAGE_NOT_EXPORT_LIBS = """
00055 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>.
00056 """
00057 
00058 def mcu_ide_matrix (verbose_html=False):
00059     """Shows target map using prettytable
00060 
00061     Keyword argumets:
00062     verbose_html - print the matrix in html format
00063     """
00064     supported_ides = sorted(EXPORTERS.keys())
00065     # Only use it in this function so building works without extra modules
00066     from prettytable import PrettyTable, ALL
00067 
00068     # All tests status table print
00069     table_printer = PrettyTable(["Platform"] + supported_ides)
00070     # Align table
00071     for col in supported_ides:
00072         table_printer.align[col] = "c"
00073     table_printer.align["Platform"] = "l"
00074 
00075     perm_counter = 0
00076     for target in sorted(TARGET_NAMES):
00077         row = [target]  # First column is platform name
00078         for ide in supported_ides:
00079             text = "-"
00080             if target in EXPORTERS[ide].TARGETS:
00081                 if verbose_html:
00082                     text = "&#10003;"
00083                 else:
00084                     text = "x"
00085                 perm_counter += 1
00086             row.append(text)
00087         table_printer.add_row(row)
00088 
00089     table_printer.border = True
00090     table_printer.vrules = ALL
00091     table_printer.hrules = ALL
00092     # creates a html page in a shorter format suitable for readme.md
00093     if verbose_html:
00094         result = table_printer.get_html_string()
00095     else:
00096         result = table_printer.get_string()
00097     result += "\n"
00098     result += "Total IDEs: %d\n"% (len(supported_ides))
00099     if verbose_html:
00100         result += "<br>"
00101     result += "Total platforms: %d\n"% (len(TARGET_NAMES))
00102     if verbose_html:
00103         result += "<br>"
00104     result += "Total permutations: %d"% (perm_counter)
00105     if verbose_html:
00106         result = result.replace("&amp;", "&")
00107     return result