Skip to content

Commit 364818f

Browse files
authored
Merge pull request #299 from ARMmbed/detect-targets
Generic text improvements in detect_targets.py
2 parents af4869a + c1aab9f commit 364818f

File tree

2 files changed

+21
-19
lines changed

2 files changed

+21
-19
lines changed

tools/build_api.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -668,12 +668,12 @@ def mcu_toolchain_matrix(verbose_html=False, platform_filter=None):
668668
from prettytable import PrettyTable # Only use it in this function so building works without extra modules
669669

670670
# All tests status table print
671-
columns = ["Platform"] + unique_supported_toolchains
672-
pt = PrettyTable(["Platform"] + unique_supported_toolchains)
671+
columns = ["Target"] + unique_supported_toolchains
672+
pt = PrettyTable(["Target"] + unique_supported_toolchains)
673673
# Align table
674674
for col in columns:
675675
pt.align[col] = "c"
676-
pt.align["Platform"] = "l"
676+
pt.align["Target"] = "l"
677677

678678
perm_counter = 0
679679
target_counter = 0
@@ -685,25 +685,21 @@ def mcu_toolchain_matrix(verbose_html=False, platform_filter=None):
685685
target_counter += 1
686686

687687
row = [target] # First column is platform name
688-
default_toolchain = TARGET_MAP[target].default_toolchain
689688
for unique_toolchain in unique_supported_toolchains:
690-
text = "-"
691-
if default_toolchain == unique_toolchain:
692-
text = "Default"
693-
perm_counter += 1
694-
elif unique_toolchain in TARGET_MAP[target].supported_toolchains:
689+
if unique_toolchain in TARGET_MAP[target].supported_toolchains:
695690
text = "Supported"
696691
perm_counter += 1
692+
else:
693+
text = "-"
694+
697695
row.append(text)
698696
pt.add_row(row)
699697

700698
result = pt.get_html_string() if verbose_html else pt.get_string()
701699
result += "\n"
702-
result += "*Default - default on-line compiler\n"
703-
result += "*Supported - supported off-line compiler\n"
704-
result += "\n"
705-
result += "Total platforms: %d\n"% (target_counter)
706-
result += "Total permutations: %d"% (perm_counter)
700+
result += "Supported targets: %d\n"% (target_counter)
701+
if target_counter == 1:
702+
result += "Supported toolchains: %d"% (perm_counter)
707703
return result
708704

709705

tools/detect_targets.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@
4646
action="store_true",
4747
dest="supported_toolchains",
4848
default=False,
49-
help="Displays supported matrix of MCUs and toolchains")
49+
help="Displays supported matrix of targets and toolchains")
5050

5151
parser.add_option('-f', '--filter',
5252
dest='general_filter_regex',
5353
default=None,
54-
help='For some commands you can use filter to filter out results')
54+
help='Filter targets')
5555

5656
parser.add_option("-v", "--verbose",
5757
action="store_true",
@@ -68,12 +68,18 @@
6868

6969
# If auto_detect attribute is present, we assume other auto-detection
7070
# parameters like 'toolchains_filter' are also set.
71-
print "[mbed] Detecting connected mbed-enabled devices... "
72-
7371
MUTs = get_autodetected_MUTS_list()
7472

73+
count = 0
7574
for mut in MUTs.values():
76-
print "[mbed] Detected %s, port: %s, mounted: %s"% (mut['mcu'], mut['port'], mut['disk'])
75+
print ""
76+
print "[mbed] Detected %s, port %s, mounted %s" % (mut['mcu'], mut['port'], mut['disk'])
77+
print "[mbed] Supported toolchains for %s" % mut['mcu']
78+
print mcu_toolchain_matrix(platform_filter=r'^'+mut['mcu']+'$')
79+
count += 1
80+
81+
if count == 0:
82+
print "[mbed] No mbed targets where detected on your system."
7783

7884
except KeyboardInterrupt, e:
7985
print "\n[CTRL+c] exit"

0 commit comments

Comments
 (0)