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.
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'm done with the first "alpha" version

you can find the code here: http://code.google.com/p/qstlink2/

it has only been tested with my STM32F4DISCOVERY board.
I guess there are still lots of bug but it works :)

I will clean the code as soon as I have some time.

to launch simply do "sudo ./qstlink2"

if you want to see what it does, append "debug" to the command.
Giovanni, I'll work on your feature :)
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 »

Giovanni, I just added your feature

run the program as this: sudo ./qstlink2 debug cli flash:read:./dump.bin (this will do a dump of the flash)
replace read with write to flash the device.

you can remove debug but it won't show much info on the screen.
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 »

Hi,

Great, I will give it a try. Do you plan a windows version 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 »

No Windows version planned for now since there are already some tools available (like the official one)
Technically it is possible if people really want it.
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 think I just beat any other program for transfer speed:

Code: Select all

$ time sudo ./qstlink2 cli flash:write:./ch.bin
Verbose level: 2
Info: Found an ST Link V2.
Info: Opening device...
Info: Device Open.
Info: ChipID: "413"
Info: Device type:  "STM32F4**"
Info: Writing from "8000000" to "8007788"
Info: Erasing flash... This might take some time.
Info: Progress: "1%"
Info: Progress: "2%"
Info: Progress: "3%"
Info: Progress: "4%"
Info: Progress: "5%"
Info: Progress: "6%"
Info: Progress: "7%"
Info: Progress: "8%"
Info: Progress: "9%"
Info: Progress: "10%"
Info: Progress: "11%"
Info: Progress: "12%"
Info: Progress: "13%"
Info: Progress: "14%"
Info: Progress: "15%"
Info: Progress: "16%"
Info: Progress: "17%"
Info: Progress: "18%"
Info: Progress: "19%"
Info: Progress: "20%"
Info: Progress: "21%"
Info: Progress: "22%"
Info: Progress: "23%"
Info: Progress: "24%"
Info: Progress: "25%"
Info: Progress: "26%"
Info: Progress: "27%"
Info: Progress: "28%"
Info: Progress: "29%"
Info: Progress: "30%"
Info: Progress: "31%"
Info: Progress: "32%"
Info: Progress: "33%"
Info: Progress: "34%"
Info: Progress: "35%"
Info: Progress: "36%"
Info: Progress: "37%"
Info: Progress: "38%"
Info: Progress: "39%"
Info: Progress: "40%"
Info: Progress: "41%"
Info: Progress: "42%"
Info: Progress: "43%"
Info: Progress: "44%"
Info: Progress: "45%"
Info: Progress: "46%"
Info: Progress: "47%"
Info: Progress: "48%"
Info: Progress: "49%"
Info: Progress: "50%"
Info: Progress: "51%"
Info: Progress: "52%"
Info: Progress: "53%"
Info: Progress: "54%"
Info: Progress: "55%"
Info: Progress: "56%"
Info: Progress: "57%"
Info: Progress: "58%"
Info: Progress: "59%"
Info: Progress: "60%"
Info: Progress: "61%"
Info: Progress: "62%"
Info: Progress: "63%"
Info: Progress: "64%"
Info: Progress: "65%"
Info: Progress: "66%"
Info: Progress: "67%"
Info: Progress: "68%"
Info: Progress: "69%"
Info: Progress: "70%"
Info: Progress: "71%"
Info: Progress: "72%"
Info: Progress: "73%"
Info: Progress: "74%"
Info: Progress: "75%"
Info: Progress: "76%"
Info: Progress: "77%"
Info: Progress: "78%"
Info: Progress: "79%"
Info: Progress: "80%"
Info: Progress: "81%"
Info: Progress: "82%"
Info: Progress: "83%"
Info: Progress: "84%"
Info: Progress: "85%"
Info: Progress: "86%"
Info: Progress: "87%"
Info: Progress: "88%"
Info: Progress: "89%"
Info: Progress: "90%"
Info: Progress: "91%"
Info: Progress: "92%"
Info: Progress: "93%"
Info: Progress: "94%"
Info: Progress: "95%"
Info: Progress: "96%"
Info: Progress: "97%"
Info: Progress: "98%"
Info: Progress: "99%"
Info: Transfer done

real    0m9.041s
user    0m0.304s
sys     0m0.080s


The actual transfer takes like one second :)
Erasing takes about 7.7 seconds.
Last edited by mobyfab on Fri Dec 02, 2011 1:50 pm, edited 1 time in total.
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 »

Without erasing :)

Code: Select all

$ time sudo ./qstlink2 cli flash:write:noerase:./ch.bin 
Verbose level: 2
Info: Found an ST Link V2.
Info: Opening device...
Info: Device Open.
Info: ChipID: "413"
Info: Device type:  "STM32F4**"
Info: Writing from "8000000" to "8007788"
Info: Progress: "1%"
Info: Progress: "2%"
Info: Progress: "3%"
Info: Progress: "4%"
Info: Progress: "5%"
Info: Progress: "6%"
Info: Progress: "7%"
Info: Progress: "8%"
Info: Progress: "9%"
Info: Progress: "10%"
Info: Progress: "11%"
Info: Progress: "12%"
Info: Progress: "13%"
Info: Progress: "14%"
Info: Progress: "15%"
Info: Progress: "16%"
Info: Progress: "17%"
Info: Progress: "18%"
Info: Progress: "19%"
Info: Progress: "20%"
Info: Progress: "21%"
Info: Progress: "22%"
Info: Progress: "23%"
Info: Progress: "24%"
Info: Progress: "25%"
Info: Progress: "26%"
Info: Progress: "27%"
Info: Progress: "28%"
Info: Progress: "29%"
Info: Progress: "30%"
Info: Progress: "31%"
Info: Progress: "32%"
Info: Progress: "33%"
Info: Progress: "34%"
Info: Progress: "35%"
Info: Progress: "36%"
Info: Progress: "37%"
Info: Progress: "38%"
Info: Progress: "39%"
Info: Progress: "40%"
Info: Progress: "41%"
Info: Progress: "42%"
Info: Progress: "43%"
Info: Progress: "44%"
Info: Progress: "45%"
Info: Progress: "46%"
Info: Progress: "47%"
Info: Progress: "48%"
Info: Progress: "49%"
Info: Progress: "50%"
Info: Progress: "51%"
Info: Progress: "52%"
Info: Progress: "53%"
Info: Progress: "54%"
Info: Progress: "55%"
Info: Progress: "56%"
Info: Progress: "57%"
Info: Progress: "58%"
Info: Progress: "59%"
Info: Progress: "60%"
Info: Progress: "61%"
Info: Progress: "62%"
Info: Progress: "63%"
Info: Progress: "64%"
Info: Progress: "65%"
Info: Progress: "66%"
Info: Progress: "67%"
Info: Progress: "68%"
Info: Progress: "69%"
Info: Progress: "70%"
Info: Progress: "71%"
Info: Progress: "72%"
Info: Progress: "73%"
Info: Progress: "74%"
Info: Progress: "75%"
Info: Progress: "76%"
Info: Progress: "77%"
Info: Progress: "78%"
Info: Progress: "79%"
Info: Progress: "80%"
Info: Progress: "81%"
Info: Progress: "82%"
Info: Progress: "83%"
Info: Progress: "84%"
Info: Progress: "85%"
Info: Progress: "86%"
Info: Progress: "87%"
Info: Progress: "88%"
Info: Progress: "89%"
Info: Progress: "90%"
Info: Progress: "91%"
Info: Progress: "92%"
Info: Progress: "93%"
Info: Progress: "94%"
Info: Progress: "95%"
Info: Progress: "96%"
Info: Progress: "97%"
Info: Progress: "98%"
Info: Progress: "99%"
Info: Transfer done

real    0m2.262s
user    0m0.304s
sys     0m0.076s
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: ST-Link V2 on Linux

Post by barthess »

mobyfab
What tools you use for development/debugging for MCUs under Linux?
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 »

For MCU dev I use Eclipse with gcc

For this app I use Qt Creator.
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 »

Last edited by mobyfab on Sat Dec 03, 2011 11:50 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 »

Well, that was quick lol.

Giovanni
Post Reply