Preliminary main mbed library for nexpaq development

Committer:
nexpaq
Date:
Fri Nov 04 20:54:50 2016 +0000
Revision:
1:d96dbedaebdb
Parent:
0:6c56fb4bc5f0
Removed extra directories for other platforms

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nexpaq 0:6c56fb4bc5f0 1 """The generic interface for all exporters.
nexpaq 0:6c56fb4bc5f0 2 """
nexpaq 0:6c56fb4bc5f0 3 # mbed SDK
nexpaq 0:6c56fb4bc5f0 4 # Copyright (c) 2011-2016 ARM Limited
nexpaq 0:6c56fb4bc5f0 5 #
nexpaq 0:6c56fb4bc5f0 6 # Licensed under the Apache License, Version 2.0 (the "License");
nexpaq 0:6c56fb4bc5f0 7 # you may not use this file except in compliance with the License.
nexpaq 0:6c56fb4bc5f0 8 # You may obtain a copy of the License at
nexpaq 0:6c56fb4bc5f0 9 #
nexpaq 0:6c56fb4bc5f0 10 # http://www.apache.org/licenses/LICENSE-2.0
nexpaq 0:6c56fb4bc5f0 11 #
nexpaq 0:6c56fb4bc5f0 12 # Unless required by applicable law or agreed to in writing, software
nexpaq 0:6c56fb4bc5f0 13 # distributed under the License is distributed on an "AS IS" BASIS,
nexpaq 0:6c56fb4bc5f0 14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
nexpaq 0:6c56fb4bc5f0 15 # See the License for the specific language governing permissions and
nexpaq 0:6c56fb4bc5f0 16 # limitations under the License.
nexpaq 0:6c56fb4bc5f0 17 import os, tempfile
nexpaq 0:6c56fb4bc5f0 18 from os.path import join, exists, basename
nexpaq 0:6c56fb4bc5f0 19 from shutil import copytree, rmtree, copy
nexpaq 0:6c56fb4bc5f0 20 import yaml
nexpaq 0:6c56fb4bc5f0 21
nexpaq 0:6c56fb4bc5f0 22 from tools.export import uvision4, uvision5, codered, gccarm, ds5_5, iar
nexpaq 0:6c56fb4bc5f0 23 from tools.export import emblocks, coide, kds, simplicityv3, atmelstudio
nexpaq 0:6c56fb4bc5f0 24 from tools.export import sw4stm32, e2studio, zip
nexpaq 0:6c56fb4bc5f0 25 from tools.export.exporters import OldLibrariesException, FailedBuildException
nexpaq 0:6c56fb4bc5f0 26 from tools.targets import TARGET_NAMES, EXPORT_MAP, TARGET_MAP
nexpaq 0:6c56fb4bc5f0 27
nexpaq 0:6c56fb4bc5f0 28 from project_generator_definitions.definitions import ProGenDef
nexpaq 0:6c56fb4bc5f0 29
nexpaq 0:6c56fb4bc5f0 30 EXPORTERS = {
nexpaq 0:6c56fb4bc5f0 31 'uvision': uvision4.Uvision4,
nexpaq 0:6c56fb4bc5f0 32 'uvision4': uvision4.Uvision4,
nexpaq 0:6c56fb4bc5f0 33 'uvision5': uvision5.Uvision5,
nexpaq 0:6c56fb4bc5f0 34 'lpcxpresso': codered.CodeRed,
nexpaq 0:6c56fb4bc5f0 35 'gcc_arm': gccarm.GccArm,
nexpaq 0:6c56fb4bc5f0 36 'ds5_5': ds5_5.DS5_5,
nexpaq 0:6c56fb4bc5f0 37 'iar': iar.IAREmbeddedWorkbench,
nexpaq 0:6c56fb4bc5f0 38 'emblocks' : emblocks.IntermediateFile,
nexpaq 0:6c56fb4bc5f0 39 'coide' : coide.CoIDE,
nexpaq 0:6c56fb4bc5f0 40 'kds' : kds.KDS,
nexpaq 0:6c56fb4bc5f0 41 'simplicityv3' : simplicityv3.SimplicityV3,
nexpaq 0:6c56fb4bc5f0 42 'atmelstudio' : atmelstudio.AtmelStudio,
nexpaq 0:6c56fb4bc5f0 43 'sw4stm32' : sw4stm32.Sw4STM32,
nexpaq 0:6c56fb4bc5f0 44 'e2studio' : e2studio.E2Studio,
nexpaq 0:6c56fb4bc5f0 45 'zip' : zip.ZIP,
nexpaq 0:6c56fb4bc5f0 46 }
nexpaq 0:6c56fb4bc5f0 47
nexpaq 0:6c56fb4bc5f0 48 ERROR_MESSAGE_UNSUPPORTED_TOOLCHAIN = """
nexpaq 0:6c56fb4bc5f0 49 Sorry, the target %s is not currently supported on the %s toolchain.
nexpaq 0:6c56fb4bc5f0 50 Please refer to <a href='/handbook/Exporting-to-offline-toolchains' target='_blank'>Exporting to offline toolchains</a> for more information.
nexpaq 0:6c56fb4bc5f0 51 """
nexpaq 0:6c56fb4bc5f0 52
nexpaq 0:6c56fb4bc5f0 53 ERROR_MESSAGE_NOT_EXPORT_LIBS = """
nexpaq 0:6c56fb4bc5f0 54 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>.
nexpaq 0:6c56fb4bc5f0 55 """
nexpaq 0:6c56fb4bc5f0 56
nexpaq 0:6c56fb4bc5f0 57 def mcu_ide_matrix(verbose_html=False):
nexpaq 0:6c56fb4bc5f0 58 """Shows target map using prettytable
nexpaq 0:6c56fb4bc5f0 59
nexpaq 0:6c56fb4bc5f0 60 Keyword argumets:
nexpaq 0:6c56fb4bc5f0 61 verbose_html - print the matrix in html format
nexpaq 0:6c56fb4bc5f0 62 """
nexpaq 0:6c56fb4bc5f0 63 supported_ides = sorted(EXPORTERS.keys())
nexpaq 0:6c56fb4bc5f0 64 # Only use it in this function so building works without extra modules
nexpaq 0:6c56fb4bc5f0 65 from prettytable import PrettyTable, ALL
nexpaq 0:6c56fb4bc5f0 66
nexpaq 0:6c56fb4bc5f0 67 # All tests status table print
nexpaq 0:6c56fb4bc5f0 68 table_printer = PrettyTable(["Platform"] + supported_ides)
nexpaq 0:6c56fb4bc5f0 69 # Align table
nexpaq 0:6c56fb4bc5f0 70 for col in supported_ides:
nexpaq 0:6c56fb4bc5f0 71 table_printer.align[col] = "c"
nexpaq 0:6c56fb4bc5f0 72 table_printer.align["Platform"] = "l"
nexpaq 0:6c56fb4bc5f0 73
nexpaq 0:6c56fb4bc5f0 74 perm_counter = 0
nexpaq 0:6c56fb4bc5f0 75 for target in sorted(TARGET_NAMES):
nexpaq 0:6c56fb4bc5f0 76 row = [target] # First column is platform name
nexpaq 0:6c56fb4bc5f0 77 for ide in supported_ides:
nexpaq 0:6c56fb4bc5f0 78 text = "-"
nexpaq 0:6c56fb4bc5f0 79 if target in EXPORTERS[ide].TARGETS:
nexpaq 0:6c56fb4bc5f0 80 if verbose_html:
nexpaq 0:6c56fb4bc5f0 81 text = "&#10003;"
nexpaq 0:6c56fb4bc5f0 82 else:
nexpaq 0:6c56fb4bc5f0 83 text = "x"
nexpaq 0:6c56fb4bc5f0 84 perm_counter += 1
nexpaq 0:6c56fb4bc5f0 85 row.append(text)
nexpaq 0:6c56fb4bc5f0 86 table_printer.add_row(row)
nexpaq 0:6c56fb4bc5f0 87
nexpaq 0:6c56fb4bc5f0 88 table_printer.border = True
nexpaq 0:6c56fb4bc5f0 89 table_printer.vrules = ALL
nexpaq 0:6c56fb4bc5f0 90 table_printer.hrules = ALL
nexpaq 0:6c56fb4bc5f0 91 # creates a html page in a shorter format suitable for readme.md
nexpaq 0:6c56fb4bc5f0 92 if verbose_html:
nexpaq 0:6c56fb4bc5f0 93 result = table_printer.get_html_string()
nexpaq 0:6c56fb4bc5f0 94 else:
nexpaq 0:6c56fb4bc5f0 95 result = table_printer.get_string()
nexpaq 0:6c56fb4bc5f0 96 result += "\n"
nexpaq 0:6c56fb4bc5f0 97 result += "Total IDEs: %d\n"% (len(supported_ides))
nexpaq 0:6c56fb4bc5f0 98 if verbose_html:
nexpaq 0:6c56fb4bc5f0 99 result += "<br>"
nexpaq 0:6c56fb4bc5f0 100 result += "Total platforms: %d\n"% (len(TARGET_NAMES))
nexpaq 0:6c56fb4bc5f0 101 if verbose_html:
nexpaq 0:6c56fb4bc5f0 102 result += "<br>"
nexpaq 0:6c56fb4bc5f0 103 result += "Total permutations: %d"% (perm_counter)
nexpaq 0:6c56fb4bc5f0 104 if verbose_html:
nexpaq 0:6c56fb4bc5f0 105 result = result.replace("&amp;", "&")
nexpaq 0:6c56fb4bc5f0 106 return result