Download BACHELOR THESIS
Transcript
5.2.2 Alternative way of breakpoint implementation At the beginning of the design of the monitor I was deciding between two possibilities for implementing breakpoints. The method I used is explained above. Another possibility is to use FPB in “remapping” mode and store jump instruction somewhere in debugger memory. The principle of this solution is described on figure 5.5 . After match occurred instead of BKPT instruction the address stored in FPB unit is stored (base + offset ) and jump in to RAM is performed. This feature could be also used for program modification without need of flash memory writing. Figure 5.5: Alternative way of breakpoint implementation 5.2.3 Data Watchpoint and Trace unit The DWT is an unit that contains four comparators that you can configure as a hardware watchpoint, an ETM (Embedded Trace Macrocell) trigger, a PC sampler event trigger or a data address sampler event trigger. The first comparator, DWT_COMP0 (DWT Comparator Registers), can also compare against CYCCNT (the clock cycle counter). The second comparator, DWT_COMP1, can also be used as a data comparator. You can configure the DWT to contain only one comparator that can be used as a watchpoint or as a trigger. If only one comparator is present then data matching is not supported [16]. The DWT contains CYCCNT, folded instructions, LSU (load Store Unit) operations, sleep cycles, CPI (all instruction cycles except for the first cycle) and interrupt overhead. Implementation of watchpoint is done in a different way from breakpoint. Each DWT_FUNCTIONx (DWT function register) has one bit indicating match event (this bit is cleared on read) so there are no difficulties related to DWT unit at all. Activation of watchpoint is done by setting appropriate values in to the DWT_COMP, DWT_MASK (DWT mask register) and DWT_FUNCTION registers [16, 2]. 58