stm32stm32l152

STM32L151 - Debugger starts up at wrong address.. sometimes


I just started working on a STM32L151 microcontroller. I've setup the debugger to break at first instruction (not main), but when I start debugging the program counter stops at 0x1ff00b84 which isn't even a part of the flash (starting at 0x8000000 -> 0x8010000).

It gets wierd, because when i try resetting the debugging session (without downloading the program again), a couple of times it finally stops at the first instruction in my startup-file (startup_stm32l1xx_md.s) and everything runs smoothly until the next time I need the program the device and start the debugger again.

I use CoIDE with the compiler "GNU Tools ARM Embedded 4.8 2014q2". And I run on some custom HW that just arrived. I use SWD from a STM32 Discovery Board to program the chip with.

Hope someone has an idea?


Solution

  • That address is in the bootloader ROM. This behavior suggests that the BOOT0 pin may be floating; make sure that it is tied to GND to boot from flash.