Search code examples
stm32keilarmclang

Breakpoint instruction inside ARM v6 compiler startup code


I am developping a new project for STM32 on Keil MDK 5.28, using ARM compiler V6 (the "new" armclang compiler). It's the first time I'm using armclang.

My reset handler is calling the __main symbol. As expected, this is executing some startup code of the Keil C library and then is calling my main function (later on, I will remove the calls to the startup code but right now I want to understand the issue).

The problem is the following: there is a BKPT instruction inside one of the C library function (_sys_open). I didn't set this breakpoint and it doesn't appear in the breakpoint list. I cannot remove it (tried obviously to rebuild everything). So I cannot start a debug session without breaking at this location.

I also tried to uncheck the option "Run to Main".

enter image description here

Do you know where this BKPT instruction comes from and how to remove it ?


Solution

  • Summary of the comments: The breakpoint instruction BKPT is part of the semihosting feature, which is supposed to cooperate with the debugger. Enabling Microlib disables semihosting; see here and here.