Using Eclipse as IDE for WinAVR compiler

WinAVR comes with Programmers Notepad UI by default. It is very powerful editor, but if you want more robust UI with better project management abilities you can try Java based Eclipse IDE. It is universal open source IDE which supports almost any compiler by using plugins. Eclipse has some nice features that makes it attractive, like Subversion integration, code completion in editor.

Thomas Holland has been working on AVR plugin for Eclipse which allows to use Eclipse features with AVR-GCC compiler. The newest release has nice set of features and updates like: automatic makefile generation, MCU type and clock frequency can be selected during project creation, project can be compiled for debug only or as complete release with flashable hex files, tool-chain has integrated assembler, nice viewer showing information about processor used where you can find all registers, ports, interrupts in one convenient place for quick pick-up.

Eclipse doesn't require installation, just extract to some directory. You just need to set path to projects folder during first run. AVR Plugin also doesn't need any special installations, just extract to Eclipse directory and thats it. Also plugin can be installed remotely by using Eclipse Software update feature.

I just tried to compile one of my project with this environment – it worked without problems. Lets go through how to compile your first AVR-GCC project in Eclipse IDE. First of all make sure you have latest WinAVR tools installed. Then download Eclipse for C/C++ for Windows platform:

Extract it to some directory. Then download plugin and extract it to Eclipse directory(just follow original explanation). When its all set, we can start new project. I am using project files created so I will need to add then to Eclipse project only. But first of all... In Eclipse select New->Project and then select C Project.

Select AVR Cross Target Application In Toolchain section you can see WinAVR Toolchain selected. Enter project name and click Next. In next window you will have to select build configurations that include various settings that have to be included in makefile. Settings can be saved separately for debug and release configurations. Lets say wee select Release configuration.

By pressing advanced settings you may change additional makefile settings. But lets leave then by default. Press Next button.

Here you must select AVR microcontroller and its clock frequency. After selections are done click Finish button to prepare new project. To add files to project you can create new or add existing source files. I just used drag and drop feature to add files to project tree. Files also are copied to project folder physically.

I made IDE window smaller to show how all workspace look like. In the left you can see project tree where source files are added. Next window is for file contents. Then goes project outline. And the bottom are has several tabs for displaying problems, properties, console and earlier mentioned AVR device explorer. I really like the way Eclipse extracts outline from source file. It is easy to find and navigate by selecting variables, functions and defines. Source code outlining is also pleasing. Even things like #ifdef ...#endif areas are greyed if not defined.

Compiled release is placed in different folder where all object, hex and other compilation products are saved – this way it keeps source folder clean.

My first impression with AVR Plugin for Eclipse is very good. I would say this is must try tool. As it is quite new plugin, I would expect bugs or problems appearing. I think main problems may appear with makefile generation, so you can always use external makefile if needed. As far as I tested this plugin with basic AVR programs it worked without problems.

AVR Plugin for Eclipse home page: http://avr-eclipse.sourceforge.net;

AVR Plugin for Eclipse can be downloaded here;

Eclipse IDE can be downloaded here: http://www.eclipse.org/downloads/;

Latest WinAVR can be downloaded here.

Comments

hi allis possible debugging program in eclipse or is compiler only??

It is only a GUI, that makes easier to edit and compile avr-gcc programs.

hi administrator :-),thanks for taking the time to create this helpful tutorial. your image based tutorial helped me lot ;-) after compiling few lines of source code i noticed that compiled code size is too large :-? to reduce the compile file size i applied some settings like this one http://puranranablog.blogspot.com/2011/05/winavreclipse-ide.html and found dramatically changes in compiled file size :-xcheers,b.rose

How to setting External Memory?

tihi is the first C++ project and first time start gcc-avr and fist time using eclipse , but do not now how to make a program , i have a dome made devoard with atmega 16 lcd lm35 ir and much more all i need is a lcd exampe and a buton example.
if is posible export as eclipse plugin to explore its structure.