Skip to content

Commit 347a58d

Browse files
committed
Add -S/--supported switch to 'mbed compile' to list all targets vs toolchains matrix
1 parent 72ac08d commit 347a58d

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

mbed/mbed.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1709,14 +1709,15 @@ def status_(ignore=False):
17091709
@subcommand('compile',
17101710
dict(name=['-t', '--toolchain'], help='Compile toolchain. Example: ARM, uARM, GCC_ARM, IAR'),
17111711
dict(name=['-m', '--mcu'], help='Compile target. Example: K64F, NUCLEO_F401RE, NRF51822...'),
1712-
dict(name=['-c', '--clean'], action='store_true', help='Clean the build directory before compiling'),
17131712
dict(name='--source', action='append', help='Source directory. Default: . (current dir)'),
17141713
dict(name='--build', help='Build directory. Default: .build/'),
1714+
dict(name=['-c', '--clean'], action='store_true', help='Clean the build directory before compiling'),
1715+
dict(name=['-S', '--supported'], dest='supported', action='store_true', help='Displays supported matrix of targets and toolchains'),
17151716
dict(name='--library', dest='compile_library', action='store_true', help='Compile the current %s as a static library.' % cwd_type),
17161717
dict(name='--tests', dest='compile_tests', action='store_true', help='Compile tests in TESTS directory.'),
17171718
dict(name='--test_spec', dest="test_spec", help="Destination path for a test spec file that can be used by the Greentea automated test tool. (Default is 'test_spec.json')"),
17181719
help='Compile program using the native mbed OS build system.')
1719-
def compile(toolchain=None, mcu=None, clean=False, source=False, build=False, compile_library=False, compile_tests=False, test_spec="test_spec.json"):
1720+
def compile(toolchain=None, mcu=None, source=False, build=False, clean=False, supported=False, compile_library=False, compile_tests=False, test_spec="test_spec.json"):
17201721
args = remainder
17211722
# Gather remaining arguments
17221723
args = remainder
@@ -1727,16 +1728,23 @@ def compile(toolchain=None, mcu=None, clean=False, source=False, build=False, co
17271728

17281729
with cd(program.path):
17291730
tools_dir = os.path.abspath(program.get_tools())
1730-
target = program.get_mcu(mcu)
1731-
tchain = program.get_toolchain(toolchain)
1732-
macros = program.get_macros()
1733-
17341731
env = os.environ.copy()
17351732
env['PYTHONPATH'] = os.path.abspath(program.path)
17361733

17371734
if not source or len(source) == 0:
17381735
source = [os.path.relpath(program.path, orig_path)]
17391736

1737+
if supported:
1738+
popen(['python', '-u', os.path.join(tools_dir, 'make.py')]
1739+
+ (['-S'] if supported else []) + (['-v'] if verbose else [])
1740+
+ args,
1741+
env=env)
1742+
return
1743+
1744+
target = program.get_mcu(mcu)
1745+
tchain = program.get_toolchain(toolchain)
1746+
macros = program.get_macros()
1747+
17401748
if compile_tests:
17411749
# Compile tests
17421750
if not build:

0 commit comments

Comments
 (0)