Debug STM32F103 Without Reset

Debug STM32F103 Without Reset

April 24, 2017 0 By Klemen

Catching a really nasty and rare bug in a firmware is quite a difficult task especially in an working end product. It happened to me so many times that device ceased to function but I was actually unable to see where the firmware stopped working.

Naturally the idea to check the buggy behavior is to connect the debugger to the target device and look where it hanged. But the problem arises when bug is so rare and so notoriously dumb that it takes a week of normal use of an end solution to  appear.

Problem with normal debugging session with open source tools is that every time we start the debugging session target is reset and freshly flashed with a target binary file. That kind of procedure destroys a buggy condition and we can no longer see what is the actual state of an end solution affected by our beloved and mysterious bug.

So we want to connect to our product based on STM32F103 microcontroller and we don’t want to disrupt it’s “thought process” and we are eventually using ST-LINK debugger, Eclipse Neon with GNU ARM Eclipse plug-in, GNU ARM Embedded Toolchain and OpenOCD-0.10.0. We need to modify our debugger start-up scripts.

Go to External Tools Configuration…

Change the content of the start-up files you have set as arguments for invoking the GDB…

The content of first file is…

And the content of the second file…

You can see some strange words like VESNA. This is our versatile sensor platform called VESNA.

Content of file stlink-v2.cfg is…

And the content of stm32f1x_stlink.cfg..

Now we can run a remote GDB session…

Now we have to correctly set a debugging session…

Now select right settings and click “Debug”.

Good luck!