ST-Link V2 on Linux/OSX/Windows

This forum is about you. Feel free to discuss anything is related to embedded and electronics, your awesome projects, your ideas, your announcements, not necessarily related to ChibiOS but to embedded in general. This forum is NOT for support.
Post Reply
mobyfab
Posts: 484
Joined: Sat Nov 19, 2011 6:47 pm
Has thanked: 21 times
Been thanked: 31 times

ST-Link V2 on Linux/OSX/Windows

Post 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 20664 times


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

http://code.google.com/p/qstlink2/
Last edited by mobyfab on Sat Dec 03, 2011 11:31 am, edited 1 time in total.
User avatar
Giovanni
Site Admin
Posts: 14894
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: ST-Link V2 on Linux

Post 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
mobyfab
Posts: 484
Joined: Sat Nov 19, 2011 6:47 pm
Has thanked: 21 times
Been thanked: 31 times

Re: ST-Link V2 on Linux

Post by mobyfab »

It should work on OSX as well ;)
mobyfab
Posts: 484
Joined: Sat Nov 19, 2011 6:47 pm
Has thanked: 21 times
Been thanked: 31 times

Re: ST-Link V2 on Linux

Post 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.
mabl
Posts: 417
Joined: Tue Dec 21, 2010 10:19 am
Been thanked: 1 time

Re: ST-Link V2 on Linux

Post 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.
mobyfab
Posts: 484
Joined: Sat Nov 19, 2011 6:47 pm
Has thanked: 21 times
Been thanked: 31 times

Re: ST-Link V2 on Linux

Post 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
mobyfab
Posts: 484
Joined: Sat Nov 19, 2011 6:47 pm
Has thanked: 21 times
Been thanked: 31 times

Re: ST-Link V2 on Linux

Post 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.
mobyfab
Posts: 484
Joined: Sat Nov 19, 2011 6:47 pm
Has thanked: 21 times
Been thanked: 31 times

Re: ST-Link V2 on Linux

Post by mobyfab »

here are the screenshots
I'm using my STM32F4DISCOVERY board.

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


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


snapshot5.png
snapshot5.png (45.57 KiB) Viewed 20588 times
User avatar
Giovanni
Site Admin
Posts: 14894
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: ST-Link V2 on Linux

Post 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
mobyfab
Posts: 484
Joined: Sat Nov 19, 2011 6:47 pm
Has thanked: 21 times
Been thanked: 31 times

Re: ST-Link V2 on Linux

Post 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
Post Reply