Merge pull request #5247 from kegilbert/example-build-profile-arg

Add profile argument to mbed-os example build tools
pull/4955/head
Jimmy Brisson 2017-10-13 09:24:04 -05:00 committed by GitHub
commit 299af9742d
2 changed files with 15 additions and 4 deletions

View File

@ -54,6 +54,11 @@ def main():
argparse_force_uppercase_type(
official_target_names, "MCU")),
default=official_target_names)
compile_cmd.add_argument("--profile",
help=("build profile file"),
metavar="profile")
export_cmd = subparsers.add_parser("export")
export_cmd.set_defaults(fn=do_export),
export_cmd.add_argument(
@ -111,7 +116,7 @@ def do_deploy(_, config, examples):
def do_compile(args, config, examples):
"""Do the compile step"""
results = {}
results = lib.compile_repos(config, args.toolchains, args.mcu, examples)
results = lib.compile_repos(config, args.toolchains, args.mcu, args.profile, examples)
lib.print_summary(results)
failures = lib.get_num_failures(results)

View File

@ -314,7 +314,7 @@ def export_repos(config, ides, targets, examples):
return results
def compile_repos(config, toolchains, targets, examples):
def compile_repos(config, toolchains, targets, profile, examples):
"""Compiles combinations of example programs, targets and compile chains.
The results are returned in a [key: value] dictionary format:
@ -358,8 +358,14 @@ def compile_repos(config, toolchains, targets, examples):
valid_choices(example['toolchains'], toolchains),
example['features']):
print("Compiling %s for %s, %s" % (name, target, toolchain))
proc = subprocess.Popen(["mbed-cli", "compile", "-t", toolchain,
"-m", target, "-v"])
build_command = ["mbed-cli", "compile", "-t", toolchain, "-m", target, "-v"]
if profile:
build_command.append("--profile")
build_command.append(profile)
proc = subprocess.Popen(build_command)
proc.wait()
example_summary = "{} {} {}".format(name, target, toolchain)
if proc.returncode: