Arduino Zero/M0 Build, Upload and GDB Debugger

by Visual Micro 3. January 2016 19:32

Overview

Any visual micro project, with the android tools installed, can now run gdb debug without need for the cross platform projects used previously (still supported). For Gdb, automatic debugging can remain at default state (on).

Selecting the Arduino Zero/M0 (or board with debug.tool defined) and clicking "Debug>Start debugging" will start a GDB debug session. "Debug>Attach To Process" will start gdb without build/upload.

GDB does not yet support the special break-point commands, such as {@plot}, that can be used with the Visual Micro usb debugger.



Existing users (Projects created pre Sept 2017) please note - Older project need a minor update

The Visual Micro new project templates now contain two new properties in the .vcproj files. However existing visual micro .vcxproj files currently need to be updated manually (or deleted and re-created using "file>open>arduino project") before GDB will work.

To edit a .vcproj users can right click a project in the solution explorer then click Unload. Then right click again and click "Edit project.vcxproj". Adding the ItemGroup and PropertyGroup shown below will allow gdb to work. fyi: I added them just prior to the existing <ItemGroup> entries.

Right click the project in the solution tree and select Reload project to reload the project again.

Old .vcxproj update to support gdb. Add the following xml:-
  <ItemGroup>
    <ProjectCapability Include="VisualMicro" />
  </ItemGroup>
  <PropertyGroup>
    <DebuggerFlavor>VisualMicroDebugger</DebuggerFlavor>
  </PropertyGroup>

Key features

  • Comatible with .ino source code
  • Debug sketch, libraries and core
  • Step by Line or Instruction
  • Step Over, Step Out
  • Move instruction pointer
  • Set/move breakpoints (3 max)
  • Inspect memory, locals, call stack
  • Disassembly or source navigation
  • Immediate expression evaluator
  • Watch expressions, local expressions, auto expressions
  • Breakpoints, trace points, conditional breakpoin expressions
  • Pin variables during debug sessions. Easily see values. Add notes/comment.
  • Drill down into variables
  • Gdb command tool - optional manual interaction with the debugger (limited testing)
  • Toolchain, ocd and gdb automatic configuration based on the selected Arduino board
  • Automatic/background conversion between cpp and Arduino format .ino source code
  • Auto highlight changed data - Easily see which registers and variables have changed.
  • One button click: Build>Upload>Debug

 

NOTE: Compiler optimization can prevent breakpoints from becoming active.

Related Articles