Debug Executive

Last modified by Microchip on 2023/11/09 09:10

Overview of the Debug Executive

A debug executive is a small program used in conjunction with your application code to facilitate the on-chip debug process. It is used by all Microchip PIC® MCU and dsPIC® DSC debug tools including the MPLAB® REAL ICE in-circuit emulator, MPLAB ICD 3 in-circuit debugger, and PICkit™ 3 in-circuit debugger, as well as the stand-alone starter kits.

Debug Executive

When using an in-circuit debugger to debug your program, some of the chip's resources are reserved for debugging functions. Your code isn't the only thing that gets programmed into the device. A small program called the debug executive is automatically added to your code when you build and program for debugging. Its job is to run commands sent by the PC and to control the debug process. While your program is running, it sits quietly in the background. However, whenever a breakpoint is reached or a command is received from the PC, control over the device is transferred to the debug executive.

The debug executive requires a small amount of code space, a few registers in data memory, and one or two levels of stack. In addition to on-chip resources, the ICSP™ lines must be dedicated to the debug process. This means that the I/O pins multiplexed with debug clock, data, and PGM (if used) may not be used by your application while debugging.

Back to top

Resource Needs

  • Exclusive use of two I/O pins
  • Shared control of the MCLR pin
  • Some file registers (RAM)
  • Some program memory locations (Flash)
  • One or two hardware (return) stack locations

Back to top

Reserved Resources By Device

To determine what device resources are reserved when debugging, open the Reserved Resources page in your local MPLAB X IDE Support Documentation:

MPLAB X IDE support documentation reserved resources

Here is an example listing for the PIC16F1823 MCU:

reserved resources pic16f1823

Back to top