@@ -1451,13 +1451,16 @@ def get_module_avail(module_name):
1451
1451
return module_name in sys .modules .keys ()
1452
1452
1453
1453
1454
- def get_autodetected_MUTS (mbeds_list ):
1454
+ def get_autodetected_MUTS (mbeds_list , platform_name_filter = None ):
1455
1455
""" Function detects all connected to host mbed-enabled devices and generates artificial MUTS file.
1456
1456
If function fails to auto-detect devices it will return empty dictionary.
1457
1457
1458
1458
if get_module_avail('mbed_lstools'):
1459
1459
mbeds = mbed_lstools.create()
1460
1460
mbeds_list = mbeds.list_mbeds()
1461
+
1462
+ @param mbeds_list list of mbeds captured from mbed_lstools
1463
+ @param platform_name You can filter 'platform_name' with list of filtered targets from 'platform_name_filter'
1461
1464
"""
1462
1465
result = {} # Should be in muts_all.json format
1463
1466
# Align mbeds_list from mbed_lstools to MUT file format (JSON dictionary with muts)
@@ -1476,7 +1479,11 @@ def get_autodetected_MUTS(mbeds_list):
1476
1479
return result
1477
1480
1478
1481
1479
- def get_autodetected_TEST_SPEC (mbeds_list , use_default_toolchain = True , use_supported_toolchains = False , toolchain_filter = None ):
1482
+ def get_autodetected_TEST_SPEC (mbeds_list ,
1483
+ use_default_toolchain = True ,
1484
+ use_supported_toolchains = False ,
1485
+ toolchain_filter = None ,
1486
+ platform_name_filter = None ):
1480
1487
""" Function detects all connected to host mbed-enabled devices and generates artificial test_spec file.
1481
1488
If function fails to auto-detect devices it will return empty 'targets' test_spec description.
1482
1489
@@ -1488,23 +1495,24 @@ def get_autodetected_TEST_SPEC(mbeds_list, use_default_toolchain=True, use_suppo
1488
1495
1489
1496
for mut in mbeds_list :
1490
1497
mcu = mut ['platform_name' ]
1491
- if mcu in TARGET_MAP :
1492
- default_toolchain = TARGET_MAP [mcu ].default_toolchain
1493
- supported_toolchains = TARGET_MAP [mcu ].supported_toolchains
1494
-
1495
- # Decide which toolchains should be added to test specification toolchain pool for each target
1496
- toolchains = []
1497
- if use_default_toolchain :
1498
- toolchains .append (default_toolchain )
1499
- if use_supported_toolchains :
1500
- toolchains += supported_toolchains
1501
- if toolchain_filter is not None :
1502
- all_toolchains = supported_toolchains + [default_toolchain ]
1503
- for toolchain in toolchain_filter .split (',' ):
1504
- if toolchain in all_toolchains :
1505
- toolchains .append (toolchain )
1506
-
1507
- result ['targets' ][mcu ] = list (set (toolchains ))
1498
+ if platform_name_filter is None or (platform_name_filter and mut ['platform_name' ] in platform_name_filter ):
1499
+ if mcu in TARGET_MAP :
1500
+ default_toolchain = TARGET_MAP [mcu ].default_toolchain
1501
+ supported_toolchains = TARGET_MAP [mcu ].supported_toolchains
1502
+
1503
+ # Decide which toolchains should be added to test specification toolchain pool for each target
1504
+ toolchains = []
1505
+ if use_default_toolchain :
1506
+ toolchains .append (default_toolchain )
1507
+ if use_supported_toolchains :
1508
+ toolchains += supported_toolchains
1509
+ if toolchain_filter is not None :
1510
+ all_toolchains = supported_toolchains + [default_toolchain ]
1511
+ for toolchain in toolchain_filter .split (',' ):
1512
+ if toolchain in all_toolchains :
1513
+ toolchains .append (toolchain )
1514
+
1515
+ result ['targets' ][mcu ] = list (set (toolchains ))
1508
1516
return result
1509
1517
1510
1518
0 commit comments