µVISION DEBUGGER: Breakpoints are not hit when debugging in RAM
Information in this knowledgebase article applies to:
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?
µ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.
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.
Last Reviewed: Friday, February 24, 2017
of your data.