Wednesday, December 13th 2017, 3:50pm UTC+1

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

dhla

Beginner

Date of registration: Apr 25th 2014

Posts: 12

1

Monday, April 28th 2014, 8:38am

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?

SEGGER - Alex

Super Moderator

Date of registration: Dec 18th 2007

Posts: 1,514

2

Monday, April 28th 2014, 8:56am

Hi,

Quoted

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...

Quoted

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 (http://www.segger.com/jlink-sdk.html) if you need some customized environment which does not fit into the existing solutions.


Best regards
Alex

dhla

Beginner

Date of registration: Apr 25th 2014

Posts: 12

3

Monday, April 28th 2014, 10:53am

Quoted

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.

Quoted

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.

dhla

Beginner

Date of registration: Apr 25th 2014

Posts: 12

4

Tuesday, April 29th 2014, 7:29am

So does anyone have an idea of what I do wrong?

SEGGER - Alex

Super Moderator

Date of registration: Dec 18th 2007

Posts: 1,514

5

Tuesday, April 29th 2014, 8:45am

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

dhla

Beginner

Date of registration: Apr 25th 2014

Posts: 12

6

Tuesday, April 29th 2014, 3:47pm

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.

dhla

Beginner

Date of registration: Apr 25th 2014

Posts: 12

7

Wednesday, April 30th 2014, 9:45am

Never mind. I just put the DLL file in the folder C:\Windows\SysWOW64 and then it works.
And most important of all - now I get error codes :thumbsup:

SEGGER - Alex

Super Moderator

Date of registration: Dec 18th 2007

Posts: 1,514

8

Wednesday, May 7th 2014, 9:41am

Hi,

Quoted

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

dhla

Beginner

Date of registration: Apr 25th 2014

Posts: 12

9

Thursday, May 8th 2014, 8:08am

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.

SEGGER - Alex

Super Moderator

Date of registration: Dec 18th 2007

Posts: 1,514

10

Monday, May 19th 2014, 8:47am

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