Energia IDE Stellaris LM4F Hardware Debugging

by Visual Micro 17. January 2016 17:04

18th January 2016 - Draft - GDB Tested with Stellaris Launchpad LM4F 3rd Party hardware authors please read how to add support for more boards here

This initial beta is the first of a new range of Visual Micro GDB debuggers for micro-controllers like Arduino.

This beta still has a few rough edges so please be patient.

Better documentation will follow shortly. Please read the following information before testing. Final release will be simpler and more standard configure.

With this release an "Arduino GDB - beta" project must be created using "File>New>Project>C++>Cross Platform".

Visual Micro must already be installed along with the Microsoft tools described below. Please use the forum for assistance and feedback.

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

Overview and Install Instructions

The intial instructions explain how to alpha test the gdb-ino debug tools in Visual Studio 2015.

VS 2015 Community Edition is a free Ide for everyone, except large organizations. Large organizations can use for free for open source projects.

  • Visual Micro uses the standard C++ tools of Visual Studio to provide Arduino programming. The C++ tools are a custom option durng install or at a later date via Control Panel>Add or remove programs.
  • Last year Microsoft added support for Crosss Platform C++ projects in addition to tools for Andoid. The Android tools must be installed in the same way as the C++ tools described above. 
  • In November 2015 Microsoft released the "Microsoft Gdb Debugger" extension into the Visual Studio gallery. The Microsoft Gdb extension is a free download from within the Ide. Click "Tools>Extensions & Updates>Online>Visual Studio Gdb Debugger (by Microsoft)". Or intall from this gallery link
  • Visual Micro is also a free install from within the Ide using "Tools>Extensions & Updates>Online"
  • The Arduino Ide can be downloaded from the respective hardware vendor such as arduino.cc and arduino.org


Installing all of the tools descrived above is currently a requirement for the beta gdb tools in Visual Micro. 

Visual Micro is also an extension and can be installed/uninstalled via the Gallery in the same way as the Gdb debugger.

After install a new project template will be available under the "File>New>Project>Cross Platform" and a template called "Arduino Gdb".

You can also create a standard Gdb make project then add an .ino source file of the same name.

Visual Micro should now be managing the project. Select the Energia Ide and Stellaris board in Visual Micro and then test upload.

Uncheck the project from the "Build>Configuration manager" build list. We don't want VS to build just to debug :) Vm will buidl when required.

That is all the setup. The last point must be done once for each new project.

To run the gdb debug use any of the standard Visual Studio "Debug" commands (not the Visual Micro tool bar or menu commands)

Do not use more than 3 breakpoints!! 4 are supported but stepping runs out of steam with 4 and the debug stops responding.

If the debugger locks up then kill the openOCD.exe process in task manager. If it is not loaded then kill the MicroGdb.exe process.

If you can't upload or the board is in a bad state after debug discopnnect and reconnect or kill the OpenOCD.exe windows process if it has remained open.

Know lock up causes are:- 1) Source code out of date 2) Optimization prevents all breakpoints from being recognized 3) The odd strange quirk :)

Known issues

  • Some source code paths are incorrect causing temp folder sources instead of local project sources to open during debug.
  • With "Debug" configuration, .ino line numbers are out by 1. Please use "Release" configuration for the beta
  • Stepping line position a little erratic sometimes see instruction stepping when line stepping was selected.
  • Microsoft are working on a new release with improved visual display and better support for mcu's

Which backend Ide?

Energia 1.6 (2016/2017)

Related Articles