Giter Club home page Giter Club logo

Comments (17)

freyc avatar freyc commented on August 23, 2024 5

By the way, another solution seems to be calling exec_command with the J-Link Commandstring JLinkDevicesXMLPath (inspired by this link):

jlink = pylink.JLink()
jlink.open()
jlink.exec_command('JLinkDevicesXMLPath /opt/SEGGER/JLink/JLinkDevices.xml')

With this solution, you can even provide your own device-list, without having to change the one from the original installation.

from pylink.

hkpeprah avatar hkpeprah commented on August 23, 2024

Hm, the number should be same if the Window pops up. What do you mean by cannot pass in chip_name?

Are you sure that's the correct chip name? Doing a Google search leads me to few results, one being this Kinetis document, and this thread, which points to this page: https://wiki.segger.com/IMX_Series_Devices

from pylink.

rcaproni avatar rcaproni commented on August 23, 2024

At the image I posted you can see what happens when I use chip_name="MCIMX7U5_M4". The Target Device Settings selection menu opens, as it not recognize MCIMX7U5_M4 as a valid chip name. The same occurs when I leave chip_name with the default value (jlink.connect(verbose=True))
Using Jlink.exe, I do not have this problem:

jlink -device MCIMX7U5_M4 -speed 1000 -JTAGConf -1,-1
SEGGER J-Link Commander V6.32a (Compiled Apr 30 2018 15:45:20)
DLL version V6.32a, compiled Apr 30 2018 15:44:54

Connecting to J-Link via USB...O.K.
Firmware: J-Link ARM V8 compiled Nov 28 2014 13:44:46
Hardware version: V8.00
S/N: ************
OEM: IAR
VTref=3.144V

Type "connect" to establish a target connection, '?' for help
J-Link>con
Device "MCIMX7U3_M4" selected.


Connecting to target via JTAG
***************************************************
J-Link script: iMX7ULP Cortex-M4 core J-Link script
***************************************************
TotalIRLen = 4, IRPrint = 0x01
***************************************************
J-Link script: iMX7ULP Cortex-M4 core J-Link script
***************************************************
TotalIRLen = 4, IRPrint = 0x01
JTAG chain detection found 1 devices:
 #0 Id: 0x6BA00477, IRLen: 04, CoreSight JTAG-DP
AP map detection skipped. Manually configured AP map found.
...
CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
Found Cortex-M4 r0p1, Little endian.
FPUnit: 6 code (BP) slots and 2 literal slots
CoreSight components:
...
Disabling Cortex-M4 MPU ...
Cortex-M4 identified.

from pylink.

hkpeprah avatar hkpeprah commented on August 23, 2024

Have you tried passing in device_name=iMX7ULP? There may be some internal logic present that is doing the mapping from MCIMX7U3_M4 to iMX7ULP.

from pylink.

rcaproni avatar rcaproni commented on August 23, 2024

Not work too. IMX7ULP is not recognized as valid chip_name.
There is a significant difference between the devices available in the list when you are using Jlink and when using pylink. Maybe is related with the loading of the DLL library? I forgot to mention that my machine is 64 bits.

This is the Jlink list:
x7_ok

This is the pylink list:
x7_nok

from pylink.

hkpeprah avatar hkpeprah commented on August 23, 2024

I would take a look at this issue, as it could be a 32-bit vs 64-bit issue. I'm not entirely sure what's going on here.

from pylink.

ChaoticEnigma avatar ChaoticEnigma commented on August 23, 2024

I am struggling with a similar issue on Linux. I have added entries for an ARM MCU to JLinkDevices.xml in /opt/SEGGER/JLink, and written a flash loader for this device, for use with JLinkExe (J-Link Commander). This works great, however, pylink does not recognize the new device entries. Clearly, pylink (or the JLink library) is not loading the same file.

My understanding is that the JLink library reads supported devices from a JLinkDevices.xml. I have four of these files and coresponding Devices directories containing various flash loaders, between JLinkExe, Ozone, and SEGGER Embedded Studio. They are in:

/opt/SEGGER/JLink/
/opt/SEGGER/JLink/JLink_Linux_V632g_x86_64/
/opt/SEGGER/Ozone/Lib/
/opt/SEGGER/segger_embedded_studio_for_arm_3.34a/bin/

pylink loads libjlinkarm from /opt/SEGGER/JLink/libjlinkarm.so

Even after replacing each JLinkDevices.xml with

<DataBase>

  <Device>
   <ChipInfo Vendor="Holtek" Name="HT32F1654" Core="JLINK_CORE_CORTEX_M3" WorkRAMAddr="0x20000000" WorkRAMSize="0x00004000" />
   <FlashBankInfo Name="Internal Flash" BaseAddr="0x00000000" MaxSize="0x0000FC00" Loader="Devices/Holtek/FlashLoader_HT32F1654.elf" LoaderType="FLASH_ALGO_TYPE_OPEN" AlwaysPresent="1" />
  </Device>
  <Device>
   <ChipInfo Vendor="Holtek" Name="HT32F1655" Core="JLINK_CORE_CORTEX_M3" WorkRAMAddr="0x20000000" WorkRAMSize="0x00008000" />
   <FlashBankInfo Name="Internal Flash" BaseAddr="0x00000000" MaxSize="0x00020000" Loader="Devices/Holtek/FlashLoader_HT32F1655.elf" LoaderType="FLASH_ALGO_TYPE_OPEN" AlwaysPresent="1" />
  </Device> 

</DataBase>

which JLinkExe works fine with, in pylink, jlink.num_supported_devices() is still >6000.

So where in the world is libjlinkarm getting its device list from? Does pylink have its own list, or is it built in to libjlinkarm?

Any suggestions are appreciated.

from pylink.

hkpeprah avatar hkpeprah commented on August 23, 2024

Hm, from a cursory examination, it seems to be baked into the .so file. I'm not sure if there is a way to dynamically add a new device definition (as I've never looked into it), but this definitely seems like a good feature. I'll investigate a bit more when I have some free time, and see if it's possible.

from pylink.

djgood avatar djgood commented on August 23, 2024

I ran into a similar issue recently. My RSL10 device was failing to download a .hex file to flash memory using JLink.flash_file(). To flash the RSL10, it requires some information and code in the Devices folder which is normally in the same directory as the DLL files. I think it was not working because the DLL is being copied to a temporary location and then loaded, meaning the Devices folder cannot be found, since they are no longer in the same directory. I was able to fix the issue by loading the original DLL instead of the temporary one in the Library.load() function. I hope this helps anyone facing the same issue!

from pylink.

hkpeprah avatar hkpeprah commented on August 23, 2024

@djgood Ah, that's interesting. If you copy the XML file alongside the DLL, does it work? If so, we might be able to add support for copying the XML file / directory, then methods for adding new devices programmatically.

from pylink.

djgood avatar djgood commented on August 23, 2024

I just tried it, and yes, it works if I copy the XML and directory to my temp folder.

from pylink.

tianxiaoMCU avatar tianxiaoMCU commented on August 23, 2024

JLink.exe can export the DLL internal device list, how to do this by pylink

image

from pylink.

bigbrett avatar bigbrett commented on August 23, 2024

I'm seeing this issue on my end too. Having to pass a path makes writing cross platform code difficult. Any idea why the installed JLinkDevices.xml isn't being honored?

from pylink.

sergio-soar-es avatar sergio-soar-es commented on August 23, 2024

I also faced this issue before I discovered this thread.

In my case, I found a workaround by modifying the tempdir. Pylink creates the dll in a temporary folder. So, if you just set tempfile.tempdir to your JLink installation path, it works because the temporary dll created by Pylink will be in the same directory of the JLinkDevices.xml.

This is probably not the cleanest workaround, especially because you will need permission to write on the JLink installation directory but it may be useful for some people.

from pylink.

pratimshah111 avatar pratimshah111 commented on August 23, 2024

Could someone please post the solution here in terms of how to change the temp location to fixed location in Library.load() function? I tried but didn't quite correctly work for me.
I changed it to following:
self._lib = ctypes.cdll.LoadLibrary(self._path)

Now I can see my device in the list but after connecting to that device, it gives 7676 and when I query jlink.target_connected(), it gives false. So, not sure what is wrong

from pylink.

oszalex avatar oszalex commented on August 23, 2024

I had the same issue, that the chip name was not accepted as a valid device. For me the solution was to set the the target interface to SWD after opening the jlink.
jlink.open(serno)
jlink.set_tif(pylink.enums.JLinkInterfaces.SWD)

from pylink.

kettenbach-it avatar kettenbach-it commented on August 23, 2024

By the way, another solution seems to be calling exec_command with the J-Link Commandstring JLinkDevicesXMLPath (inspired by this link):

jlink = pylink.JLink()
jlink.open()
jlink.exec_command('JLinkDevicesXMLPath /opt/SEGGER/JLink/JLinkDevices.xml')

With this solution, you can even provide your own device-list, without having to change the one from the original installation.

This works for me!

from pylink.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.