Page 1 of 1

STLink-v2 + stm32f103 blue + GDB

Posted: Wed Mar 15, 2017 9:41 pm
by tiger762
Hello!

Trying to debug a complex script I have running on the stm32f103. I program it with an STLink-v2 fine.

Downloaded and compiled Texane's st-util

I start it, get the "listening on 4242" message

Code: Select all

2017-03-15T17:34:59 INFO src/gdbserver/gdb-server.c: Listening at *:4242...
I start the ARM GDB

tar extended-remote :4242

in the st-util window it detects that GDB has connected to it

Code: Select all

2017-03-15T17:35:42 INFO src/gdbserver/gdb-server.c: GDB connected.
At this point, it is only marginally useful. A stack trace always shows the same bullcrap:

Code: Select all

(gdb) bt
#0  0x1ffff020 in ?? ()
#1  0xffffffff in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
I am suspect of what it reports the program counter:

Code: Select all

(gdb) print $pc
$1 = (void (*)(void)) 0x1ffff020
It is always that value. Dumps of memory seem to work:

Code: Select all

(gdb) x/32x 0x08000000
0x8000000 <__stm32_vector_table>:	0x20005000	0x08000e55	0x08000fdd	0x08000fdd
0x8000010 <__stm32_vector_table+16>:	0x08000fdd	0x08000fdd	0x08000fdd	0x08000fdd
0x8000020 <__stm32_vector_table+32>:	0x08000fdd	0x08000fdd	0x08000fdd	0x08000fdd
0x8000030 <__stm32_vector_table+48>:	0x08000fdd	0x08000fdd	0x08000fdd	0x08001435
0x8000040 <__stm32_vector_table+64>:	0x08000fdd	0x08000fdd	0x08000fdd	0x08000fdd
0x8000050 <__stm32_vector_table+80>:	0x08000fdd	0x08000fdd	0x08000491	0x08000fdd
0x8000060 <__stm32_vector_table+96>:	0x08000fdd	0x08000fdd	0x08000fdd	0x080004bd
0x8000070 <__stm32_vector_table+112>:	0x08000fdd	0x080004fd	0x08000fdd	0x08000fdd
But what I really need to do is when the stm32f103 has driven off into the woods, start the debugger and at least get a real program counter address that I can then take to an objdump output and figure out what while() loop it is likely stuck in.

Any help appreciated!