Debugging Tutorial for Arduino

× Not what you are looking for? Did you want hardware debugging with gdb or gdbstub?"

The following tutorial is a step-by-step walkthrough that introduces you to the powerful features of Visual Micro Debugging.

As a prerequisite, we assume that you have Visual Micro installed and that you have already successfully uploaded a sketch to your board.

Initial Preparation

The tutorial makes most sense, if you execute the steps shown here by yourself. Therefore, we will set up a test sketch. Follow these steps:

  •  Please open an "empty" Visual Studio or Atmel Studio.

    Note IconNote:

    To make sure that Visual Micro works as described in this tutorial,
    go to this documentation page and make sure all program settings are set to their defaults as indicated with the Tutorial Icon icon.

    (The tutorial requires no special settings, but we want to make sure that the defaults are set correctly everywhere)

  •  Make sure that Visual Studio/Atmel Studio is set to the "Debug" configuration, by setting this toolbar control to "Debug":

     Debug/Release Toolbar Control


    Debugging is only controlled by the Debug/Release configuration, if vMicro > Debugger > Automatic Debug is switched on (recommended!)

  • Make sure the Output Window is open and visible. Choose View > Output in the menu.
    Click on the "pin" symbol at the right border of the output window to make it permanently visible:

    Output Window Pin Symbol

Now you should see the Micro Boards toolbar in the toolbar area:
Visual Micro Toolbar

This tutorial uses an existing Arduino example, therefore...

  •  Click on the VM Toolbar Question Mark Icon in the Arduino Boards toolbar
  •  Click on the "Examples" tab, then open the "Digital" node and click on "BlinkWithoutDelay"
    In the following message box, choose "Open Copy".
    The "BlinkWithoutDelay" examples opens, which will be your test object in the course of this tutorial.

Opening Micro Explorer Tutorials Example


Now your Visual Studio/Atmel Studio is prepared for the tutorial.
The tutorial is divided into separate sections.

The first sections concentrate on the most basic functions, and the later sections will introduce more powerful features. It's up to you, if you work through all the sections, or if you concentrate on the more basic functions. Every section is about a certain aspect of debugging.

Continue with part 1: What breakpoints are good for