mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #299 from ARMmbed/detect-targets
Generic text improvements in detect_targets.py
commit
364818f789
|
@ -668,12 +668,12 @@ def mcu_toolchain_matrix(verbose_html=False, platform_filter=None):
|
||||||
from prettytable import PrettyTable # Only use it in this function so building works without extra modules
|
from prettytable import PrettyTable # Only use it in this function so building works without extra modules
|
||||||
|
|
||||||
# All tests status table print
|
# All tests status table print
|
||||||
columns = ["Platform"] + unique_supported_toolchains
|
columns = ["Target"] + unique_supported_toolchains
|
||||||
pt = PrettyTable(["Platform"] + unique_supported_toolchains)
|
pt = PrettyTable(["Target"] + unique_supported_toolchains)
|
||||||
# Align table
|
# Align table
|
||||||
for col in columns:
|
for col in columns:
|
||||||
pt.align[col] = "c"
|
pt.align[col] = "c"
|
||||||
pt.align["Platform"] = "l"
|
pt.align["Target"] = "l"
|
||||||
|
|
||||||
perm_counter = 0
|
perm_counter = 0
|
||||||
target_counter = 0
|
target_counter = 0
|
||||||
|
@ -685,25 +685,21 @@ def mcu_toolchain_matrix(verbose_html=False, platform_filter=None):
|
||||||
target_counter += 1
|
target_counter += 1
|
||||||
|
|
||||||
row = [target] # First column is platform name
|
row = [target] # First column is platform name
|
||||||
default_toolchain = TARGET_MAP[target].default_toolchain
|
|
||||||
for unique_toolchain in unique_supported_toolchains:
|
for unique_toolchain in unique_supported_toolchains:
|
||||||
text = "-"
|
if unique_toolchain in TARGET_MAP[target].supported_toolchains:
|
||||||
if default_toolchain == unique_toolchain:
|
|
||||||
text = "Default"
|
|
||||||
perm_counter += 1
|
|
||||||
elif unique_toolchain in TARGET_MAP[target].supported_toolchains:
|
|
||||||
text = "Supported"
|
text = "Supported"
|
||||||
perm_counter += 1
|
perm_counter += 1
|
||||||
|
else:
|
||||||
|
text = "-"
|
||||||
|
|
||||||
row.append(text)
|
row.append(text)
|
||||||
pt.add_row(row)
|
pt.add_row(row)
|
||||||
|
|
||||||
result = pt.get_html_string() if verbose_html else pt.get_string()
|
result = pt.get_html_string() if verbose_html else pt.get_string()
|
||||||
result += "\n"
|
result += "\n"
|
||||||
result += "*Default - default on-line compiler\n"
|
result += "Supported targets: %d\n"% (target_counter)
|
||||||
result += "*Supported - supported off-line compiler\n"
|
if target_counter == 1:
|
||||||
result += "\n"
|
result += "Supported toolchains: %d"% (perm_counter)
|
||||||
result += "Total platforms: %d\n"% (target_counter)
|
|
||||||
result += "Total permutations: %d"% (perm_counter)
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -46,12 +46,12 @@ if __name__ == '__main__':
|
||||||
action="store_true",
|
action="store_true",
|
||||||
dest="supported_toolchains",
|
dest="supported_toolchains",
|
||||||
default=False,
|
default=False,
|
||||||
help="Displays supported matrix of MCUs and toolchains")
|
help="Displays supported matrix of targets and toolchains")
|
||||||
|
|
||||||
parser.add_option('-f', '--filter',
|
parser.add_option('-f', '--filter',
|
||||||
dest='general_filter_regex',
|
dest='general_filter_regex',
|
||||||
default=None,
|
default=None,
|
||||||
help='For some commands you can use filter to filter out results')
|
help='Filter targets')
|
||||||
|
|
||||||
parser.add_option("-v", "--verbose",
|
parser.add_option("-v", "--verbose",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
|
@ -68,12 +68,18 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
# If auto_detect attribute is present, we assume other auto-detection
|
# If auto_detect attribute is present, we assume other auto-detection
|
||||||
# parameters like 'toolchains_filter' are also set.
|
# parameters like 'toolchains_filter' are also set.
|
||||||
print "[mbed] Detecting connected mbed-enabled devices... "
|
|
||||||
|
|
||||||
MUTs = get_autodetected_MUTS_list()
|
MUTs = get_autodetected_MUTS_list()
|
||||||
|
|
||||||
|
count = 0
|
||||||
for mut in MUTs.values():
|
for mut in MUTs.values():
|
||||||
print "[mbed] Detected %s, port: %s, mounted: %s"% (mut['mcu'], mut['port'], mut['disk'])
|
print ""
|
||||||
|
print "[mbed] Detected %s, port %s, mounted %s" % (mut['mcu'], mut['port'], mut['disk'])
|
||||||
|
print "[mbed] Supported toolchains for %s" % mut['mcu']
|
||||||
|
print mcu_toolchain_matrix(platform_filter=r'^'+mut['mcu']+'$')
|
||||||
|
count += 1
|
||||||
|
|
||||||
|
if count == 0:
|
||||||
|
print "[mbed] No mbed targets where detected on your system."
|
||||||
|
|
||||||
except KeyboardInterrupt, e:
|
except KeyboardInterrupt, e:
|
||||||
print "\n[CTRL+c] exit"
|
print "\n[CTRL+c] exit"
|
||||||
|
|
Loading…
Reference in New Issue