Closed gw826943555 closed 4 weeks ago
PyLink does not support the scripts. The scripts are essentially commands / function calls. You will need to translate your scripts into the appropriate function calls.
@hkpeprah -JLinkScriptFile does not specify a sequence of command function calls. You're getting confused with the -CommanderScript option.
JLinkScriptFile is a C-like syntax that allows you to customise internal actions, most notably what happens on a device reset to allow for hardware-specific requirements that cannot be easily dealt with through the standard J-Link API. See https://wiki.segger.com/J-Link_script_files for more details.
I agree that supporting JLinkScriptFiles would be a really useful feature add for the module, as their lack limits what can be done with the module.
EDIT: after thinking about it a bit further, I guess the script files are probably parsed by jlink.exe rather than the DLL itself, so maybe there is a way to implement equivalent actions directly using pylink.
My mistake. Thanks for the correct @gtowers-dukosi. From reading over that link, it seems like if you put the script in the same folder as the DLL as Default.JLinkScript
, then it should just run it. I think it should be possible we can automate this process, and take a script file in the .open()
command as an optional parameter, then copy it to the path with the DLL. Do you think that would work for your use case?
The DLL is normally somewhere in "C:\Program Files (x86)\", which on most machines needs admin privileges for an application to write to, so that's probably not going to work - but I like your thinking. Thanks for reading up, I'd missed that section on the page - very interesting to know that it's parsed by the .dll rather than the .exe. That suggests there must be another way to somehow specify a custom filepath directly to the DLL.
By default, we copy the library file to a separate temporary folder (unless you specify otherwise). So we should be able to write the Default
script into that folder, and delete it when we clean-up the temporary library file as well.
Sounds like it might just work then! I think it would meet my requirements in any case. Thanks again
I found a better solution! This does exactly what I need:
jlink.exec_command("scriptfile = C:\\path\\to\\myJlinkScript.JLinkScript")
Technically no pylink upfates even needed for pylink, but since it's not at all obvious I think a pylink wrapper function for that command would be a nice feature.
Nice! That is much simpler. If you want to submit a patch for the new function, I can accept it. Something like set_script()
?
This is now available via set_script_file()
in v1.3.0
thanks to @gtowers-dukosi!
Hi,
I am now trying to connect a dual-core cortex-r5. We use
-JLinkScriptFile
command to specify the JLinkScript file and connect the core I'd like to connect.JLink.exe -JLinkScriptFile xxx_path\R5_ConnectCore0.JLinkScript
JLink.exe -JLinkScriptFile xxx_path\R5_ConnectCore1.JLinkScript
It works fine.My question is whether pylink support this feature.
Thanks!