Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-sdk-tools by
Diff: make.py
- Revision:
- 31:182518299918
- Parent:
- 24:25bff2709c20
diff -r f12ce67666d0 -r 182518299918 make.py --- a/make.py Mon Aug 29 11:56:59 2016 +0100 +++ b/make.py Wed Jan 04 11:58:24 2017 -0600 @@ -19,16 +19,19 @@ TEST BUILD & RUN """ import sys +import json from time import sleep from shutil import copy -from os.path import join, abspath, dirname, isfile, isdir +from os.path import join, abspath, dirname # Be sure that the tools directory is in the search path ROOT = abspath(join(dirname(__file__), "..")) sys.path.insert(0, ROOT) from tools.utils import args_error +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 @@ -41,18 +44,18 @@ from tools.tests import test_known, test_name_known from tools.targets import TARGET_MAP from tools.options import get_default_options_parser +from tools.options import extract_profile from tools.build_api import build_project from tools.build_api import mcu_toolchain_matrix from utils import argparse_filestring_type from utils import argparse_many from utils import argparse_dir_not_parent -from argparse import ArgumentTypeError -from tools.toolchains import mbedToolchain +from tools.toolchains import mbedToolchain, TOOLCHAIN_CLASSES, TOOLCHAIN_PATHS from tools.settings import CLI_COLOR_MAP if __name__ == '__main__': # Parse Options - parser = get_default_options_parser() + parser = get_default_options_parser(add_app_config=True) group = parser.add_mutually_exclusive_group(required=False) group.add_argument("-p", type=argparse_many(test_known), @@ -207,14 +210,21 @@ # Target if options.mcu is None : - args_error(parser, "[ERROR] You should specify an MCU") + args_error(parser, "argument -m/--mcu is required") mcu = options.mcu[0] # Toolchain if options.tool is None: - args_error(parser, "[ERROR] You should specify a TOOLCHAIN") + args_error(parser, "argument -t/--tool is required") toolchain = options.tool[0] + if (options.program is None) and (not options.source_dir): + args_error(parser, "one of -p, -n, or --source is required") + + if options.source_dir and not options.build_dir: + args_error(parser, "argument --build is required when argument --source is provided") + + if options.color: # This import happens late to prevent initializing colorization when we don't need it import colorize @@ -226,6 +236,12 @@ else: notify = None + if not TOOLCHAIN_CLASSES[toolchain].check_executable(): + search_path = TOOLCHAIN_PATHS[toolchain] or "No path set" + args_error(parser, "Could not find executable for %s.\n" + "Currently set search path: %s" + %(toolchain,search_path)) + # Test for test_no in p: test = Test(test_no) @@ -260,7 +276,8 @@ build_dir = options.build_dir try: - bin_file = build_project(test.source_dir, build_dir, mcu, toolchain, test.dependencies, options.options, + bin_file = build_project(test.source_dir, build_dir, mcu, toolchain, + test.dependencies, linker_script=options.linker_script, clean=options.clean, verbose=options.verbose, @@ -268,7 +285,12 @@ silent=options.silent, macros=options.macros, jobs=options.jobs, - name=options.artifact_name) + name=options.artifact_name, + app_config=options.app_config, + inc_dirs=[dirname(MBED_LIBRARIES)], + build_profile=extract_profile(parser, + options, + toolchain)) print 'Image: %s'% bin_file if options.disk: @@ -305,6 +327,8 @@ except KeyboardInterrupt, e: print "\n[CTRL+c] exit" + except NotSupportedException, e: + print "\nNot supported for selected target" except Exception,e: if options.verbose: import traceback