mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			Make ArmPackManager cache a static variable (to avoid reading index.json for each target).
							parent
							
								
									b9bac0516b
								
							
						
					
					
						commit
						d8fc362c11
					
				| 
						 | 
					@ -30,6 +30,7 @@ class DeviceCMSIS():
 | 
				
			||||||
    """CMSIS Device class
 | 
					    """CMSIS Device class
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Encapsulates target information retrieved by arm-pack-manager"""
 | 
					    Encapsulates target information retrieved by arm-pack-manager"""
 | 
				
			||||||
 | 
					    cache = Cache(True, False)
 | 
				
			||||||
    def __init__(self, target):
 | 
					    def __init__(self, target):
 | 
				
			||||||
        target_info = self.check_supported(target)
 | 
					        target_info = self.check_supported(target)
 | 
				
			||||||
        if not target_info:
 | 
					        if not target_info:
 | 
				
			||||||
| 
						 | 
					@ -48,17 +49,16 @@ class DeviceCMSIS():
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @staticmethod
 | 
					    @staticmethod
 | 
				
			||||||
    def check_supported(target):
 | 
					    def check_supported(target):
 | 
				
			||||||
        cache = Cache(True, False)
 | 
					 | 
				
			||||||
        t = TARGET_MAP[target]
 | 
					        t = TARGET_MAP[target]
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            cpu_name = t.device_name
 | 
					            cpu_name = t.device_name
 | 
				
			||||||
            target_info = cache.index[cpu_name]
 | 
					            target_info = DeviceCMSIS.cache.index[cpu_name]
 | 
				
			||||||
        # Target does not have device name or pdsc file
 | 
					        # Target does not have device name or pdsc file
 | 
				
			||||||
        except:
 | 
					        except:
 | 
				
			||||||
            try:
 | 
					            try:
 | 
				
			||||||
                # Try to find the core as a generic CMSIS target
 | 
					                # Try to find the core as a generic CMSIS target
 | 
				
			||||||
                cpu_name = DeviceCMSIS.cpu_cmsis(t.core)
 | 
					                cpu_name = DeviceCMSIS.cpu_cmsis(t.core)
 | 
				
			||||||
                target_info = cache.index[cpu_name]
 | 
					                target_info = DeviceCMSIS.index[cpu_name]
 | 
				
			||||||
            except:
 | 
					            except:
 | 
				
			||||||
                return False
 | 
					                return False
 | 
				
			||||||
        target_info["_cpu_name"] = cpu_name
 | 
					        target_info["_cpu_name"] = cpu_name
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -234,7 +234,7 @@ def main():
 | 
				
			||||||
        # Export to selected toolchain
 | 
					        # Export to selected toolchain
 | 
				
			||||||
    exporter, toolchain_name = get_exporter_toolchain(options.ide)
 | 
					    exporter, toolchain_name = get_exporter_toolchain(options.ide)
 | 
				
			||||||
    if options.mcu not in exporter.TARGETS:
 | 
					    if options.mcu not in exporter.TARGETS:
 | 
				
			||||||
        args_error(parser, "%s not supported by %s")
 | 
					        args_error(parser, "%s not supported by %s"%(options.mcu,options.ide))
 | 
				
			||||||
    profile = extract_profile(parser, options, toolchain_name)
 | 
					    profile = extract_profile(parser, options, toolchain_name)
 | 
				
			||||||
    export(options.mcu, options.ide, build=options.build,
 | 
					    export(options.mcu, options.ide, build=options.build,
 | 
				
			||||||
           src=options.source_dir, macros=options.macros,
 | 
					           src=options.source_dir, macros=options.macros,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue