11.1.2 Debug Extensibility Using Python Scripts

A developer can use python scripts in autoload.py to customize the debugging experience in MPLAB X IDE.

Why use scripts:

  • To automate complex setup scenarios (e.g. debug applications normally loaded by a bootloader.)
  • To automates debug tasks (e.g. stop external processes when an MCU is halted in the debugger, such as robot motors.)
  • To add actions to breakpoints (e.g. send mail on breakpoint, inspect and change memory during a halt, etc.)
  • To read and write device memory, registers, set breakpoints, halt and resume device execution.

Scripts can use most of the Jython libraries, such as file access, mail access, regexp etc.

How to use the scripts:

  • MPLAB X IDE will parse autoload.py from the project folder, if present.
  • autoload.py can load other python files or modules. However, the variables injected by the IDE into the python namespace are not visible in files/modules loaded from autoload.py.
  • MPLAB X IDE calls functions with hardcoded names when a debugging event occurs. These functions can manipulate and alter the memories and registers of the device being debugged.