[TUT] [IDE] Using NetBeans for AVR development

1 post / 0 new
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've seen a few posts about using NetBeans for AVR development and none of them seemed very complete.
I've been using NetBeans to develop quite successfully on AVRs for quite some time and thought I'd share my method. I first shared this with the LUFA mailing list (original) and will start with an edited version of my post from there. I intend to (slowly) edit this and add improvements over time. See end of post for future plans.

I'll try to keep this tutorial as general as possible as I think it's more for people that are already using NetBeans for something else and want to extend those features to their AVR work. Some examples are given, usually windows variations.

NetBeans also works incredibly well with svn (among other VMS) and 3rd party git with builtin coming


  • NetBeans with C/C++ plugin
  • AVR toolchain (WinAVR, avr-gcc)

Add avr-gcc tool collection to NetBeans

  1. Options > C/C++ > Build Tools > Add... (bottom left)
  2. Browse to base directory (C:\Program Files\WinAVR\bin)
Newer versions of NetBeans will automatically fill in Collection Family and Name (cosmetic names) and subsequently avr-{gcc,g++,as,gdb}.exe, make.exe and all the code assistance tabs.

Create a new C/C++ project and be sure to select the AVR toolchain we just created.
Starting a project from existing sources (selecting your Makefile) should work just fine and your build and build-clean will work. The folder names created in the project view are cosmetic and can be changed to match a {Header,Resource,Source,Test,Important} template, but I usually start a "new" project and replace the generated Makefile (not in the nbproject folder) with my own and you just need to "add existing files" to the project to have them show up in the project list.

Add other make targets to use
You're Makefile now shows up under "Important Files" and you can right click on it to run custom targets (ie 'program')
The build buttons at the top work for building and clean building, but the "run" buttons (normal, debugger) don't work. There is probably an easy hack to make this 'make program run'

When on windows, I also add a run target that launches a putty window with my saved settings.

Add standard AVR defines that avr-gcc sets so NetBeans's code completion works
They're set in "Preprocessor Definitions" in the Project's options, under build, for the language (C or C++) of choice (or both). Don't forget to set build configuration at the top to all. The most important one is the chip you're using (ie __AVR_ATmega328P__) so NetBeans follows the correct include in and second most is F_CPU (ie F_CPU=8000000UL)

Future plans

Make a kind of advanced version of the Arduino platform

  • Use NetBeans's makefile architecture
  • Template specifically for AVRs
  • Create plugin for avrdude
  • Serial Console
  • Support Arduino library
  • Visually show connections between C/C++ source and asm/lst output (I know, crazy right?!)
  • Support gbd/simulavr (where do I even start?!)

Pushing AVRs to their limits