mirror of https://github.com/ARMmbed/mbed-os.git
parent
fb5c4a6381
commit
e835c48cc8
|
@ -210,7 +210,6 @@ LEGACY_TOOLCHAIN_NAMES = {
|
|||
|
||||
class mbedToolchain:
|
||||
VERBOSE = True
|
||||
ignore_ptrs = []
|
||||
|
||||
CORTEX_SYMBOLS = {
|
||||
"Cortex-M0" : ["__CORTEX_M0", "ARM_MATH_CM0", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"],
|
||||
|
@ -230,12 +229,54 @@ class mbedToolchain:
|
|||
def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False):
|
||||
self.target = target
|
||||
self.name = self.__class__.__name__
|
||||
self.hook = hooks.Hook(target, self)
|
||||
self.silent = silent
|
||||
self.output = ""
|
||||
|
||||
# compile/assemble/link/binary hooks
|
||||
self.hook = hooks.Hook(target, self)
|
||||
|
||||
# Build options passed by -o flag
|
||||
self.options = options if options is not None else []
|
||||
self.options.extend(BUILD_OPTIONS)
|
||||
if self.options:
|
||||
self.info("Build Options: %s" % (', '.join(self.options)))
|
||||
|
||||
# Toolchain flags
|
||||
self.flags = deepcopy(self.DEFAULT_FLAGS)
|
||||
|
||||
# User-defined macros
|
||||
self.macros = macros or []
|
||||
|
||||
# Macros generated from toolchain and target rules/features
|
||||
self.symbols = None
|
||||
|
||||
# Labels generated from toolchain and target rules/features (used for selective build)
|
||||
self.labels = None
|
||||
|
||||
self.has_config = False
|
||||
# config_header_content will hold the content of the config header (if used)
|
||||
self.config_header_content = None
|
||||
|
||||
# Non-incremental compile
|
||||
self.build_all = False
|
||||
|
||||
# Build output dir
|
||||
self.build_dir = None
|
||||
self.timestamp = time()
|
||||
|
||||
# Output build naming based on target+toolchain combo (mbed 2.0 builds)
|
||||
self.obj_path = join("TARGET_"+target.name, "TOOLCHAIN_"+self.name)
|
||||
|
||||
# Number of concurrent build jobs. 0 means auto (based on host system cores)
|
||||
self.jobs = 0
|
||||
|
||||
self.CHROOT = None
|
||||
|
||||
# Ignore patterns from .mbedignore files
|
||||
self.ignore_patterns = []
|
||||
|
||||
# Pre-mbed 2.0 ignore dirs
|
||||
self.legacy_ignore_dirs = LEGACY_IGNORE_DIRS - set([target.name, LEGACY_TOOLCHAIN_NAMES[self.name]])
|
||||
|
||||
# Output notify function
|
||||
if notify:
|
||||
self.notify_fun = notify
|
||||
elif extra_verbose:
|
||||
|
@ -243,36 +284,16 @@ class mbedToolchain:
|
|||
else:
|
||||
self.notify_fun = self.print_notify
|
||||
|
||||
self.options = options if options is not None else []
|
||||
# Silent builds (no output)
|
||||
self.silent = silent
|
||||
|
||||
self.macros = macros or []
|
||||
self.options.extend(BUILD_OPTIONS)
|
||||
if self.options:
|
||||
self.info("Build Options: %s" % (', '.join(self.options)))
|
||||
|
||||
self.obj_path = join("TARGET_"+target.name, "TOOLCHAIN_"+self.name)
|
||||
|
||||
self.symbols = None
|
||||
self.labels = None
|
||||
self.has_config = False
|
||||
|
||||
self.build_all = False
|
||||
self.build_dir = None
|
||||
self.timestamp = time()
|
||||
self.jobs = 1
|
||||
|
||||
self.CHROOT = None
|
||||
|
||||
self.mp_pool = None
|
||||
# Print output buffer
|
||||
self.output = ""
|
||||
|
||||
# uVisor spepcific rules
|
||||
if 'UVISOR' in self.target.features and 'UVISOR_SUPPORTED' in self.target.extra_labels:
|
||||
self.target.core = re.sub(r"F$", '', self.target.core)
|
||||
|
||||
self.flags = deepcopy(self.DEFAULT_FLAGS)
|
||||
|
||||
# config_header_content will hold the content of the config header (if used)
|
||||
self.config_header_content = None
|
||||
|
||||
def get_output(self):
|
||||
return self.output
|
||||
|
||||
|
@ -325,10 +346,6 @@ class mbedToolchain:
|
|||
"""
|
||||
return self.notify_fun(event, self.silent)
|
||||
|
||||
def __exit__(self):
|
||||
if self.mp_pool is not None:
|
||||
self.mp_pool.terminate()
|
||||
|
||||
def goanna_parse_line(self, line):
|
||||
if "analyze" in self.options:
|
||||
return self.GOANNA_DIAGNOSTIC_PATTERN.match(line)
|
||||
|
@ -407,7 +424,7 @@ class mbedToolchain:
|
|||
return False
|
||||
|
||||
def is_ignored(self, file_path):
|
||||
for pattern in self.ignore_ptrs:
|
||||
for pattern in self.ignore_patterns:
|
||||
if fnmatch.fnmatch(file_path, pattern):
|
||||
return True
|
||||
return False
|
||||
|
@ -441,8 +458,8 @@ class mbedToolchain:
|
|||
lines = [l.strip() for l in lines] # Strip whitespaces
|
||||
lines = [l for l in lines if l != ""] # Strip empty lines
|
||||
lines = [l for l in lines if not re.match("^#",l)] # Strip comment lines
|
||||
# Append root path to glob patterns and append patterns to ignore_ptrs
|
||||
self.ignore_ptrs.extend([join(root,line.strip()) for line in lines])
|
||||
# Append root path to glob patterns and append patterns to ignore_patterns
|
||||
self.ignore_patterns.extend([join(root,line.strip()) for line in lines])
|
||||
|
||||
for d in copy(dirs):
|
||||
dir_path = join(root, d)
|
||||
|
|
Loading…
Reference in New Issue