SW (Software) breakpoints are implemented by temporarily replacing the instruction opcode at the breakpoint location with a special "breakpoint" instruction immediately prior to stepping or executing your code. When the core executes the breakpoint instruction, it will be forced into debug state. SW breakpoints can only be placed in RAM because they rely on modifying target memory. A HW (Hardware) breakpoint is set by programming a watchpoint unit to monitor the core busses for an instruction fetch from a specific memory location. HW breakpoints can be set on any location in RAM or ROM. When debugging code where instructions are copied (Scatterloading), modified or the processor MMU remaps areas of memory, HW breakpoints should be used. In these scenarios SW breakpoints are unreliable as they may be either lost or overwritten. Also see the following related FAQs:
|