From d8fc362c1157adfd163dea7d0f3f21cec113b207 Mon Sep 17 00:00:00 2001 From: Sarah Marsh Date: Mon, 31 Oct 2016 17:42:36 -0500 Subject: [PATCH] Make ArmPackManager cache a static variable (to avoid reading index.json for each target). --- tools/export/cmsis/__init__.py | 6 +++--- tools/project.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/export/cmsis/__init__.py b/tools/export/cmsis/__init__.py index 68aff56a66..48d526ca9e 100644 --- a/tools/export/cmsis/__init__.py +++ b/tools/export/cmsis/__init__.py @@ -30,6 +30,7 @@ class DeviceCMSIS(): """CMSIS Device class Encapsulates target information retrieved by arm-pack-manager""" + cache = Cache(True, False) def __init__(self, target): target_info = self.check_supported(target) if not target_info: @@ -48,17 +49,16 @@ class DeviceCMSIS(): @staticmethod def check_supported(target): - cache = Cache(True, False) t = TARGET_MAP[target] try: 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 except: try: # Try to find the core as a generic CMSIS target cpu_name = DeviceCMSIS.cpu_cmsis(t.core) - target_info = cache.index[cpu_name] + target_info = DeviceCMSIS.index[cpu_name] except: return False target_info["_cpu_name"] = cpu_name diff --git a/tools/project.py b/tools/project.py index d79ba034b5..372948d877 100644 --- a/tools/project.py +++ b/tools/project.py @@ -234,7 +234,7 @@ def main(): # Export to selected toolchain exporter, toolchain_name = get_exporter_toolchain(options.ide) 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) export(options.mcu, options.ide, build=options.build, src=options.source_dir, macros=options.macros,