cancel
Showing results for 
Search instead for 
Did you mean: 

Nucleo STM32F091 skips startup script to 'LoopForever'

CBlus.1
Associate

I've been attempting to debug a test application compiled for an stm32f091RC controller on its corresponding nucleo development board. To debug, I use st-util and arm-none-eabi-gdb. When I load the elf file through gdb, the stm correctly halts just after Reset_Handler (line 71 of startup script), however after issuing a 'stepi' command immediately ends up at line 132, which is LoopForever. (I am checking current line number with frame and bt commands). I would expect an unimplemented interrupt handler to end up in an infinite loop, however the default handler is 'InfiniteLoop', not 'LoopForever'. This does not make sense because stepi should only step one instruction, and LoopForever should not logically be able to be reached unless the jump to main somehow failed.

I've attached my startup script and system module along with my simple main.c and my linker script. The attached shell script is how I'm building this program. If I can provide more info please let me know.

Thanks!

Update: I changed main to set register values using inline assembly and the registers reflected those values upon running 'info registers'. However, if I wrote to R6, gdb printed the value written in R7. Additionally, I can set breakpoints in main and although a gdb frame prints out that it is still in the infinite loop, the breakpoints stop the program each time I run continue and do not stop the program once I delete them. This makes me suspicious that the program is executing correctly, however gdb has got incorrect register values including PC, which causes it to think the program is running in a different place. Still not sure what could be causing this.

0 REPLIES 0