SparkFun Forums 

Where electronics enthusiasts find answers.

Open source ARM Debugger
By MechEE
#15915
Is there any plan to add Segger J-Link support to OpenOCD? Pardon my ignorance if this question doesn't make sense. CrossWorks has support for the J-Link (they just require that you point to your own copy of the jlinkarm.dll which can be freely downloaded from Segger), so I assume this would also be possible for OpenOCD. Thoughts? Thanks much.
By Dominic
#15920
Sorry, but I don't think this is going to happen:

The Segger jlinkarm.dll is proprietary code, and as such can't be linked against the OpenOCD, which is GPL licensed. Segger would have to provide either an open library or document the hardware interface. Both are unlikely to happen.

Regards,

Dominic
By MechEE
#15942
Dominic wrote:Sorry, but I don't think this is going to happen:

The Segger jlinkarm.dll is proprietary code, and as such can't be linked against the OpenOCD, which is GPL licensed. Segger would have to provide either an open library or document the hardware interface. Both are unlikely to happen.

Regards,

Dominic
Thanks for the reply. Is there no way around this? Could it not be handled just like CrossWorks, where they do not provide the DLL (the user must go get it and provide the path to it manually), but the program can interact with it if provided. Pardon my ignorance as I'm not that familiar with GPL licensing, but it doesn't really seem any different than OpenOCD currently interacting with Windows DLLs that also aren't provided in the download. No?
By Dominic
#15955
Distributing the Segger DLL would in no way be possible, but even if the user get the DLL manually, that would be in violation of the GPL.

From Section 3 of the GPL:

...
However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
...

So it is fine to run the OpenOCD together with base system libraries, like MSCRT.DLL, KERNEL32.DLL etc., but the Segger library is hardly a major component of the operating system.

A program has to link to the DLL - either by having references to it in the program's import section, or by explicilty loading it vi LoadLibrary. And you can't link non-GPL compatible code with software covered by the GPL.

Regards,

Dominic
By MechEE
#15968
D'oh! Well thanks for the clarification. I guess all will be well once Olimex releases their USB JTAG. :)
By mlu
#16041
Dominic wrote: ...
However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
...

So it is fine to run the OpenOCD together with base system libraries, like MSCRT.DLL, KERNEL32.DLL etc., but the Segger library is hardly a major component of the operating system.

A program has to link to the DLL - either by having references to it in the program's import section, or by explicilty loading it vi LoadLibrary. And you can't link non-GPL compatible code with software covered by the GPL.

Regards,

Dominic
This has been discussed "for ever" ( in regards to codecs and plugins for multimedia applications). Situations where the basic application does not depend on non GPL code but it can load and use it.

The copyright and legal situation is not clear. If dynamic linking against a separatly obtained module can be considered creating a derived work.

The only part of the non GPL code in our application is the implementation of the API, the implementation code is distributed under the GPL It is also the opinion in most legal discussions that the API specifications are non copyrightable.

Dominic must decide on this issue, but anybody can write and privately use a Segger DLL module, but "maybe" not distribute it.

My problem with this situation is that OpenOcd already uses and links against the ftdi D2XX library, which is not GPL !!!

Personally I am strongly in favour of keeping GPL alive and GPL code free. But some of the arguments against linking to other programs or modules are weak, both legally and from the practical point of beeing able to create useful and free software.

Regards Magnus
By OLIMEX
#16044
mlu wrote:Dominic must decide on this issue, but anybody can write and privately use a Segger DLL module, but "maybe" not distribute it.
you are walking on thin ice here, if Segger put effort to write the DLL and this is part of commercial product they will not be hapy to see someone else uses their work without their permission and this "maybe not distribute" will not save your *** in the court

just my 2 cents

Tsvetan
By mlu
#16045
OLIMEX wrote:
mlu wrote:Dominic must decide on this issue, but anybody can write and privately use a Segger DLL module, but "maybe" not distribute it.
you are walking on thin ice here, if Segger put effort to write the DLL and this is part of commercial product they will not be hapy to see someone else uses their work without their permission and this "maybe not distribute" will not save your *** in the court

just my 2 cents

Tsvetan
Right you are, but that was not my point:

Of course my discussion requires that the Segger DLL can be legally obtained and used, with the permission of Segger.
My comments was about using non GPL modules together with GPL and distributing GPL stuff without source to the Segger code, and saving my *** from GPL enforcers.

/Magnus
By mlu
#16046
Another legally interesting/important question is if I have the Segger commercial product, with all the dll's payed and licenced. Is it then legal for me to use my patched version of OpenOcd with this library ?

This is not copying, distribution but use of bought, or licenced, material but in a different context the product I have bought.

Magnus
By OLIMEX
#16048
I would read the licensee agreement first then comment.
If the licensee says that this dll is licenseed to be used only with original J-LINK debugger and software then whatever else you do no matter if distributing or not is breaking the licensee agreement.
For instance one Russian company MT-Systems reverse engineered the firmware of J-Link and made clone called MT-Link - they don't do anything else than using original J-Link drivers for EW-ARM but you can figure out yourself if this makes Segger happy as somebody else uses their work by using their dlls.

Tsvetan
By mlu
#16052
The licence agreement for the "ARM/J-Trace/SAM-ICE software and documentation pack V3.30k" says that only an J-LInk or autorized OEM product may be used.
It is possible to write your own debug/IDE application to link to the JLinkARM.dll so OpenOcd should be allowed but to get the header files and linking information the SDK and a special licence agreement is needed.
Licensor grants Licensee a non-exclusive and non-transferable License to use the software or parts thereof with SEGGERs J-Link hardware or authorized OEM products (Atmel SAM-ICE, Analog Devices mIDAS-Link, IAR J-Link, IAR J-Link KS) only. Licensee will receive the J-Link ARM software either as
code in linkable form (e.g. object code) or executable.
The use on any other hardware (e.g. MT-Link) is prohibited and illegal.
Any other use of the software package is prohibited without prior written authorization from SEGGER.
This also seems to be Windows only so since I dont have a J-Link and mostly runs Linux I think I will leave it here.

Magnus
By mifi
#16057
Hello Magnus,

there is an other problem, still if you have an legal dll, and an original Segger dongle.

Does anyone know how the interface looks like? I mean which function the dll
included and what kind of parameter these function needed? I know that you can
buy a the "ARM Developer pack DLL" from Segger. With this product you are
able to program you own application or expand an other software.

I do not know the licence from the "Developer pack", but I could imagine that
it is not allowed to make some of the source public. And that is what you must do
if you want to communicate with this dll. The source which you need for the
communication must be included in OpenOCD. OpenOCD is under GPL and
therefore you MUST make the source public, even the part how to
communicate with the segger key.

Rowley support the segger key too, I think they have bought the "developer pack"
and expanded CrossWorks for ARM. CrossWorks for ARM is NO open source.
And therefore they have not the problem. Btw, it is a nice product.

I think if the interface will be made public by segger, than it could be support
with OpenOCD too.

Regards,

Michael
By fordp
#16059
I would have thought the answer was to replace the Segger DLL with some GPL licenced alternative.

I am not aware that reverse engineering protocols is illegal, as long as you have no access to the code, binary or source. I think protocols is simalar to file formats and is fair game.

I do not have a Segger, nor will I ever have.

I think it will be much simpler to buy an FTDI based interface from Olimex.

I may look at making my own interface for OpenOCD in the future. If I do I will make it open to everybody.

I am also interested in the new ARM SWI protocol which looks interesting. This is a new lower pin count interface that can do a simalar job to JTAG on the new Cortex range from ARM.

It will be more interesting when there is more than just Luminary offering parts. I guess support for these chips will be a long time in coming to OpenOCD.
By Dominic
#16333
As Magnus pointed out, it's probably up to me to decide whether I allow distribution of an OpenOCD version with support for the Segger J-Link - if someone actually wrote code that makes use of Segger's DLL. But as Tsvetan pointed out, Segger might also cause trouble, if they decide to, and I really don't feel like taking that risk to be able to support a proprietary interface.

A GPL licensed replacement for Segger's library would either require documentation for the hardware (unlikely) or reverse engineering (a lot of work), but if anyone decides to got that route I'd be happy to include that code, provided it was cleanly developed. In the U.S. the best solution seems to be clean-room reverse engineering, where one developer reverse-engineers and writes documentation based on his findings, while another one produces the code for the free implementation. I've seen comments that this might not be necessary in europe (or parts of it), but it's always a bit risky.

Magnus reminded me of the dubious use of FTDI's FTD2XX. I decided to use it as it provides a huge performance increase over the free libftdi from intra2net AG.
According to my understanding of the GPL, which matches the position of the FSF (e.g. their FAQ or RMS comments), runtime-loading of DLLs constitues linking, and is therefor a violation of the GPL, but I can live with that in case of the FTD2XX, though I'd prefer a free solution if it would provide performance comparable to FTDI's.

Regards,

Dominic