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 »

debugging freeses in asm code

Code: Select all

void _port_thread_start(void) {

  chSysUnlock();
  asm volatile ("mov     r0, r5                                 \n\t"
                "blx     r4                                     \n\t"
                "bl      chThdExit");
}

Tectu, could you share your old st-util code for me?
User avatar
Tectu
Posts: 1225
Joined: Thu May 10, 2012 9:50 am

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

Post by Tectu »

Sorry, I just took a look and I don't have the code / binary / repo anymore. Also, I couldn't find it in my backups since I did rebuild my backup server a month ago and I didn't move stuff :P
Just try the repo state from let's say July. You can directly download a zip file from github.com.

I remember that there were some gdb version issues. The newest GDB versions didn't work properly. But I'm not sure if this is still the case. Also, I am 100% sure that an error like yours didn't occur.


~ Tectu
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 »

thank you, I'll try to rollback using git
User avatar
Tectu
Posts: 1225
Joined: Thu May 10, 2012 9:50 am

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

Post by Tectu »

You could also try to explain to me why you want to use texane instead of OpenOCD? STLink are both, v1 and v2 supported. Also, mabl integrated ChibiOS/RT debugging support into OpenOCD (git version!).


~ Tectu
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 »

really :) it's time to move, I think...
User avatar
Tectu
Posts: 1225
Joined: Thu May 10, 2012 9:50 am

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

Post by Tectu »

There you go :)
Well, the only thing I can tell you is, that you won't regret it afterwards. OpenOCD works very stable here and again, there's ChibiOS debugging support built-in.


~ Tectu
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 download last openocd, but I can't get it working... It connects target and adapter, but I cant flash MCU, and many examples from internet don't work... For example "monitor" commands is deprecated... When I use load i get error "cant load in exec mode". Halt commands (monitor halt, soft-halt) don't work :( I need a good instructions to set up openocd :( The last one...
User avatar
Tectu
Posts: 1225
Joined: Thu May 10, 2012 9:50 am

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

Post by Tectu »

Just to get this right... You can start openocd and connect to the target successfully, right? So, you do open arm-none-eabi-gdb afterwards, right? Then you connect to the openocd server?
Also this.


~ Tectu
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 »

Tectu wrote:Just to get this right... You can start openocd and connect to the target successfully, right? So, you do open arm-none-eabi-gdb afterwards, right? Then you connect to the openocd server?

yes, openocd starts (but successfully connect to MCU only on the second run, first run fails). arm-none-eabi-gdb connects to 4444 port and they become to speak :) I load symbols, but image doesn’t load, because of "cant load in exec mode" error.

Tectu wrote:Also this.
~ Tectu

Excellent article, I’ll try it ASAP :)
User avatar
Tectu
Posts: 1225
Joined: Thu May 10, 2012 9:50 am

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

Post by Tectu »

Try to follow the guide, you should go with 3333 instead of 4444 default port. 4444 is telnet.
Feel free to extend the guide to your needs. I never really came to finish the actual debugging part.


~ Tectu
Post Reply