Given that the Requirements For Debugging are met, the following actions will be performed when the MPLAB® REAL ICE™ in-circuit emulator is set as the hardware tool for your MPLAB X IDE project (File > Project Properties, “Hardware Tool” category, "Real ICE > SN XXXXXX") and Debug > Debug Project is selected.
1
Program Application Code
The application code is programmed into the device’s memory via the ICSP protocol, as described in Emulator Operation.
2
Program Debug Exec
The small Debug Executive program is loaded into high program memory of the target device. Because the Debug Executive must reside in program memory, the application program must not use this reserved space. Some devices have special memory areas dedicated to the debug executive. Check your device data sheet for details.
To determine the amount of program memory that must be reserved, see the MPLAB X IDE desktop, Learn & Discover tab, "Users Guide & Release Notes", "Reserved Resources for MPLAB REAL ICE in-circuit emulator", and select your device.
3
Enable Debug Features
Special “in-circuit debug” registers in the target device are enabled by MPLAB X IDE. These allow the debug executive to be activated by the emulator.
To determine the registers that must be reserved for debug, see the MPLAB X IDE desktop, Learn & Discover tab, "Users Guide & Release Notes", "Reserved Resources for MPLAB REAL ICE in-circuit emulator", and select your device.
4
Debug Run Program
The target device is run in Debug mode.

