mirror of https://github.com/ARMmbed/mbed-os.git
Added scanning for JSON files in the resource scanner
Also added a method to add new macros to the toolchain instance. Both of these changes are needed by the configuration mechanism.
parent
83b5b474a0
commit
031cc7fbc5
|
@ -34,7 +34,6 @@ import tools.hooks as hooks
|
||||||
from hashlib import md5
|
from hashlib import md5
|
||||||
import fnmatch
|
import fnmatch
|
||||||
|
|
||||||
|
|
||||||
#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
|
||||||
|
|
||||||
|
@ -55,6 +54,7 @@ def compile_worker(job):
|
||||||
'results': results
|
'results': results
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class Resources:
|
class Resources:
|
||||||
def __init__(self, base_path=None):
|
def __init__(self, base_path=None):
|
||||||
self.base_path = base_path
|
self.base_path = base_path
|
||||||
|
@ -82,6 +82,7 @@ class Resources:
|
||||||
# Other files
|
# Other files
|
||||||
self.hex_files = []
|
self.hex_files = []
|
||||||
self.bin_files = []
|
self.bin_files = []
|
||||||
|
self.json_files = []
|
||||||
|
|
||||||
def __add__(self, resources):
|
def __add__(self, resources):
|
||||||
if resources is None:
|
if resources is None:
|
||||||
|
@ -118,12 +119,15 @@ class Resources:
|
||||||
|
|
||||||
self.hex_files += resources.hex_files
|
self.hex_files += resources.hex_files
|
||||||
self.bin_files += resources.bin_files
|
self.bin_files += resources.bin_files
|
||||||
|
self.json_files += resources.json_files
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def relative_to(self, base, dot=False):
|
def relative_to(self, base, dot=False):
|
||||||
for field in ['inc_dirs', 'headers', 's_sources', 'c_sources',
|
for field in ['inc_dirs', 'headers', 's_sources', 'c_sources',
|
||||||
'cpp_sources', 'lib_dirs', 'objects', 'libraries',
|
'cpp_sources', 'lib_dirs', 'objects', 'libraries',
|
||||||
'lib_builds', 'lib_refs', 'repo_dirs', 'repo_files', 'hex_files', 'bin_files']:
|
'lib_builds', 'lib_refs', 'repo_dirs', 'repo_files',
|
||||||
|
'hex_files', 'bin_files', 'json_files']:
|
||||||
v = [rel_path(f, base, dot) for f in getattr(self, field)]
|
v = [rel_path(f, base, dot) for f in getattr(self, field)]
|
||||||
setattr(self, field, v)
|
setattr(self, field, v)
|
||||||
if self.linker_script is not None:
|
if self.linker_script is not None:
|
||||||
|
@ -132,7 +136,8 @@ class Resources:
|
||||||
def win_to_unix(self):
|
def win_to_unix(self):
|
||||||
for field in ['inc_dirs', 'headers', 's_sources', 'c_sources',
|
for field in ['inc_dirs', 'headers', 's_sources', 'c_sources',
|
||||||
'cpp_sources', 'lib_dirs', 'objects', 'libraries',
|
'cpp_sources', 'lib_dirs', 'objects', 'libraries',
|
||||||
'lib_builds', 'lib_refs', 'repo_dirs', 'repo_files', 'hex_files', 'bin_files']:
|
'lib_builds', 'lib_refs', 'repo_dirs', 'repo_files',
|
||||||
|
'hex_files', 'bin_files', 'json_files']:
|
||||||
v = [f.replace('\\', '/') for f in getattr(self, field)]
|
v = [f.replace('\\', '/') for f in getattr(self, field)]
|
||||||
setattr(self, field, v)
|
setattr(self, field, v)
|
||||||
if self.linker_script is not None:
|
if self.linker_script is not None:
|
||||||
|
@ -164,7 +169,6 @@ class Resources:
|
||||||
|
|
||||||
return '\n'.join(s)
|
return '\n'.join(s)
|
||||||
|
|
||||||
|
|
||||||
# Support legacy build conventions: the original mbed build system did not have
|
# Support legacy build conventions: the original mbed build system did not have
|
||||||
# standard labels for the "TARGET_" and "TOOLCHAIN_" specific directories, but
|
# standard labels for the "TARGET_" and "TOOLCHAIN_" specific directories, but
|
||||||
# had the knowledge of a list of these directories to be ignored.
|
# had the knowledge of a list of these directories to be ignored.
|
||||||
|
@ -329,6 +333,10 @@ class mbedToolchain:
|
||||||
|
|
||||||
return list(set(self.symbols)) # Return only unique symbols
|
return list(set(self.symbols)) # Return only unique symbols
|
||||||
|
|
||||||
|
# Extend the internal list of macros
|
||||||
|
def add_macros(self, new_macros):
|
||||||
|
self.macros.extend(new_macros)
|
||||||
|
|
||||||
def get_labels(self):
|
def get_labels(self):
|
||||||
if self.labels is None:
|
if self.labels is None:
|
||||||
toolchain_labels = [c.__name__ for c in getmro(self.__class__)]
|
toolchain_labels = [c.__name__ for c in getmro(self.__class__)]
|
||||||
|
@ -472,6 +480,9 @@ class mbedToolchain:
|
||||||
elif ext == '.bin':
|
elif ext == '.bin':
|
||||||
resources.bin_files.append(file_path)
|
resources.bin_files.append(file_path)
|
||||||
|
|
||||||
|
elif ext == '.json':
|
||||||
|
resources.json_files.append(file_path)
|
||||||
|
|
||||||
return resources
|
return resources
|
||||||
|
|
||||||
def scan_repository(self, path):
|
def scan_repository(self, path):
|
||||||
|
|
Loading…
Reference in New Issue