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.
User avatar
DeusExMachina
Posts: 223
Joined: Tue Apr 03, 2012 5:08 am
Has thanked: 3 times
Been thanked: 3 times

Re: ST-Link V2 on Linux/OSX/Windows

Post by DeusExMachina »

may be i should try old version of toolchain...
User avatar
alex31
Posts: 445
Joined: Fri May 25, 2012 10:23 am
Has thanked: 57 times
Been thanked: 88 times

Re: ST-Link V2 on Linux/OSX/Windows

Post by alex31 »

did you enable IWDG (independant watchdog) on your project ?

I have had problem with that, unless a special bit is set to make the IWDG stop during debug or flashing, IWDG continue
to count, and reset the MCU during debug of flashing, with nasty consequences.

Probably not the problem for you, but since i have fight several day with that ...

Alexandre
User avatar
DeusExMachina
Posts: 223
Joined: Tue Apr 03, 2012 5:08 am
Has thanked: 3 times
Been thanked: 3 times

Re: ST-Link V2 on Linux/OSX/Windows

Post by DeusExMachina »

I swiched off watchdog, so this is not a reason
User avatar
DeusExMachina
Posts: 223
Joined: Tue Apr 03, 2012 5:08 am
Has thanked: 3 times
Been thanked: 3 times

Re: ST-Link V2 on Linux/OSX/Windows

Post by DeusExMachina »

After all, I have to switch to Windows (Atollic gdb server + Eclipse). All toolchain combinations and st-link firmware combinations failed in debugging in Linux... Sadly, my project lost a week for my investigations...
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/OSX/Windows

Post by Giovanni »

Strange, it works for me. Note that you have to do an USB related setting in the system, it is described in the OOCD manual.

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/OSX/Windows

Post by mobyfab »

Hey,

I am currently making a lot of changes, and the current SVN version does not work yet. (FLASH_SR PGAERR bit error...)

The latest stable version is R75 and only supports STM32F4.

I'll let you know when it get the new code working. It'g going to be a lot better and support all STM32 devices :)
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/OSX/Windows

Post by mobyfab »

Okay last revision works with the F4.

For the F0 I'm making a flash loader program that will run from ram.
The STLink can only write 8 or 32 bits at a time but the flash programming requires 16 bits, so a flash loader is needed.
This is also how the official tool works. I expect the loader method to be quite faster.

Also you can now verify the binary against the flash memory :)
User avatar
DeusExMachina
Posts: 223
Joined: Tue Apr 03, 2012 5:08 am
Has thanked: 3 times
Been thanked: 3 times

Re: ST-Link V2 on Linux/OSX/Windows

Post by DeusExMachina »

It is interesting that I can use st-util in Linux in non-chibios apps successfully. I can debug bare applications, or apps using FreeRTOS without problems...
User avatar
DeusExMachina
Posts: 223
Joined: Tue Apr 03, 2012 5:08 am
Has thanked: 3 times
Been thanked: 3 times

Re: ST-Link V2 on Linux/OSX/Windows

Post by DeusExMachina »

today I downloaded latest openocd and, voila - it works with F4!
I start it

Code: Select all

openocd -f /usr/local/share/openocd/scripts/board/stm32f4discovery.cfg -c "stm32f4x.cpu configure -rtos auto;"

In Eclipse startup

Code: Select all

file /home/../build/ch.elf
monitor reset halt
load
monitor reset halt
run

so I get a normal flash process and debugging
A texain st-link has a SERIOUS BUG!!! It brokes a flash during transmission (esspesially a big one). Dont use 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/OSX/Windows

Post by mobyfab »

Hey guys,

I just finished updating Qstlink2 with some flash loaders, it works with the F0 now. (Revision 104)

I will test the F4 tonight and push some fixes if needed.

Could you guys test with other MCUs such as the F1/2/3 ? They all have a loader.
I will make the windows exe available tonight, for the ubuntu package it is available already.

By the way if someone could review the flash loader that would be cool, since it's not super clean code :D
I'm sure it can be improved. I used the ST library so it's pretty easy to modify.

Thanks!
Post Reply