Page 1 of 12

ST-Link V2 on Linux/OSX/Windows

Posted: Tue Nov 22, 2011 5:32 pm
by mobyfab
Hey guys,

I'm currently using Linux as my primary desktop for developping, and the lack of support for ST Link is kinda annoying...

Basically there are 2 options to my knowledge: http://code.google.com/p/arm-utilities/ or using the official tool under Windows :D
I have tested the above (Linux) solution with my STM34F4DISCOVERY and it didn't work, sadly... I guess there are some errors on the addresses descriptions.

I started developping a GUI based on QT4/libusb-1.0, so far most of the work is pretty much porting stlink-download to C++.
Once I get something working I'll post it to google code and try to add some features.

Any help/ideas are welcome.
I will let you know about my progress. :)

snapshot2.png
snapshot2.png (37.49 KiB) Viewed 20673 times


edit:
the code and the win32 binary are available here:

http://code.google.com/p/qstlink2/

Re: ST-Link V2 on Linux

Posted: Tue Nov 22, 2011 6:40 pm
by Giovanni
Sure, keep us updated, I would also suggest supporting MacOS if possible, I know that there are many users using that too.

Giovanni

Re: ST-Link V2 on Linux

Posted: Tue Nov 22, 2011 6:50 pm
by mobyfab
It should work on OSX as well ;)

Re: ST-Link V2 on Linux

Posted: Wed Nov 23, 2011 7:47 pm
by mobyfab
okay, I've made a little progress:

I can now communicate with the ST-Link (Get version, mode...).
Now comes the reverse engineering, I'll have to use a windows VM on my linux host to do some more USB sniffing with wireshark. That way I'll see how the official application works.

I'll keep you posted.

Re: ST-Link V2 on Linux

Posted: Wed Nov 23, 2011 8:02 pm
by mabl
Mobyfab, great work! Just one question though: Why don't you use https://github.com/texane/stlink.git? It works great for my Discovery board under Fedora 16 and Ubuntu 11.10 - of cause it does not have a graphical interface.

I could also imagine that it can be compiled on OS X.

Re: ST-Link V2 on Linux

Posted: Wed Nov 23, 2011 10:04 pm
by mobyfab
Thanks for the link, I'll have a look :)

Indeed I'd like to have a GUI, it's just more practical in most cases, and C++ code is way easier to maintain that C code :P

Re: ST-Link V2 on Linux

Posted: Sun Nov 27, 2011 11:33 am
by mobyfab
I got it working :)

so far the only thing that I need to implement is the file transfer methods, everything else is working fine. (status, debug, reading/writing memory)
also, I'm using xml to specify info on the MCUs (cpuid, ram size, etc), so that can be changed without recompiling.

I'll post a screenshot later on.

as soon as it is ready I'll post the code on google.

Re: ST-Link V2 on Linux

Posted: Mon Nov 28, 2011 10:36 am
by mobyfab
here are the screenshots
I'm using my STM32F4DISCOVERY board.

snapshot3.png
snapshot3.png (50.93 KiB) Viewed 20597 times


snapshot4.png
snapshot4.png (50.28 KiB) Viewed 20597 times


snapshot5.png
snapshot5.png (45.57 KiB) Viewed 20597 times

Re: ST-Link V2 on Linux

Posted: Mon Nov 28, 2011 4:07 pm
by Giovanni
Very cool, I wish to make a small request :-)

Would be possible to give it a command line interface able to brutally flash and run the device with a file (bin/hex) passed as parameter?

The command line version would be more make-friendly, I could add a specific target to makefiles. Of course log/errors would go on stdout/stderr.

Giovanni

Re: ST-Link V2 on Linux

Posted: Mon Nov 28, 2011 8:44 pm
by mobyfab
Yeah I can do this no problem.

had some issues with unlocking the flash, but now it is sorted. Last steps are erasing and programming then I'm done :D