mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #3993 from mbartling/supported-lists
Added list options for --supported commandpull/4184/head
commit
65adf446c5
|
@ -1100,6 +1100,75 @@ def get_unique_supported_toolchains(release_targets=None):
|
|||
|
||||
return unique_supported_toolchains
|
||||
|
||||
def mcu_toolchain_list(release_version='5'):
|
||||
""" Shows list of toolchains
|
||||
|
||||
"""
|
||||
|
||||
if isinstance(release_version, basestring):
|
||||
# Force release_version to lowercase if it is a string
|
||||
release_version = release_version.lower()
|
||||
else:
|
||||
# Otherwise default to printing all known targets and toolchains
|
||||
release_version = 'all'
|
||||
|
||||
|
||||
version_release_targets = {}
|
||||
version_release_target_names = {}
|
||||
|
||||
for version in RELEASE_VERSIONS:
|
||||
version_release_targets[version] = get_mbed_official_release(version)
|
||||
version_release_target_names[version] = [x[0] for x in
|
||||
version_release_targets[
|
||||
version]]
|
||||
|
||||
if release_version in RELEASE_VERSIONS:
|
||||
release_targets = version_release_targets[release_version]
|
||||
else:
|
||||
release_targets = None
|
||||
|
||||
unique_supported_toolchains = get_unique_supported_toolchains(
|
||||
release_targets)
|
||||
columns = ["mbed OS %s" % x for x in RELEASE_VERSIONS] + unique_supported_toolchains
|
||||
return "\n".join(columns)
|
||||
|
||||
|
||||
def mcu_target_list(release_version='5'):
|
||||
""" Shows target list
|
||||
|
||||
"""
|
||||
|
||||
if isinstance(release_version, basestring):
|
||||
# Force release_version to lowercase if it is a string
|
||||
release_version = release_version.lower()
|
||||
else:
|
||||
# Otherwise default to printing all known targets and toolchains
|
||||
release_version = 'all'
|
||||
|
||||
|
||||
version_release_targets = {}
|
||||
version_release_target_names = {}
|
||||
|
||||
for version in RELEASE_VERSIONS:
|
||||
version_release_targets[version] = get_mbed_official_release(version)
|
||||
version_release_target_names[version] = [x[0] for x in
|
||||
version_release_targets[
|
||||
version]]
|
||||
|
||||
if release_version in RELEASE_VERSIONS:
|
||||
release_targets = version_release_targets[release_version]
|
||||
else:
|
||||
release_targets = None
|
||||
|
||||
target_names = []
|
||||
|
||||
if release_targets:
|
||||
target_names = [x[0] for x in release_targets]
|
||||
else:
|
||||
target_names = TARGET_NAMES
|
||||
|
||||
return "\n".join(target_names)
|
||||
|
||||
|
||||
def mcu_toolchain_matrix(verbose_html=False, platform_filter=None,
|
||||
release_version='5'):
|
||||
|
|
|
@ -70,6 +70,14 @@ 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>.
|
||||
"""
|
||||
|
||||
def mcu_ide_list():
|
||||
"""Shows list of exportable ides
|
||||
|
||||
"""
|
||||
supported_ides = sorted(EXPORTERS.keys())
|
||||
return "\n".join(supported_ides)
|
||||
|
||||
|
||||
def mcu_ide_matrix(verbose_html=False):
|
||||
"""Shows target map using prettytable
|
||||
|
||||
|
|
|
@ -46,6 +46,8 @@ from tools.options import get_default_options_parser
|
|||
from tools.options import extract_profile
|
||||
from tools.build_api import build_project
|
||||
from tools.build_api import mcu_toolchain_matrix
|
||||
from tools.build_api import mcu_toolchain_list
|
||||
from tools.build_api import mcu_target_list
|
||||
from utils import argparse_filestring_type
|
||||
from utils import argparse_many
|
||||
from utils import argparse_dir_not_parent
|
||||
|
@ -90,9 +92,11 @@ if __name__ == '__main__':
|
|||
help="Add a macro definition")
|
||||
|
||||
group.add_argument("-S", "--supported-toolchains",
|
||||
action="store_true",
|
||||
dest="supported_toolchains",
|
||||
default=False,
|
||||
const="matrix",
|
||||
choices=["matrix", "toolchains", "targets"],
|
||||
nargs="?",
|
||||
help="Displays supported matrix of MCUs and toolchains")
|
||||
|
||||
parser.add_argument('-f', '--filter',
|
||||
|
@ -182,7 +186,16 @@ if __name__ == '__main__':
|
|||
|
||||
# Only prints matrix of supported toolchains
|
||||
if options.supported_toolchains:
|
||||
print mcu_toolchain_matrix(platform_filter=options.general_filter_regex)
|
||||
if options.supported_toolchains == "matrix":
|
||||
print mcu_toolchain_matrix(platform_filter=options.general_filter_regex)
|
||||
elif options.supported_toolchains == "toolchains":
|
||||
toolchain_list = mcu_toolchain_list()
|
||||
# Only print the lines that matter
|
||||
for line in toolchain_list.split("\n"):
|
||||
if not "mbed" in line:
|
||||
print line
|
||||
elif options.supported_toolchains == "targets":
|
||||
print mcu_target_list()
|
||||
exit(0)
|
||||
|
||||
# Print available tests in order and exit
|
||||
|
|
|
@ -12,7 +12,7 @@ from os.path import normpath, realpath
|
|||
|
||||
from tools.paths import EXPORT_DIR, MBED_HAL, MBED_LIBRARIES, MBED_TARGETS_PATH
|
||||
from tools.settings import BUILD_DIR
|
||||
from tools.export import EXPORTERS, mcu_ide_matrix, export_project, get_exporter_toolchain
|
||||
from tools.export import EXPORTERS, mcu_ide_matrix, mcu_ide_list, export_project, get_exporter_toolchain
|
||||
from tools.tests import TESTS, TEST_MAP
|
||||
from tools.tests import test_known, test_name_known, Test
|
||||
from tools.targets import TARGET_NAMES
|
||||
|
@ -145,9 +145,11 @@ def main():
|
|||
help="list available programs in order and exit")
|
||||
|
||||
group.add_argument("-S", "--list-matrix",
|
||||
action="store_true",
|
||||
dest="supported_ides",
|
||||
default=False,
|
||||
const="matrix",
|
||||
choices=["matrix", "ides"],
|
||||
nargs="?",
|
||||
help="displays supported matrix of MCUs and IDEs")
|
||||
|
||||
parser.add_argument("-E",
|
||||
|
@ -188,7 +190,10 @@ def main():
|
|||
|
||||
# Only prints matrix of supported IDEs
|
||||
if options.supported_ides:
|
||||
print_large_string(mcu_ide_matrix())
|
||||
if options.supported_ides == "matrix":
|
||||
print_large_string(mcu_ide_matrix())
|
||||
elif options.supported_ides == "ides":
|
||||
print mcu_ide_list()
|
||||
exit(0)
|
||||
|
||||
# Only prints matrix of supported IDEs
|
||||
|
|
Loading…
Reference in New Issue