AnsweredAssumed Answered

unable to debug using gdb and openocd

Question asked by robitzki.torsten on May 1, 2015
Latest reply on May 5, 2015 by robitzki.torsten
Hello,
I’m quit new to STs micro controllers and openocd. I want to use the STM32L152RE on a Nucleo board. I’ve installed the head version of openocd to get support for this board. I start openocd with following parameters:

  openocd -f board/st_nucleo_l1.cfg

My .gdbinit file looks like this:

  target remote localhost:3333  
  monitor reset
  symbol /Users/todi/ebtks/build/source/ebtks.elf

When starting gdb, it looks like that every time the PC of the CPU is at 0x08000242:

  > arm-none-eabi-gdb
  …
  0x08000242 in ?? ()
  Unable to match requested speed 300 kHz, using 240 kHz
  Unable to match requested speed 300 kHz, using 240 kHz
  adapter speed: 240 kHz
  Breakpoint 1 at 0x800019c: file /Users/todi/ebtks/source/main.cpp, line 26.

According to the elf-file this is within the Reset_Handler:

  0800023c <FillZerobss>:
   800023c:     2300           movs     r3, #0
   800023e:     f842 3b04      str.w     r3, [r2], #4

  08000242 <LoopFillZerobss>:
   8000242:     4b09           ldr     r3, [pc, #36]     ; (8000268 <LoopFillZerobss+0x26>)
   8000244:     429a           cmp     r2, r3
   8000246:     f4ff aff9      bcc.w     800023c <FillZerobss>
   800024a:     f7ff ffb3      bl     80001b4 <SystemInit>

when ever I try to debug the CPU I do not get to main() but end up with a PC of 0x08000242
  (gdb) monitor reset
  Unable to match requested speed 300 kHz, using 240 kHz
  Unable to match requested speed 300 kHz, using 240 kHz
  adapter speed: 240 kHz
  (gdb) s
  Single stepping until exit from function LoopFillZerobss,
  which has no line number information.
  Note: automatically using hardware breakpoints for read-only addresses.
  WARNING! The target is already running. All changes GDB did to registers will be discarded! Waiting for target to halt.
  ^C
  Program received signal SIGINT, Interrupt.
  0x08000242 in LoopFillZerobss ()

Is the warning a hint that resetting the CPU isn’t working as expected? Are there any addition setting I would have to set with openocd or gdb?

thanks in advance for any help or pointers,
Torsten 

Outcomes