Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-sdk-tools by
Diff: toolchains/__init__.py
- Revision:
- 17:04753e1e329d
- Parent:
- 14:ee1b877e6839
- Child:
- 18:11afe2c1837e
--- a/toolchains/__init__.py Thu Jul 14 21:29:46 2016 +0100 +++ b/toolchains/__init__.py Fri Jul 15 12:33:09 2016 +0100 @@ -203,7 +203,7 @@ ]) LEGACY_TOOLCHAIN_NAMES = { 'ARM_STD':'ARM', 'ARM_MICRO': 'uARM', - 'GCC_ARM': 'GCC_ARM', 'GCC_CR': 'GCC_CS', + 'GCC_ARM': 'GCC_ARM', 'GCC_CR': 'GCC_CR', 'IAR': 'IAR', } @@ -214,13 +214,13 @@ CORTEX_SYMBOLS = { "Cortex-M0" : ["__CORTEX_M0", "ARM_MATH_CM0", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"], "Cortex-M0+": ["__CORTEX_M0PLUS", "ARM_MATH_CM0PLUS", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"], - "Cortex-M1" : ["__CORTEX_M3", "ARM_MATH_CM1"], + "Cortex-M1" : ["__CORTEX_M3", "ARM_MATH_CM1", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"], "Cortex-M3" : ["__CORTEX_M3", "ARM_MATH_CM3", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"], "Cortex-M4" : ["__CORTEX_M4", "ARM_MATH_CM4", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"], - "Cortex-M4F": ["__CORTEX_M4", "__FPU_PRESENT=1", "ARM_MATH_CM4", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"], + "Cortex-M4F" : ["__CORTEX_M4", "ARM_MATH_CM4", "__FPU_PRESENT=1", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"], "Cortex-M7" : ["__CORTEX_M7", "ARM_MATH_CM7", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"], - "Cortex-M7F" : ["__CORTEX_M7", "__FPU_PRESENT=1", "ARM_MATH_CM7", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"], - "Cortex-M7FD" : ["__CORTEX_M7", "__FPU_PRESENT=1", "ARM_MATH_CM7", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"], + "Cortex-M7F" : ["__CORTEX_M7", "ARM_MATH_CM7", "__FPU_PRESENT=1", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"], + "Cortex-M7FD" : ["__CORTEX_M7", "ARM_MATH_CM7", "__FPU_PRESENT=1", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"], "Cortex-A9" : ["__CORTEX_A9", "ARM_MATH_CA9", "__FPU_PRESENT", "__CMSIS_RTOS", "__EVAL", "__MBED_CMSIS_RTOS_CA9"], } @@ -300,6 +300,8 @@ 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.stat_cache = {} + self.init() # This allows post __init__() hooks. Do not use @@ -420,15 +422,20 @@ target_mod_time = stat(target).st_mtime for d in dependencies: - # Some objects are not provided with full path and here we do not have # information about the library paths. Safe option: assume an update - if not d or not exists(d): + if not d: return True - - if stat(d).st_mtime >= target_mod_time: - return True - + + if self.stat_cache.has_key(d): + if self.stat_cache[d] >= target_mod_time: + return True + else: + if not exists(d): return True + + self.stat_cache[d] = stat(d).st_mtime + if self.stat_cache[d] >= target_mod_time: return True + return False def is_ignored(self, file_path): @@ -594,7 +601,6 @@ return resources def copy_files(self, files_paths, trg_path, resources=None, rel_path=None): - # Handle a single file if type(files_paths) != ListType: files_paths = [files_paths] @@ -603,7 +609,7 @@ files_paths.remove(source) for source in files_paths: - if resources is not None: + if resources is not None and resources.file_basepath.has_key(source): relative_path = relpath(source, resources.file_basepath[source]) elif rel_path is not None: relative_path = relpath(source, rel_path) @@ -621,7 +627,9 @@ source_dir, name, _ = split_path(source) obj_dir = join(build_path, relpath(source_dir, base_dir)) - mkdir(obj_dir) + if obj_dir is not self.prev_dir: + self.prev_dir = obj_dir + mkdir(obj_dir) return join(obj_dir, name + '.o') def get_inc_file(self, includes): @@ -656,14 +664,12 @@ objects = [] queue = [] - prev_dir = None + work_dir = getcwd() + self.prev_dir = None # Sort compile queue for consistency files_to_compile.sort() - work_dir = getcwd() - for source in files_to_compile: - _, name, _ = split_path(source) object = self.relative_object_path(build_path, resources.file_basepath[source], source) # Queue mode (multiprocessing) @@ -709,15 +715,17 @@ results = [] for i in range(len(queue)): results.append(p.apply_async(compile_worker, [queue[i]])) + p.close() itr = 0 - while True: + while len(results): itr += 1 if itr > 180000: p.terminate() p.join() raise ToolException("Compile did not finish in 5 minutes") + sleep(0.01) pending = 0 for r in results: if r._ready is True: @@ -741,17 +749,10 @@ raise ToolException(err) else: pending += 1 - if pending > jobs_count: + if pending >= jobs_count: break - - if len(results) == 0: - break - - sleep(0.01) - results = None - p.terminate() p.join() return objects