Clone of official tools
Diff: make.py
- Revision:
- 36:96847d42f010
- Parent:
- 31:8ea194f6145b
- Child:
- 38:399953da035d
diff -r da9c89f8be7d -r 96847d42f010 make.py --- a/make.py Wed Feb 15 13:53:18 2017 -0600 +++ b/make.py Thu Jun 22 11:12:28 2017 -0500 @@ -23,6 +23,7 @@ from time import sleep from shutil import copy from os.path import join, abspath, dirname +from json import load, dump # Be sure that the tools directory is in the search path ROOT = abspath(join(dirname(__file__), "..")) @@ -32,13 +33,9 @@ from tools.utils import NotSupportedException from tools.paths import BUILD_DIR from tools.paths import MBED_LIBRARIES -from tools.paths import RTOS_LIBRARIES from tools.paths import RPC_LIBRARY -from tools.paths import ETH_LIBRARY -from tools.paths import USB_HOST_LIBRARIES, USB_LIBRARIES +from tools.paths import USB_LIBRARIES from tools.paths import DSP_LIBRARIES -from tools.paths import FS_LIBRARY -from tools.paths import UBLOX_LIBRARY from tools.tests import TESTS, Test, TEST_MAP from tools.tests import TEST_MBED_LIB from tools.tests import test_known, test_name_known @@ -47,6 +44,9 @@ 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 tools.build_api import merge_build_data from utils import argparse_filestring_type from utils import argparse_many from utils import argparse_dir_not_parent @@ -91,9 +91,11 @@ 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', @@ -130,26 +132,11 @@ default=False, help="List available tests in order and exit") # Ideally, all the tests with a single "main" thread can be run with, or - # without the rtos, eth, usb_host, usb, dsp, fat, ublox - parser.add_argument("--rtos", - action="store_true", dest="rtos", - default=False, help="Link with RTOS library") - + # without the usb, dsp parser.add_argument("--rpc", action="store_true", dest="rpc", default=False, help="Link with RPC library") - parser.add_argument("--eth", - action="store_true", dest="eth", - default=False, - help="Link with Ethernet library") - - parser.add_argument("--usb_host", - action="store_true", - dest="usb_host", - default=False, - help="Link with USB Host library") - parser.add_argument("--usb", action="store_true", dest="usb", @@ -162,24 +149,17 @@ default=False, help="Link with DSP library") - parser.add_argument("--fat", - action="store_true", - dest="fat", - default=False, - help="Link with FS ad SD card file system library") - - parser.add_argument("--ublox", - action="store_true", - dest="ublox", - default=False, - help="Link with U-Blox library") - parser.add_argument("--testlib", action="store_true", dest="testlib", default=False, help="Link with mbed test library") + parser.add_argument("--build-data", + dest="build_data", + default=None, + help="Dump build_data to this file") + # Specify a different linker script parser.add_argument("-l", "--linker", dest="linker_script", type=argparse_filestring_type, @@ -189,7 +169,16 @@ # 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 @@ -243,6 +232,7 @@ %(toolchain,search_path)) # Test + build_data_blob = {} if options.build_data else None for test_no in p: test = Test(test_no) if options.automated is not None: test.automated = options.automated @@ -257,14 +247,9 @@ sys.exit() # Linking with extra libraries - if options.rtos: test.dependencies.append(RTOS_LIBRARIES) if options.rpc: test.dependencies.append(RPC_LIBRARY) - if options.eth: test.dependencies.append(ETH_LIBRARY) - if options.usb_host: test.dependencies.append(USB_HOST_LIBRARIES) if options.usb: test.dependencies.append(USB_LIBRARIES) if options.dsp: test.dependencies.append(DSP_LIBRARIES) - if options.fat: test.dependencies.append(FS_LIBRARY) - if options.ublox: test.dependencies.append(UBLOX_LIBRARY) if options.testlib: test.dependencies.append(TEST_MBED_LIB) build_dir = join(BUILD_DIR, "test", mcu, toolchain, test.id) @@ -277,11 +262,12 @@ try: bin_file = build_project(test.source_dir, build_dir, mcu, toolchain, - test.dependencies, + set(test.dependencies), linker_script=options.linker_script, clean=options.clean, verbose=options.verbose, notify=notify, + report=build_data_blob, silent=options.silent, macros=options.macros, jobs=options.jobs, @@ -327,8 +313,8 @@ except KeyboardInterrupt, e: print "\n[CTRL+c] exit" - except NotSupportedException, e: - print "\nNot supported for selected target" + except NotSupportedException as e: + print "\nCould not compile for %s: %s" % (mcu, str(e)) except Exception,e: if options.verbose: import traceback @@ -337,3 +323,5 @@ print "[ERROR] %s" % str(e) sys.exit(1) + if options.build_data: + merge_build_data(options.build_data, build_data_blob, "application")