Debug the chipKIT boards with MDB¶
This section requires the embedXcode+ edition and a chipKIT board with the optional chipKIT PGM programmer-debugger.
This section applies to the chipKIT boards with the optional chipKIT PGM programmer-debugger.
The debugger is called MDB and is part of the official Microchip MPLABX IDE
- To launch a debugging session, just select the Debug target and press Run.
embedXcode builds and links the project, and then opens one Terminal window.
Identify one Terminal window¶
The Terminal window hosts the programmer-debugger. The tool first connects to the board, then uploads the executable and all the breakpoints defined previously, and finally runs the project.
Run and stop the sketch execution¶
Here are the most common commands to run, stop and continue the execution of the sketch in a debugging session:
- Enter the commands after the
>prompt and validate it by pressing the Enter key.
- When the debugger stops, type
cto continue till the next breakpoint.
> continue > c
- To run the sketch one step to the next line of code to be executed, including the sub-functions called by the current function, type
> step > s
- To run the sketch to the next line of the current function, without stopping at the sub-functions, type
> next > n
- To stop the sketch, type
- To list the breakpoints defined and loaded, type
>info break Num Enb Address What 0 y 0x9D0013A8 at LocalLibrary.cpp:25
For more information,
- Please refer to the Microchip Debugger (MSB) User's Guide .
Display the value of a variable¶
To get the value of a variable,
- Type the command
>print pin pin= 0x0D
Display the call stack¶
To display the stack of the calls,
- Type the command
>backtrace #0 blink (pin=0x0D, times=0x03, ms=0x20B2) at /Users/ReiVilo/Documents/Projets/Xcode/embed1/embed1/LocalLibrary.cpp:26 #1 0x9D0013CC in loop () at /Users/ReiVilo/Documents/Projets/Xcode/embed1/embed1/embed1.ino:106 #2 0x9D001404 in main () at /Users/ReiVilo/Documents/Projets/Xcode/embed1/embed1/main.cpp:93
blink() function is called by the function
loop() is called by the main function
The backtrace command also provides the details of the parameters and values passed by
loop() on to
Here, values are
0x0D corresponds to variable
End and quit a debugging session¶
To end the debugging session,
>halt Halting... Target Halted >Stop at address:0x9d001f1c
To quit the debugging session,
>quit Stop at address:0x9d001370 file:/Users/ReiVilo/Documents/Projets/Xcode/embed1/embed1/LocalLibrary.cpp source line:26
- Always quit and close the Terminal window.