Skip to content

Commit d8fc362

Browse files
committed
Make ArmPackManager cache a static variable (to avoid reading index.json for each target).
1 parent b9bac05 commit d8fc362

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

tools/export/cmsis/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class DeviceCMSIS():
3030
"""CMSIS Device class
3131
3232
Encapsulates target information retrieved by arm-pack-manager"""
33+
cache = Cache(True, False)
3334
def __init__(self, target):
3435
target_info = self.check_supported(target)
3536
if not target_info:
@@ -48,17 +49,16 @@ def __init__(self, target):
4849

4950
@staticmethod
5051
def check_supported(target):
51-
cache = Cache(True, False)
5252
t = TARGET_MAP[target]
5353
try:
5454
cpu_name = t.device_name
55-
target_info = cache.index[cpu_name]
55+
target_info = DeviceCMSIS.cache.index[cpu_name]
5656
# Target does not have device name or pdsc file
5757
except:
5858
try:
5959
# Try to find the core as a generic CMSIS target
6060
cpu_name = DeviceCMSIS.cpu_cmsis(t.core)
61-
target_info = cache.index[cpu_name]
61+
target_info = DeviceCMSIS.index[cpu_name]
6262
except:
6363
return False
6464
target_info["_cpu_name"] = cpu_name

tools/project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def main():
234234
# Export to selected toolchain
235235
exporter, toolchain_name = get_exporter_toolchain(options.ide)
236236
if options.mcu not in exporter.TARGETS:
237-
args_error(parser, "%s not supported by %s")
237+
args_error(parser, "%s not supported by %s"%(options.mcu,options.ide))
238238
profile = extract_profile(parser, options, toolchain_name)
239239
export(options.mcu, options.ide, build=options.build,
240240
src=options.source_dir, macros=options.macros,

0 commit comments

Comments
 (0)