The LOOP1 Mode feature when selected writes a register to allow the hardware to use the C comparator and not store duplicate addresses in trace. In LOOP1 capture mode, the addresses for instructions executed repeatedly, for example, loops with no change of flow instructions and recursive calls, are stored and showed in trace only once.
The hardware uses comparator C available only on variants with DBGv3, which cannot be used for trace, to store the last FIFO address. Only comparators A and B can be used for trace on all variants. However, in LOOP1 capture mode, comparator C is not available for use as a normal hardware breakpoint, and is managed by logic in the DBG module to track the address of the most recent change-of-flow event that was captured into the FIFO buffer.
To set a trigger in LOOP1 Mode:
The application stops automatically and collects data in data file.
The trace data that is collected contains only two calls to Recursive(int n). This is because the three identical PCs in trace for if (n <= 0) is ignored by the hardware and appears only once in LOOP1 mode.
In the normal mode, the hardware would have stored the identical addresses one after another. The figure below shows the trace and timeline data that is collected when LOOP1 Mode option is disabled. Make sure that you clear the LOOP1 Mode checkbox in the Trace and Profile tab, keep the remaining settings same and then collect trace.
In the normal mode, the trace data contains four calls to Recursive(int n) with arguments 3, 2, 1, 0, and three times branch for if (n <= 0), that is three identical PCs in trace. Fourth address of the conditional assembly instruction for if (n <= 0) is not in the trace because that branch is not taken anymore and the last recursive call exits with return 0.
With the LOOP1 Mode option enabled, the hardware skips the identical addresses and keeps only one address instead of three; therefore, the trace data contains only two calls to Recursive(int n).