Monday, February 18, 2008

Using Eclipse IDE for WinAVR compiler AVR

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 AVR device explorer



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:

Image

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.

New AVR-GCC project in Eclipse

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.

Image

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

AVR clock source

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.

Eclipse AVR project

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.

Ref :http://winavr.scienceprog.com

No comments: