Added multiple toolchain and MCU declarations for options -t and -m respectively. Names must be divided by comma.

pull/338/head
Przemek Wirkus 2014-05-30 14:49:19 +01:00
parent 97199bb372
commit 348c71f7f9
1 changed files with 23 additions and 19 deletions

View File

@ -33,10 +33,10 @@ from workspace_tools.build_api import build_mbed_libs, build_lib
if __name__ == '__main__':
start = time()
# Parse Options
parser = get_default_options_parser()
# Extra libraries
parser.add_option("-r", "--rtos", action="store_true", dest="rtos",
default=False, help="Compile the rtos")
@ -55,28 +55,32 @@ if __name__ == '__main__':
parser.add_option("-D", "", action="append", dest="macros",
help="Add a macro definition")
(options, args) = parser.parse_args()
# Get target list
if options.mcu:
if options.mcu not in TARGET_NAMES:
print "Given MCU '%s' not into the supported list:\n%s" % (options.mcu, TARGET_NAMES)
sys.exit(1)
targets = [options.mcu]
mcu_list = (options.mcu).split(",")
for mcu in mcu_list:
if mcu not in TARGET_NAMES:
print "Given MCU '%s' not into the supported list:\n%s" % (mcu, TARGET_NAMES)
sys.exit(1)
targets = mcu_list
else:
targets = TARGET_NAMES
# Get toolchains list
if options.tool:
if options.tool not in TOOLCHAINS:
print "Given toolchain '%s' not into the supported list:\n%s" % (options.tool, TOOLCHAINS)
sys.exit(1)
toolchains = [options.tool]
toolchain_list = (options.tool).split(",")
for tc in toolchain_list:
if tc not in TOOLCHAINS:
print "Given toolchain '%s' not into the supported list:\n%s" % (tc, TOOLCHAINS)
sys.exit(1)
toolchains = toolchain_list
else:
toolchains = TOOLCHAINS
# Get libraries list
libraries = []
# Additional Libraries
if options.rtos:
libraries.extend(["rtx", "rtos"])
@ -90,7 +94,7 @@ if __name__ == '__main__':
libraries.extend(["cmsis_dsp", "dsp"])
if options.ublox:
libraries.extend(["rtx", "rtos", "usb_host", "ublox"])
# Build
failures = []
successes = []
@ -112,17 +116,17 @@ if __name__ == '__main__':
import sys, traceback
traceback.print_exc(file=sys.stdout)
sys.exit(1)
failures.append(id)
print e
# Write summary of the builds
print "\n\nCompleted in: (%.2f)s" % (time() - start)
if successes:
print "\n\nBuild successes:"
print "\n".join([" * %s" % s for s in successes])
if failures:
print "\n\nBuild failures:"
print "\n".join([" * %s" % f for f in failures])