Comments (15)
Solution would be that on 64bit windows systems not JLinkARM.dll should be used. Please use JLink_x64.dll
The code could look something like that:
`WINDOWS32_JLINK_SDK_NAME = 'JLinkARM'
WINDOWS64_JLINK_SDK_NAME = 'JLink_x64'
if platform.architecture()[0]=='32bit':
WINDOWS_JLINK_SDK_NAME = WINDOWS32_JLINK_SDK_NAME
elif platform.architecture()[0]=='64bit':
WINDOWS_JLINK_SDK_NAME = WINDOWS64_JLINK_SDK_NAME`
from pylink.
I understood the problem. My PC is running on 64bit Win7 OS. SO I selected 64bit python version 3.6. But the JlinkARM.Dll is for 32bit. So python could not load it. I uninstalled python and installed 32bit version. Now Everything works good.! Thanks.
from pylink.
@saeugetier what I did was alter the file in pylink/library.py
and changed line 87 to:
WINDOWS_JLINK_SDK_NAME = 'JLink_x64'
As of now it is working fine, and it eliminated the OSError: [WinError 193] %1 is not a valid Win32 application
error, but I want to know if this is acceptable? I don't want it to cause problems later on.
from pylink.
Ah, interesting. This was an oversight on our part. If you want to submit a patch for this, that would be great!
from pylink.
@zamora18 yes, you can do this. But then the code will only run on a 64bit system.
from pylink.
I think @saeugetier's addition to select between 32-bit and 64-bit systems would be a good solution.
I am not sure if this error is related to my change, but I get this output:
No handlers could be found for logger "pylink.jlink"
Traceback (most recent call last):
File "C:/Users/zamora/PycharmProjects/jflash/my_flash_test.py", line 20, in <module>
jlink.connect("STM32F446RE", verbose=True)
File "C:\Users\zamora\PycharmProjects\jflash\pylink\jlink.py", line 141, in wrapper
return func(self, *args, **kwargs)
File "C:\Users\zamora\PycharmProjects\jflash\pylink\jlink.py", line 912, in connect
raise errors.JLinkException(result)
pylink.errors.JLinkException: Unspecified error.
I have been trying to trace the error, because Unspecified error
is not very clear.
The last portion of the error occurs after this call in jlink.py
:
result = self._dll.JLINKARM_Connect()
if result < 0:
raise errors.JLinkException(result)
I can't tell if it is actually looking for JLINKARM
still since I changed to JLINK_x64
? Could you help me with this? Thank you.
from pylink.
There's some documentation here around this error: http://pylink.readthedocs.io/en/latest/troubleshooting.html
It's a generic catch-all.
from pylink.
Thank you, I looked over those errors, and in my case I am attempting to connect to the target when it fails. I believe I may be "trying to connect to the target over JTAG when it only supports SWD".
However, in the documentation, it states that I need to be connected to the target before I can call swo_start()
. I double-checked the other possible diagnoses for my error and it does not seem to be any of them.
It has been difficult to diagnose because I have used the J-Link JFlash software and it connects & programs just fine (see image). One more detail to note, is that I have gotten my python script to work, but it is very seldom and sporadic. What I usually try to do is use the J-Flash utility and erase the chip multiple times, and power cycle the device over and over.
I really appreciate any help.
from pylink.
swo_start
is for using Serial-Wire Output (SWO), you don't want to use it here (unless you want to do SWO stuff as well). You want to connect over SWD:
jlink = pylink.JLink()
jlink.open()
jlink.set_tif(JLinkInterfaces.SWD)
jlink.connect('STM32F446RE')
You can then call swo_start()
to use SWO.
from pylink.
Using jlink.set_tif(pylink.JLinkInterfaces.SWD)
worked!
Thank you for your help!
from pylink.
I am setting up a new machine and am still getting this same error on 64-bit.
from pylink.
@hkpeprah This PR does fix my issue and I no longer get the OSError: [WinError 193] %1 is not a valid Win32 application
error message.
from pylink.
I am still getting this error. It seems to not be fixed :(
from pylink.
File "", line 1, in
File "c:\users\yv999fy\onedrive - ey\documents\aflac_wwhq\model results\output_total\Compare.py", line 370, in compare_care
import xlwings as xw
File "C:\Users\YV999FY\AppData\Roaming\Python\Python37\site-packages\xlwings_init_.py", line 9, in
from . import _xlwindows as xlplatform
File "C:\Users\YV999FY\AppData\Roaming\Python\Python37\site-packages\xlwings_xlwindows.py", line 25, in
from comtypes import IUnknown
File "C:\Users\YV999FY\AppData\Roaming\Python\Python37\site-packages\comtypes_init_.py", line 1176, in
class IPersist(IUnknown):
File "C:\Users\YV999FY\AppData\Roaming\Python\Python37\site-packages\comtypes_init_.py", line 1181, in IPersist
( ['out'], POINTER(GUID), 'pClassID' )),
File "C:\Users\YV999FY\AppData\Roaming\Python\Python37\site-packages\comtypes_init_.py", line 1099, in COMMETHOD
from comtypes.automation import VARIANT
File "C:\Users\YV999FY\AppData\Roaming\Python\Python37\site-packages\comtypes\automation.py", line 12, in
from comtypes import npsupport
File "C:\Users\YV999FY\AppData\Roaming\Python\Python37\site-packages\comtypes\npsupport.py", line 5, in
import numpy
File "C:\Users\YV999FY\AppData\Roaming\Python\Python37\site-packages\numpy_init_.py", line 140, in
from . import _distributor_init
File "C:\Users\YV999FY\AppData\Roaming\Python\Python37\site-packages\numpy_distributor_init.py", line 26, in
WinDLL(os.path.abspath(filename))
File "C:\Users\YV999FY\Anaconda3\lib\ctypes_init_.py", line 364, in init
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application
Can someone help with this??
from pylink.
Can someone help with this??
@jjaredrides I would open a new issue for different/new questions. That being said, the issue is likely that you're using a 32-bit Python, but 64-bit application. I would ensure you're using the 64-bit Python.
from pylink.
Related Issues (20)
- RTT Autodetect works with J-Link RTT Viewer, but for pylink I have to explicitly provide the address HOT 1
- AttributeError: module 'pylink' has no attribute 'JLink'. HOT 9
- Loading library on Aarch64 fails because pylink attempts to load 32-bit library HOT 2
- pylink.errors.JLinkFlashException: Could not write target memory when trying to flash a .hex file. HOT 1
- Error when programming or erasing Kinetis microcontrollers HOT 3
- pylink.errors.JLinkException: Could not find supported CPU HOT 24
- pylink.JLink.rtt_read blocks indefinitely when no data is available? HOT 1
- Specify JLinkScript file HOT 1
- CORESIGHT_AddAP doesn't execute HOT 6
- Can support C-JTAG HOT 14
- Unlocking STM32L0 HOT 1
- custom ResetTarget function in pylink HOT 7
- Error "Failed to perform RAMCode-sided Prepare()" Fail "JLinkFlashException: Unspecified error." HOT 2
- rtt_write only working when I have JLink RTT viewer open HOT 8
- Downloading Firmware image to Cortex Fails HOT 2
- 1.2.0: Some tests are incompatible with Python 3.12 HOT 2
- Do I need to use jlink.connect before doing jlink.rtt_start? HOT 2
- Square: Thanks For Developing pylink (Not An Issue - Just Kudos) HOT 1
- REQ: Please Add Support For: Keil JLinkEFM8.dll HOT 3
- pylink.errors.JLinkException: Unspecified error - during connect() HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pylink.