Keil Logo

µVISION DEBUGGER: Breakpoints are not hit when debugging in RAM


Information in this knowledgebase article applies to:

  • MDK-ARM
  • ULINK2
  • ULINKpro
  • CMSIS-DAP debugger

SYMPTOM

My application copies some functions into RAM. When I set breakpoints in these relocated functions, my application does not stop although I am sure that these functions are executed. What could be the reason for this problem?

CAUSE

µVision installs breakpoints on the target when you start an application with a Run (F5) or Step Over/Out command. If a breakpoint is set in a RAM location, µVision will try to use a software breakpoint in order to save hardware resources. This is done by exchanging the original instruction with a BKPT instruction. If a breakpoint is set in Flash/ROM, for Cortex devices, µVision sets hardware breakpoints in the CoreSight unit.

When software breakpoints are set in RAM before the function is copied there, the breakpoint will be overwritten and the application will never stop there. To make things even worse, once µVision stops the application, it will restore the previous content at the breakpoint location with the values before the function was copied. This can corrupt the code of the function in RAM.

RESOLUTION

You must set breakpoints at RAM locations after the functions have been copied. Usually functions are copied at startup time when you specify different load- and execution-addresses for functions and modules in the linker scatter file. In this case, you should deselect the µVision option Options for Target - Debug - Restore Debug Session Settings - Breakpoints so that breakpoints are not set at the beginning of a debug session. Once you stop at main, you can set breakpoints either manually or with a debug function.

SEE ALSO

Last Reviewed: Friday, February 24, 2017


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.