Up to 32 hardware address/data breakpoints are available to use on the emulation header (see also Runtime Watch, Breakpoint and Trace Resources). Software breakpoints are useful, but real hardware breakpoints are incomparable when you need unfettered control of qualifying the breakpoint/event conditions beyond the simple address matching. Consider the addition of a special interrupt contextual qualifier and these hardware breakpoints offer a high degree of configurability.
Emulation header hardware breakpoints can trigger without halting execution and could be used as trigger events to other features.
Address/Data Breakpoints may be found and set up on the New Breakpoint Dialog (Debug>New Breakpoint) by choosing either “Address” or “Data” as the “Breakpoint Type”. After the breakpoint is created, it can be edited by right clicking and selecting “Customize”. For details, see the MPLAB® X IDE documentation.
A breakpoint may be specified to occur with a range of program or data memory. A start address and then an end address are specified for the breakpoint. Then the break condition is selected.
The dialog items used to set up range breakpoints are described below.
|Enable Range Address||Check to set a range breakpoint.|
|Address (Start)||Enter a starting hexadecimal memory address.|
|Address (End)||Enter an ending hexadecimal memory address.|
|Breaks on||Specifies the conditions of the break.
Conditions differ for address memory and data memory.
Data Value Comparison
Data memory breakpoints may be set up to compare a “Break on” value to another value before breaking.
The dialog items used to set up data value comparison are described below.
|Breaks on||Specifies the conditions of the break.|
|Value||For the “Breaks on” selection of:
- Read Specific Value
- Write Specific Value
- Read or Write Specific Value
Enter a hexadecimal value here.
|Value Comparison||Compare to “Value” as specified:
= Value: Equal to value
!= Value: Not equal to value
> Value: Greater than value
< Value: Less than value
Data Value Mask
Data memory breakpoints may be set up to compare a masked “Break on” value to another value before breaking.
To set up a value comparison, see “Data Value Comparison”.
The dialog items used to set up a data value mask are described below.
|Data Value Mask||Use mask when comparing to “Value”.
Enter a value in the range 0x00 to 0xhh, where:
0x00: No bits compared
0xhh: All bits compared
Pass Count Operation
Using a pass count allows you to delay breaking until after a specified count.
Event must occur Count times
Count is the number of times you will pass the breakpoint before stopping. E.g.:
- 0 means execution will stop immediately
- 1 means execution will pass once then stop the next time (stop on second time)
- 10 means execution will pass 10 times and stop the next time (stop on eleventh time)
The dialog items used to set up a pass count operation are found in the “Pass count” section of the dialog and are described below.
|Condition||Determine when the break specified under “Breaks on” occurs.
Always Break: Always break when the “Breaks on” condition is met.
Event must occur Count times: An event (“Breaks on” condition)
must occur Count times before actually breaking.
Trigger Out Operation
A trigger out pulse can be generated when an address or data breakpoint is reached. For more on triggers, see “Trigger In/Out”.
The dialog item used to set up trigger out operation is described below.
|Trigger Options||Select when to trigger, either:
- Do not emit a trigger out pulse when breakpoint is hit
- Emits a trigger out pulse when breakpoint is hit
Interrupt Context Detection
An address or data breakpoint can be set based on the context of an interrupt. You can set up the breakpoint so it only breaks when it is in the interrupt section of code (ISR), only when it is in main line code, or when it is in either ISR or main code. This can assist when attempting to narrow down issues in code regions.
Address/Data Breakpoints may be found and set up on the New Breakpoint Dialog (Debug>New Breakpoint) by choosing either “Address” or “Data” as the “Breakpoint Type”. After the breakpoint is created, it may be edited by right clicking and selecting “Customize”.
The dialog item used to set up interrupt context is described below.
|Interrupt Context||Interrupt Context qualifier for address/data breakpoints. Select from:
Always break - break in both ISR and main code
Break in main line (non-interrupt) context only - break in main code only
Break in interrupt context only - break in ISR code only