Software Breakpoints
You can use software breakpoints by enabling:
•Hardware / Use Software Breakpoints / <coreID> or
•Core-specific option in the Hardware / CPU Options / <coreID>.
Available hardware breakpoints often prove to be insufficient. Then the debugger can use unlimited software breakpoints to work around this limitation.
Setting a Software Breakpoint means modifying flash memory. Editing flash memory during debug session is disabled on some devices. In this case software breakpoints won't work. |
When using software execution breakpoints, winIDEA will change the object code on the target address and replace it with a special instruction, which stops the CPU execution. Once the breakpoint is hit and you wish to continue the execution, the code is switched to its original state, the instruction is stepped over and the code is again replaced with the breakpoint instruction. While all this is done in the background, you should be aware that:
•Microcontroller memory is being manipulated each time you interact with the breakpoint, which can amount to a significant number of memory writes. This can put a serious stress on the microcontroller memory, specially internal FLASH which usually has a limited number of guaranteed write cycles.
•When using software execution breakpoints on an application loaded in FLASH memory, you will notice delays when interacting with these breakpoints. Each time a breakpoint is interacted with, a whole sector of the FLASH memory needs to be erased, modified and programmed back, which takes time. You can speed this up somewhat by enabling Hardware / CPU Options / Debugging / Set/Clear SW BPs before Run, which means that if you set several successive breakpoints, each FLASH sector will be programmed only once (when the CPU is set to run) instead of once for every breakpoint.
•Debugger, when executing source step or run until debug command uses one breakpoint. Hence when all available hardware breakpoints are used as execution breakpoints the debugger may fail to execute the debug step. The debugger offers Reserve one breakpoint for high-level debugging option in the Debug / Debug Options / Debugging page to circumvent this. By default this option is checked and you can uncheck it anytime.