This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to avoid BKPT 0xAB instruction

I am using MCU Cortex-M4 and running keil on simulation. while running keil in debug mode, code is stopping at BKPT 0xAB instruction and we have to re initialize run to continue like break point. I am not using break points. I need code to run with out stopping at BKPT instruction. How is it possible? How to avoid BKPT instruction? please help any one.

  • Don't use printf(), putchar(), etc unless you have added retargeting code to direct them to a UART or SWD channel.

  • You're right that this breakpoint instruction is being used to trigger some kind of semihosting operation. If your code contains such instructions, you'll need to always run it attached to a debugger that knows what to do when such an instruction is encountered. If you need to run the device standalone, find out what code you're using that causes the semihosting operations to take place, and make sure that code isn't in the standalone build. This situation is a good opportunity to set up "debug" and "release" builds of your software - maybe using #ifdef DEBUG or something along those lines to exclude the semihosting code from your release build.

    LiteBlue

  • You may check this article, which explains why your target stops at BKPT 0xAB, when starting the debug session:

    developer.arm.com/.../latest

  • The BKPT instruction causes the processor to enter Debug state. Debug tools can use this to investigate system state when the instruction at a particular address is reached.In both ARM state and Thumb state, imm is ignored by the ARM hardware. However, a debugger can use it to store additional information about the breakpoint.