diff --git a/pylink/jlink.py b/pylink/jlink.py index a51cffe..53923e7 100644 --- a/pylink/jlink.py +++ b/pylink/jlink.py @@ -47,6 +47,9 @@ class JLink(object): # so we base this number on that. Other models have 80 bytes. MAX_BUF_SIZE = 336 + # Override to false, used in targets not requiring connection + target_connection_required = True + # Maximum number of CPU registers. MAX_NUM_CPU_REGISTERS = 256 @@ -167,7 +170,7 @@ def wrapper(self, *args, **kwargs): Raises: JLinkException: if the JLink's target is not connected. """ - if not self.target_connected(): + if (not self.target_connected()) and self.target_connection_required: raise errors.JLinkException('Target is not connected.') return func(self, *args, **kwargs) return wrapper diff --git a/pylink/library.py b/pylink/library.py index 08184a2..762e3b5 100644 --- a/pylink/library.py +++ b/pylink/library.py @@ -114,12 +114,9 @@ def find_library_windows(cls): # Find all the versioned J-Link directories. ds = filter(lambda x: x.startswith('JLink'), os.listdir(dir_path)) - for jlink_dir in ds: - # The DLL always has the same name, so if it is found, just - # return it. - lib_path = os.path.join(dir_path, jlink_dir, dll) - if os.path.isfile(lib_path): - yield lib_path + lib_path = os.path.join(dir_path, ds[-1], dll) # use the latest jlink DLL (ds[-1]) + if os.path.isfile(lib_path): + yield lib_path @classmethod def find_library_linux(cls):