mirror of https://github.com/ARMmbed/mbed-os.git
Added new switch --silet to build.py to avoid endless screens of Copy / Compile. In silent mode only warnings / erros / build product will be displayed
parent
027a6bc35d
commit
0c848f8290
|
@ -122,6 +122,12 @@ if __name__ == '__main__':
|
||||||
default=False,
|
default=False,
|
||||||
help="Verbose diagnostic output")
|
help="Verbose diagnostic output")
|
||||||
|
|
||||||
|
parser.add_option("-s", "--silent",
|
||||||
|
action="store_true",
|
||||||
|
dest="silent",
|
||||||
|
default=False,
|
||||||
|
help="Silent diagnostic output (no copy, compile notification)")
|
||||||
|
|
||||||
parser.add_option("-x", "--extra-verbose-notifications",
|
parser.add_option("-x", "--extra-verbose-notifications",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
dest="extra_verbose_notify",
|
dest="extra_verbose_notify",
|
||||||
|
@ -213,14 +219,24 @@ if __name__ == '__main__':
|
||||||
tt_id = "%s::%s" % (toolchain, target)
|
tt_id = "%s::%s" % (toolchain, target)
|
||||||
try:
|
try:
|
||||||
mcu = TARGET_MAP[target]
|
mcu = TARGET_MAP[target]
|
||||||
lib_build_res = build_mbed_libs(mcu, toolchain, options=options.options,
|
lib_build_res = build_mbed_libs(mcu, toolchain,
|
||||||
notify=notify, verbose=options.verbose, jobs=options.jobs, clean=options.clean,
|
options=options.options,
|
||||||
|
notify=notify,
|
||||||
|
verbose=options.verbose,
|
||||||
|
silent=options.silent,
|
||||||
|
jobs=options.jobs,
|
||||||
|
clean=options.clean,
|
||||||
macros=options.macros)
|
macros=options.macros)
|
||||||
for lib_id in libraries:
|
for lib_id in libraries:
|
||||||
notify = print_notify_verbose if options.extra_verbose_notify else None # Special notify for CI (more verbose)
|
notify = print_notify_verbose if options.extra_verbose_notify else None # Special notify for CI (more verbose)
|
||||||
build_lib(lib_id, mcu, toolchain, options=options.options,
|
build_lib(lib_id, mcu, toolchain,
|
||||||
notify=notify, verbose=options.verbose, clean=options.clean,
|
options=options.options,
|
||||||
macros=options.macros, jobs=options.jobs)
|
notify=notify,
|
||||||
|
verbose=options.verbose,
|
||||||
|
silent=options.silent,
|
||||||
|
clean=options.clean,
|
||||||
|
macros=options.macros,
|
||||||
|
jobs=options.jobs)
|
||||||
if lib_build_res:
|
if lib_build_res:
|
||||||
successes.append(tt_id)
|
successes.append(tt_id)
|
||||||
else:
|
else:
|
||||||
|
@ -234,6 +250,7 @@ if __name__ == '__main__':
|
||||||
print e
|
print e
|
||||||
|
|
||||||
# Write summary of the builds
|
# Write summary of the builds
|
||||||
|
print
|
||||||
print "Completed in: (%.2f)s" % (time() - start)
|
print "Completed in: (%.2f)s" % (time() - start)
|
||||||
print
|
print
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ def build_project(src_path, build_path, target, toolchain_name,
|
||||||
|
|
||||||
def build_library(src_paths, build_path, target, toolchain_name,
|
def build_library(src_paths, build_path, target, toolchain_name,
|
||||||
dependencies_paths=None, options=None, name=None, clean=False,
|
dependencies_paths=None, options=None, name=None, clean=False,
|
||||||
notify=None, verbose=False, macros=None, inc_dirs=None, inc_dirs_ext=None, jobs=1):
|
notify=None, verbose=False, macros=None, inc_dirs=None, inc_dirs_ext=None, jobs=1, silent=False):
|
||||||
""" src_path: the path of the source directory
|
""" src_path: the path of the source directory
|
||||||
build_path: the path of the build directory
|
build_path: the path of the build directory
|
||||||
target: ['LPC1768', 'LPC11U24', 'LPC2368']
|
target: ['LPC1768', 'LPC11U24', 'LPC2368']
|
||||||
|
@ -112,7 +112,7 @@ def build_library(src_paths, build_path, target, toolchain_name,
|
||||||
raise Exception("The library source folder does not exist: %s", src_path)
|
raise Exception("The library source folder does not exist: %s", src_path)
|
||||||
|
|
||||||
# Toolchain instance
|
# Toolchain instance
|
||||||
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, macros=macros, notify=notify)
|
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, macros=macros, notify=notify, silent=silent)
|
||||||
toolchain.VERBOSE = verbose
|
toolchain.VERBOSE = verbose
|
||||||
toolchain.jobs = jobs
|
toolchain.jobs = jobs
|
||||||
toolchain.build_all = clean
|
toolchain.build_all = clean
|
||||||
|
@ -162,7 +162,7 @@ def build_library(src_paths, build_path, target, toolchain_name,
|
||||||
toolchain.build_library(objects, bin_path, name)
|
toolchain.build_library(objects, bin_path, name)
|
||||||
|
|
||||||
|
|
||||||
def build_lib(lib_id, target, toolchain, options=None, verbose=False, clean=False, macros=None, notify=None, jobs=1):
|
def build_lib(lib_id, target, toolchain, options=None, verbose=False, clean=False, macros=None, notify=None, jobs=1, silent=False):
|
||||||
""" Wrapper for build_library function.
|
""" Wrapper for build_library function.
|
||||||
Function builds library in proper directory using all dependencies and macros defined by user.
|
Function builds library in proper directory using all dependencies and macros defined by user.
|
||||||
"""
|
"""
|
||||||
|
@ -175,6 +175,7 @@ def build_lib(lib_id, target, toolchain, options=None, verbose=False, clean=Fals
|
||||||
|
|
||||||
build_library(lib.source_dir, lib.build_dir, target, toolchain, lib.dependencies, options,
|
build_library(lib.source_dir, lib.build_dir, target, toolchain, lib.dependencies, options,
|
||||||
verbose=verbose,
|
verbose=verbose,
|
||||||
|
silent=silent,
|
||||||
clean=clean,
|
clean=clean,
|
||||||
macros=MACROS,
|
macros=MACROS,
|
||||||
notify=notify,
|
notify=notify,
|
||||||
|
@ -186,7 +187,7 @@ def build_lib(lib_id, target, toolchain, options=None, verbose=False, clean=Fals
|
||||||
|
|
||||||
|
|
||||||
# We do have unique legacy conventions about how we build and package the mbed library
|
# We do have unique legacy conventions about how we build and package the mbed library
|
||||||
def build_mbed_libs(target, toolchain_name, options=None, verbose=False, clean=False, macros=None, notify=None, jobs=1):
|
def build_mbed_libs(target, toolchain_name, options=None, verbose=False, clean=False, macros=None, notify=None, jobs=1, silent=False):
|
||||||
""" Function returns True is library was built and false if building was skipped """
|
""" Function returns True is library was built and false if building was skipped """
|
||||||
# Check toolchain support
|
# Check toolchain support
|
||||||
if toolchain_name not in target.supported_toolchains:
|
if toolchain_name not in target.supported_toolchains:
|
||||||
|
@ -196,7 +197,7 @@ def build_mbed_libs(target, toolchain_name, options=None, verbose=False, clean=F
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Toolchain
|
# Toolchain
|
||||||
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, macros=macros, notify=notify)
|
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, macros=macros, notify=notify, silent=silent)
|
||||||
toolchain.VERBOSE = verbose
|
toolchain.VERBOSE = verbose
|
||||||
toolchain.jobs = jobs
|
toolchain.jobs = jobs
|
||||||
toolchain.build_all = clean
|
toolchain.build_all = clean
|
||||||
|
|
|
@ -16,6 +16,7 @@ limitations under the License.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
import sys
|
||||||
from os import stat, walk
|
from os import stat, walk
|
||||||
from copy import copy
|
from copy import copy
|
||||||
from time import time, sleep
|
from time import time, sleep
|
||||||
|
@ -33,9 +34,16 @@ import workspace_tools.hooks as hooks
|
||||||
#Disables multiprocessing if set to higher number than the host machine CPUs
|
#Disables multiprocessing if set to higher number than the host machine CPUs
|
||||||
CPU_COUNT_MIN = 1
|
CPU_COUNT_MIN = 1
|
||||||
|
|
||||||
def print_notify(event):
|
def print_notify(event, silent=False):
|
||||||
# Default command line notification
|
""" Default command line notification
|
||||||
|
"""
|
||||||
|
if "counter" not in print_notify.__dict__:
|
||||||
|
print_notify.counter = event['type']
|
||||||
|
|
||||||
if event['type'] in ['info', 'debug']:
|
if event['type'] in ['info', 'debug']:
|
||||||
|
if silent:
|
||||||
|
if print_notify.counter == 'progress':
|
||||||
|
print
|
||||||
print event['message']
|
print event['message']
|
||||||
|
|
||||||
elif event['type'] == 'cc':
|
elif event['type'] == 'cc':
|
||||||
|
@ -44,11 +52,15 @@ def print_notify(event):
|
||||||
print '[%(severity)s] %(file)s@%(line)s: %(message)s' % event
|
print '[%(severity)s] %(file)s@%(line)s: %(message)s' % event
|
||||||
|
|
||||||
elif event['type'] == 'progress':
|
elif event['type'] == 'progress':
|
||||||
print '%s: %s' % (event['action'].title(), basename(event['file']))
|
if not silent:
|
||||||
|
print '%s: %s' % (event['action'].title(), basename(event['file']))
|
||||||
|
else:
|
||||||
|
sys.stdout.write('-' if event['action'].title() == 'Copy' else '=')
|
||||||
|
print_notify.counter = event['type']
|
||||||
|
|
||||||
|
def print_notify_verbose(event, silent=False):
|
||||||
def print_notify_verbose(event):
|
""" Default command line notification with more verbose mode
|
||||||
""" Default command line notification with more verbose mode """
|
"""
|
||||||
if event['type'] in ['info', 'debug']:
|
if event['type'] in ['info', 'debug']:
|
||||||
print_notify(event) # standard handle
|
print_notify(event) # standard handle
|
||||||
|
|
||||||
|
@ -204,22 +216,16 @@ class mbedToolchain:
|
||||||
GOANNA_FORMAT = "[Goanna] warning [%FILENAME%:%LINENO%] - [%CHECKNAME%(%SEVERITY%)] %MESSAGE%"
|
GOANNA_FORMAT = "[Goanna] warning [%FILENAME%:%LINENO%] - [%CHECKNAME%(%SEVERITY%)] %MESSAGE%"
|
||||||
GOANNA_DIAGNOSTIC_PATTERN = re.compile(r'"\[Goanna\] (?P<severity>warning) \[(?P<file>[^:]+):(?P<line>\d+)\] \- (?P<message>.*)"')
|
GOANNA_DIAGNOSTIC_PATTERN = re.compile(r'"\[Goanna\] (?P<severity>warning) \[(?P<file>[^:]+):(?P<line>\d+)\] \- (?P<message>.*)"')
|
||||||
|
|
||||||
def __init__(self, target, options=None, notify=None, macros=None):
|
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
|
||||||
self.target = target
|
self.target = target
|
||||||
self.name = self.__class__.__name__
|
self.name = self.__class__.__name__
|
||||||
self.hook = hooks.Hook(target, self)
|
self.hook = hooks.Hook(target, self)
|
||||||
|
self.silent = silent
|
||||||
|
|
||||||
self.legacy_ignore_dirs = LEGACY_IGNORE_DIRS - set([target.name, LEGACY_TOOLCHAIN_NAMES[self.name]])
|
self.legacy_ignore_dirs = LEGACY_IGNORE_DIRS - set([target.name, LEGACY_TOOLCHAIN_NAMES[self.name]])
|
||||||
|
|
||||||
if notify is not None:
|
self.notify_fun = notify if notify is not None else print_notify
|
||||||
self.notify = notify
|
self.options = options if options is not None else []
|
||||||
else:
|
|
||||||
self.notify = print_notify
|
|
||||||
|
|
||||||
if options is None:
|
|
||||||
self.options = []
|
|
||||||
else:
|
|
||||||
self.options = options
|
|
||||||
|
|
||||||
self.macros = macros or []
|
self.macros = macros or []
|
||||||
self.options.extend(BUILD_OPTIONS)
|
self.options.extend(BUILD_OPTIONS)
|
||||||
|
@ -240,6 +246,11 @@ class mbedToolchain:
|
||||||
|
|
||||||
self.mp_pool = None
|
self.mp_pool = None
|
||||||
|
|
||||||
|
def notify(self, event):
|
||||||
|
""" Little closure for notify functions
|
||||||
|
"""
|
||||||
|
return self.notify_fun(event, self.silent)
|
||||||
|
|
||||||
def __exit__(self):
|
def __exit__(self):
|
||||||
if self.mp_pool is not None:
|
if self.mp_pool is not None:
|
||||||
self.mp_pool.terminate()
|
self.mp_pool.terminate()
|
||||||
|
|
|
@ -30,8 +30,8 @@ class ARM(mbedToolchain):
|
||||||
DIAGNOSTIC_PATTERN = re.compile('"(?P<file>[^"]+)", line (?P<line>\d+): (?P<severity>Warning|Error): (?P<message>.+)')
|
DIAGNOSTIC_PATTERN = re.compile('"(?P<file>[^"]+)", line (?P<line>\d+): (?P<severity>Warning|Error): (?P<message>.+)')
|
||||||
DEP_PATTERN = re.compile('\S+:\s(?P<file>.+)\n')
|
DEP_PATTERN = re.compile('\S+:\s(?P<file>.+)\n')
|
||||||
|
|
||||||
def __init__(self, target, options=None, notify=None, macros=None):
|
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
|
||||||
mbedToolchain.__init__(self, target, options, notify, macros)
|
mbedToolchain.__init__(self, target, options, notify, macros, silent)
|
||||||
|
|
||||||
if target.core == "Cortex-M0+":
|
if target.core == "Cortex-M0+":
|
||||||
cpu = "Cortex-M0"
|
cpu = "Cortex-M0"
|
||||||
|
@ -147,8 +147,8 @@ class ARM(mbedToolchain):
|
||||||
self.default_cmd(args)
|
self.default_cmd(args)
|
||||||
|
|
||||||
class ARM_STD(ARM):
|
class ARM_STD(ARM):
|
||||||
def __init__(self, target, options=None, notify=None, macros=None):
|
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
|
||||||
ARM.__init__(self, target, options, notify, macros)
|
ARM.__init__(self, target, options, notify, macros, silent)
|
||||||
self.cc += ["-D__ASSERT_MSG"]
|
self.cc += ["-D__ASSERT_MSG"]
|
||||||
self.cppc += ["-D__ASSERT_MSG"]
|
self.cppc += ["-D__ASSERT_MSG"]
|
||||||
self.ld.append("--libpath=%s" % ARM_LIB)
|
self.ld.append("--libpath=%s" % ARM_LIB)
|
||||||
|
@ -157,8 +157,8 @@ class ARM_STD(ARM):
|
||||||
class ARM_MICRO(ARM):
|
class ARM_MICRO(ARM):
|
||||||
PATCHED_LIBRARY = False
|
PATCHED_LIBRARY = False
|
||||||
|
|
||||||
def __init__(self, target, options=None, notify=None, macros=None):
|
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
|
||||||
ARM.__init__(self, target, options, notify, macros)
|
ARM.__init__(self, target, options, notify, macros, silent)
|
||||||
|
|
||||||
# Compiler
|
# Compiler
|
||||||
self.asm += ["-D__MICROLIB"]
|
self.asm += ["-D__MICROLIB"]
|
||||||
|
|
|
@ -30,8 +30,8 @@ class GCC(mbedToolchain):
|
||||||
CIRCULAR_DEPENDENCIES = True
|
CIRCULAR_DEPENDENCIES = True
|
||||||
DIAGNOSTIC_PATTERN = re.compile('((?P<line>\d+):)(\d+:)? (?P<severity>warning|error): (?P<message>.+)')
|
DIAGNOSTIC_PATTERN = re.compile('((?P<line>\d+):)(\d+:)? (?P<severity>warning|error): (?P<message>.+)')
|
||||||
|
|
||||||
def __init__(self, target, options=None, notify=None, macros=None, tool_path=""):
|
def __init__(self, target, options=None, notify=None, macros=None, silent=False, tool_path=""):
|
||||||
mbedToolchain.__init__(self, target, options, notify, macros)
|
mbedToolchain.__init__(self, target, options, notify, macros, silent)
|
||||||
|
|
||||||
if target.core == "Cortex-M0+":
|
if target.core == "Cortex-M0+":
|
||||||
cpu = "cortex-m0"
|
cpu = "cortex-m0"
|
||||||
|
@ -170,8 +170,8 @@ class GCC(mbedToolchain):
|
||||||
|
|
||||||
|
|
||||||
class GCC_ARM(GCC):
|
class GCC_ARM(GCC):
|
||||||
def __init__(self, target, options=None, notify=None, macros=None):
|
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
|
||||||
GCC.__init__(self, target, options, notify, macros, GCC_ARM_PATH)
|
GCC.__init__(self, target, options, notify, macros, silent, GCC_ARM_PATH)
|
||||||
|
|
||||||
# Use latest gcc nanolib
|
# Use latest gcc nanolib
|
||||||
self.ld.append("--specs=nano.specs")
|
self.ld.append("--specs=nano.specs")
|
||||||
|
@ -182,8 +182,8 @@ class GCC_ARM(GCC):
|
||||||
|
|
||||||
|
|
||||||
class GCC_CR(GCC):
|
class GCC_CR(GCC):
|
||||||
def __init__(self, target, options=None, notify=None, macros=None):
|
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
|
||||||
GCC.__init__(self, target, options, notify, macros, GCC_CR_PATH)
|
GCC.__init__(self, target, options, notify, macros, silent, GCC_CR_PATH)
|
||||||
|
|
||||||
additional_compiler_flags = [
|
additional_compiler_flags = [
|
||||||
"-D__NEWLIB__", "-D__CODE_RED", "-D__USE_CMSIS", "-DCPP_USE_HEAP",
|
"-D__NEWLIB__", "-D__CODE_RED", "-D__USE_CMSIS", "-DCPP_USE_HEAP",
|
||||||
|
@ -199,8 +199,8 @@ class GCC_CR(GCC):
|
||||||
|
|
||||||
|
|
||||||
class GCC_CS(GCC):
|
class GCC_CS(GCC):
|
||||||
def __init__(self, target, options=None, notify=None, macros=None):
|
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
|
||||||
GCC.__init__(self, target, options, notify, macros, GCC_CS_PATH)
|
GCC.__init__(self, target, options, notify, macros, silent, GCC_CS_PATH)
|
||||||
|
|
||||||
|
|
||||||
class GCC_CW(GCC):
|
class GCC_CW(GCC):
|
||||||
|
@ -208,13 +208,13 @@ class GCC_CW(GCC):
|
||||||
"Cortex-M0+": "armv6-m",
|
"Cortex-M0+": "armv6-m",
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, target, options=None, notify=None, macros=None):
|
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
|
||||||
GCC.__init__(self, target, options, notify, macros, CW_GCC_PATH)
|
GCC.__init__(self, target, options, notify, macros, silent, CW_GCC_PATH)
|
||||||
|
|
||||||
|
|
||||||
class GCC_CW_EWL(GCC_CW):
|
class GCC_CW_EWL(GCC_CW):
|
||||||
def __init__(self, target, options=None, notify=None, macros=None):
|
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
|
||||||
GCC_CW.__init__(self, target, options, notify, macros)
|
GCC_CW.__init__(self, target, options, notify, macros, silent)
|
||||||
|
|
||||||
# Compiler
|
# Compiler
|
||||||
common = [
|
common = [
|
||||||
|
@ -242,5 +242,5 @@ class GCC_CW_EWL(GCC_CW):
|
||||||
|
|
||||||
|
|
||||||
class GCC_CW_NEWLIB(GCC_CW):
|
class GCC_CW_NEWLIB(GCC_CW):
|
||||||
def __init__(self, target, options=None, notify=None, macros=None):
|
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
|
||||||
GCC_CW.__init__(self, target, options, notify, macros)
|
GCC_CW.__init__(self, target, options, notify, macros, silent)
|
||||||
|
|
|
@ -30,8 +30,8 @@ class IAR(mbedToolchain):
|
||||||
|
|
||||||
DIAGNOSTIC_PATTERN = re.compile('"(?P<file>[^"]+)",(?P<line>[\d]+)\s+(?P<severity>Warning|Error)(?P<message>.+)')
|
DIAGNOSTIC_PATTERN = re.compile('"(?P<file>[^"]+)",(?P<line>[\d]+)\s+(?P<severity>Warning|Error)(?P<message>.+)')
|
||||||
|
|
||||||
def __init__(self, target, options=None, notify=None, macros=None):
|
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
|
||||||
mbedToolchain.__init__(self, target, options, notify, macros)
|
mbedToolchain.__init__(self, target, options, notify, macros, silent)
|
||||||
|
|
||||||
c_flags = [
|
c_flags = [
|
||||||
"--cpu=%s" % target.core, "--thumb",
|
"--cpu=%s" % target.core, "--thumb",
|
||||||
|
|
Loading…
Reference in New Issue