Skip to content

Conversation

@bbrown1867
Copy link
Contributor

Instead of defaulting this value to True, this change changes pylink to dynamically determine based on DLL version.

Closes #32 and #134.

@bbrown1867 bbrown1867 requested a review from hkpeprah February 12, 2025 22:27
@bbrown1867 bbrown1867 self-assigned this Feb 12, 2025
@CLAassistant
Copy link

CLAassistant commented Feb 12, 2025

CLA assistant check
All committers have signed the CLA.

@bbrown1867 bbrown1867 force-pushed the bbrown1867/disable-tmpcpy-by-default branch from 3c3fd42 to 59b98e2 Compare February 12, 2025 22:28
Copy link
Contributor

@hkpeprah hkpeprah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@bbrown1867 bbrown1867 merged commit 3d63d10 into master Feb 19, 2025
5 checks passed
@bbrown1867 bbrown1867 deleted the bbrown1867/disable-tmpcpy-by-default branch February 19, 2025 15:50
@mtnpke
Copy link
Contributor

mtnpke commented May 8, 2025

This broke debugging with multiple targets, as the new default only allows one target and is thus backwards-incompatible. Even worse, if you open multiple JLink instances, it will just silently reuse the same DLL instance and thus the same target, resulting in all sorts of weird and hard-to-debug errors. It's also not clear from the documentation that you have to set this if you want multi-target. All in all: Are you sure this is a good idea?

@hkpeprah
Copy link
Contributor

hkpeprah commented May 8, 2025

@mtnpke Could you post the error you are seeing? The newer DLL / DYLIBs should support multi-target debugging / multiple instances.

@mtnpke
Copy link
Contributor

mtnpke commented May 9, 2025

@hkpeprah There is no error in the sense that I could post one specific message. If you open two connections, the DLL calls of the second will just "overwrite" the state of the first connection. So if you connect two J-Links, after opening the second connection, you would not be able to control the first target any more (or the second depending on your exact connection flow, e.g. if you check for an open connection).

Why do you think the newer DLL should be multi-target capable? The API has not changed and it does not have a "handle" parameter for selecting a connected target, so it is already impossible to do this on the API level 🤔 Besides, the guidance in UM08002 has not changed and still says (as of 8.32) that parallel connections are not natively supported.

@hkpeprah
Copy link
Contributor

hkpeprah commented May 9, 2025

In earlier DLL, there was a global "lock" that prevented simultaneous access to the DLL. The temporary copy was a workaround for the global "lock", and we implemented our own lock around the specific physical device. Later that global lock was removed. I naively assumed that was the thing preventing parallel connections, but it seems like that's not the case.

I agree with you that we broke things here and need to come up with a solution that copies not only the DLL, but also the necessary additional metadata spattered around .xml files.

@mtnpke
Copy link
Contributor

mtnpke commented May 12, 2025

Ah OK, I was not aware of this earlier limitation on Linux and Mac OS; however, it is how you already said just a piece of the puzzle and not the root of the limitation (also, from what I can tell this never affected Windows).

I don't know if you have access to UM08002 (you can find some old but sufficiently recent versions in the WWW), but it specifically recommends to either copy the DLL or have separate processes dealing with multiple connections as workarounds. It does not say anything about the additional metadata. The example for DLL copies is Windows-only and copies the DLL inside its original directory, which really only makes sense if you ship the DLL yourself alongside the .exe and only ever run one instance of your app. Otherwise you're bound to have access rights and concurrent access issues.

IMO, going back to the old behavior of having the temporary copy be the default would already be a big improvement over the status quo. Alternatively, globally keeping track of whether a pylink.JLink instance is in a connected state and raising an exception if a user tries to open a second connection (without temporary copy) would alleviate the pain insofar that you'll be saved some unnecessary debugging hours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Device list different from Jlink.exe

5 participants