Using Arm Flasher with JLink commander for production equipment

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • Using Arm Flasher with JLink commander for production equipment

    Hello
    I am trying to use the SEGGER Arm Flasher for production equipment. I call Jlink commander from my test sequnce using the kernel32 function CreateProcess(). But the problem is that the Jlink commander does not return any error code which means that I cannot evaluate the result.
    Then I tried to use the Telnet protocol instead. This is better for production equipment because it returns an error code. But the Telnet protocol have really limited functions. For example I cannot read out the memory of the target device.
    Any suggestions what else I can do? Or is the SEGGER Arm Flasher not really usefull as production programmer?
  • Hi,

    But the problem is that the Jlink commander does not return any error code

    This is not true...
    Both, J-Link Commander as well as J-Flash, return error codes...

    Or is the SEGGER Arm Flasher not really usefull as production programmer?

    Of course it is...
    And the TELNET / RS232 interface provides almost everything you need for production...
    There are commands for selecting a certain image, stored on the Flasher ARM, which shall be used for programming.
    There are commands for erasing/programming/verifying the target
    so this is what you usually need in production.
    For what do you need a read memory function?
    Sounds more like debugging + testing than production, what you are doing.

    Of course, you are always free to write your own application via the J-Link SDK (segger.com/jlink-sdk.html) if you need some customized environment which does not fit into the existing solutions.


    Best regards
    Alex
  • For what do you need a read memory function?
    Sounds more like debugging + testing than production, what you are doing.
    I need to write a unique serial number to a memory area in the beginning of the test. If the device fails during test and I retest the unit I would like to re-use this serial and therefore I look for a valid serialnumber in this memory area in the beginning of the test instead of just picking out a new serial number every time.
    This is not true...
    Both, J-Link Commander as well as J-Flash, return error codes...

    Well that is good news. Then I probably do something wrong. Here is what I do:
    m = ExecCmd(
    "C:\Program Files (x86)\SEGGER\JLinkARM_V484c\jlink.exe -Device EFM32ZG108F8 -IF SWD -CommanderScript " & My.Application.Info.DirectoryPath & "\setup.jlinkscript")

    And setup.jlinkscript contains this:
    mem32 1FFC 4
    exit
    No matter if it can read the target or not it returns the value 1.
  • Hi,

    Sorry, I mixed up something here...
    O.K., J-Link Commander is not really designed for what you are trying to do.
    Usually, J-Link Commander does not abort complete operation etc. in case of an error (like not being able to read memory), so there is no real "return value" for such operations.
    Moreover, J-Link Commander is not designed for production purposes.
    I still recommend to build your own application, using the J-Link SDK, for what you are trying to do.


    - Alex
  • Ok, now I got the J-Link SDK. I would just like to use the API function of the dll in my .NET project. But I cannot add the JLinkARM.dll as reference. :(
    Anyway together witht the SDK there is a VB6 project that works fine. But here the JLinkARM.dll is also not added as reference. So how did you import the dll functions to this project.
  • Hi,

    Never mind. I just put the DLL file in the folder C:\Windows\SysWOW64 and then it works.

    Wow, dangerous...
    Please note that this will have side effects:
    For example IAR EWARM installations on your system will now *always* use the DLL in this System folder.
    Whatever version they are shipped with, it will no longer be used. The one in the system directory has precedence.

    We recommend to *not* put the DLL directly into system folders.


    Best regards
    Alex
  • But that is the only way that I can get access to the JlinkARM.dll API functions from Visual Studio.
    If I just try to add the JlinkARM.dll as reference then I get this error message: "A reference to C:\Program files(x86)\SEGGER\JlinkARM_SDK_V484b\JlinkARM.dll could not be added. Please make sure that the file is accesible, and that it is a valid assembly or COM component."
    So if I want to use the DLL from my Visual Studio project without adding the DLL as reference then I need to put it in the system folder bacause thats the only place that Visual Studio will look for it when it is not added as a reference.
  • Hi,

    Usually, there are two common ways to use a DLL in your application:

    1) Explicitly load the library via LoadLibrary() and load all functions explicitly via GetProcAddress().
    2) Using the import library (linker settings -> Object/library modules) that is shipped with the SDK (JLink.lib in ETC). Just make sure that the lib is in the same directory as the DLL.


    Best regards
    Alex