Arduino 3rd Party Hardware GDB Configuration Guide

by Visual Micro 17. January 2016 17:40

Overview

 

Note: This solution uses the Microsoft MI (gdb) debugger that is installed with the Andoid tools for Visual Studio

 

Visual Micro supports the standard hardware definitions defined by each Ide version. These definitions are usually included in a board.txt and/or boards.txt and/or platform.txt.

 

note: The openOCD path is populated automatically by Visual MIcro and does not need to be installed. Additonal .cfg files can be posted to the forum for inclusion in the releases or added to the "visual micro install path\default\tools\openOCD" folder structure. The install path can be viewed via tools>options>visual micro>version.

 

Please see problem solving tips for developers below.

All PropertiesExample (OpenOCD is installed with Visual Micro)

#boards.txt

[board_name].build.openocdscript=board/[open ocd config file name].cfg

#board.txt

build.openocdscript=board/[open ocd config file name].cfg

#board.txt or platform.txt

debug.tool=gdb

tools.gdb.pre_init.tool=openocd

tools.gdb.cmd=[hardware tool chain gdb.exe]

tools.gdb.path={runtime.tools.[hardware tool chain path}/bin

tools.gdb.pattern="{path}/{cmd}" ­interpreter=mi ­d "{build.project_path}"

tools.gdb.openocd.cmd=bin/openocd.exe

tools.gdb.tcp=localhost:3333

tools.gdb.openocd.path={runtime.vm.ide.platforms.path}/default/tools/openocd­0.9.0

tools.gdb.openocd.params.verbose=­d2

tools.gdb.openocd.params.quiet=­d0

 

tools.gdb.openocd.pattern="{path}/{cmd}" ­s "{path}/scripts/" ­f "{path}/scripts/{build.openocdscript}" 


The following example is the definition of GDB debugging with OpenOCD for the Texas Instruments Stellaris LM4F/120

 

1) Boards.txt - Provide the name of the OpenOcd .cfg script for the lm4f120

 

# Boards.txt - LaunchPad (Stellaris) w/ lm4f120 (80MHz)

# ------------------------------------------


lplm4f120h5qr.build.openocdscript=board/ek-lm4f120xl.cfg


 

2) Platform.txt - Configure all boards to use OpenOCD+GDB  

 

# Platform.txt - LMF4

# ------------------------------------------

 

# master switch to enable the gdb debug tool

debug.tool=gdb

 

tools.gdb.cmd=arm-none-eabi-gdb.exe

tools.gdb.path={runtime.ide.path}/hardware/tools/lm4f/bin

tools.gdb.pattern="{path}/{cmd}" -interpreter=mi -d {build.project_path}

 

tools.gdb.pre_init.tool=openocd

tools.gdb.openocd.cmd=bin/openocd.exe

tools.gdb.openocd.path={runtime.vm.ide.platforms.path}/default/tools/openocd-0.9.0

tools.gdb.openocd.pattern="{path}/{cmd}" -s "{path}/scripts/" -f "{path}/scripts/{build.openocdscript}"


#
# --------------------------------------

note: OpenOCD is optional. v9.0 is currently installed with Visual Micro spo the location will always be the same (as shown below).

Attachment: The attached platform.txt and boards.txt files are the Arduino 1.5 style definitons used by Visual Studio to compile the Energia Stellaris lmf4 core. Both files are optional and are used in combination with the "actual" defintions that might be installed with each Ide.

boards.append.txt (419.00 bytes)

Please submit new defintions that your would like to be distributed with Visual Micro via email or our forum. Arduino 1.0, 1.5, 1.6 formats are supported, all three can be installed at the same time.

GDB and OpenOCD - Problem solving tips - GDB attempts to start but fails with error

Visual Micro installs a small program called MicroGDB.exe. When a Visual Studio GDB session runs it is the MicroGDB.exe program that is loaded/executed.

 

The MicroGDB.exe attempts to run GDB and OpenOCD (when applicable). Theh MicroGDB creates trace files of the various conversations between gdb/microgdb and visual studio. MicroGDb also writes an error trace.


There will be trace files for gdb in the local vs project temp build folder:-

[configuration name]\logs\gdb

which means

debug\logs\gdb

or

release\logs\gdb


If you click Project>Build you will see build without attempt to launch gdb. The start commands will attempt to run GDB.

 

Sometimes after errors configuration errors the OpenOCD, MicroGDB.exe or gdb processes will remain running (see task manager). In this case they need to be manually terminated before a new gdb session can be established.


GDB and OpenOCD - Problem solving tips - GDB running but behaving badly

If the debugger is running but code can not be found or behvour is not as expected.
Use vMicro>Toggle Hidden Files to ensure all sources are available to the debugger
Ensure Gcc optimization is set to the correct value for the code you are trying to debug
Ensure the correct compiler switches for the hadarware being used
Discuss in the visualmicro.com form



Tags: