Arduino Studio M0Pro Debugger


Thanks to nettigo team for their article.


What is a debugger

The Arduino M0 Pro represents a simple, yet powerful, 32-bit extension of the Arduino UNO platform.
The board integrates an Atmel’s Embedded Debugger (EDBG) which provides a full debug interface with no need for additional hardware, making debugging much easier.
Debugger is a tool for control and analyze your program at runtime : you can going through your code step by step (by breakpoint or line) and know variables value at specific moment and inspect your sketch behavior/flow.


How it works

Let's see how ArduinoStudio works!

Connect your board to programming

Arduino M0Pro programming port  

When click on debug icon Image   the Debugger start (or stop if the panel is already visible) automatically

With halt icon  Image   you can stop sketch and analyze your environment :
to do this you had to set your breakpoints and step through them with Image  .
You can analyze your sketch line by line using step Image  
While stopped at a breakpoint you can see values of variables clicking  Image  
If you want, pressing  Image   will appear in the console a list of all breakpoints (in all project files)

After finishing your analysis,  press  Image to restore the normal execution of the sketch  





OpenOCD (Open On-Chip Debugger) is an open source software that provides debugging, in-system programming and boundary-scan testing for embedded devices.

The OpenOCD can be used with the GDB over the gdbserver. But it needs certain settings to be made before OpenOCD works with the gdbserver.

After OpenOCD is launched it listens on ports 3333 and 4444 : the first port is a GDB server, the second one is a telnet server, we'll use the first one. 



GNU Debugger is the most popular open source solution for debugging C/C++ programs.
GDB will be used to stop/restart execution, examine environments (stack, variables, etc. ), set breakpoints and others features.
We'll run GDB and then we'll tell it where find the running sketch, localhost:3333 (see above)