Menu

About avr-gdb

howtos (2)
hovercrfat-sf

General info:


avr-gdb is a special version of GDB: The GNU Project Debugger built for avr processor target, thus it can run and debug code writen for those processors. During debugging session, simutron runs in conjuction with this debugger.
* This kind of session is known as remote debugging. One program (in our case simutron) runs a debuggee - a code which will be debugged and provides a debugging server or backend. Another program (i.e. avr-gdb) communicates with debugging server via some protocol (in our case TCP/IP) and provides user interface to set breakpoints, step through code and so on.

How to obtain


  • Any platform
    • Latest Arduino IDE distributions contain avr-gdb binary, as well as full avr-gcc compiler stack and all required libraries. This is recommended toolchain. It is available for Windows, Linux and more.
  • Windows
    • avr-gdb included in the WinAVR SDK. Please download and install it from there: WinAVR download page
  • Linux

    • some Linux distributions maintain avr-gdb in its repositories. In this case you can install it from there, e.g. apt-get install avr-gdb . Otherwise, you can build it from common GDB source, which you can download from there: GDB: The GNU Project Debugger , or for example direct link to gdb 7.12 source tarball .
      Unpack it and in the source root folder run:
      ./configure --target=avr --prefix=${HOME}/local/simutron
      make
      make install

    ${HOME}/local/simutron is a directory where personally I put simutron files and install all the related tools. In this way I avoid root privilege requirements.
    Note: prior to building avr-gdv it may be necessary to install avr-gcc toolchain, which is certainly available in every Linux repository.

Setup with CodeBlocks IDE


In CodeBlocks main menu choose "Settings", "Debugger.."
Cilick "Common" item on the left. Fill in parameters as follows:
CodeBlocks-avr-gdb-setup.png
Cilick "GDB/CDB debugger" item on the left.
Click "Create Config" button.
Type in a name for debugger configuration, e.g. avr-gdb, press Ok.
CodeBlocks-avr-gdb-setup-1.png
New configuration appears at the left under "Default". Click it.
Fill in parameters as follows and press Ok:
CodeBlocks-avr-gdb-setup-2.png
In CodeBlocks main menu choose "Settings", "Compiler.."
Select "Global compiler settings" on the left.
In the combo box at the top choose the AVR gcc compiler suite you used to compile your firmware.
Go to the "Toolchain executables" tab.
In the "Debugger:" combo box select avr-gdb configuration you just created. Press Ok.
CodeBlocks-avr-gdb-setup-3.png
Right click your AVR firmware project in the projects tree, select "Properties..".
Go to "Debugger" tab, select the target where you built debugging version of your firmware.
Fill in "IP address:" and "Port:" fields as follows:
CodeBlocks-avr-gdb-setup-4.png

Congratulation!
Now you can start debugging yor code.


Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.