How to get started with Eclipse and AVR

Programming AVRs is fun, but sometimes the manufacturers development environments make code maintenance a chore. If your looking for a free, cross platform, high quality piece of software for programming AVRs Eclipseis a good choice.Moving to an Integrated Development Environment (IDE), such as Eclipse is a logical step up from learning to program basic functions. By using an IDE you will be able to work easier and work with a range of tools inside the same program. you will be able to easily package and reuse your code and you will have access to advanced functions like refactoring and code analysis. For details on these benefits please have a quick skim over Step 12: Quick Tour of Cool Features.In this instructable I will show you how to install and configure Eclipse to program AVR micro controllers (aka. Micro Controller Units or MCUs). I will also provide a quick run through uploading to your MCU and I will briefly cover some of the cool feature Eclipse has to offer.
How to Get Started With Eclipse and AVR

Step 1: Why?

Eclipse is cool. Like, really cool. Compared to something like the Arduino programming software, the Eclipse IDEis the proverbial Swiss army knife.For example, the Arduino development environment only lets you work in one file at a time. Also if you want to rename a variable you have to do a find/replace. If you want to take some code and wrap it in a method, you have to do it by hand. Eclipse can help with these otherwise tedious tasks and more. More generally speaking, moving to a fully featured IDElike eclipse is a step up from less full featured environments.Note: Yes, Eclipse can be used to program the Arduino – however the set up for this is slightly more complex and the specifics of using Arduino in Eclipse will not be covered here.

Step 2: Preparation

If you are operating on an office computer (i.e. in your place of work) you need to get permission to install software on your machine. It would also be prudent to check that the corporate firewall does not block http://Eclipse.org and http://sourceforge.net (just type these addresses into the address bar or click the links, if you get a warning from your firewall then you don’t have access to these sites).
If you are working from a home computer with an internet connection and your computer has USB ports your good to go.
To program AVR devices you will either need a programmer and your AVR (two separate units) or an AVR with a programmer on board, like the Arduino. If you don’t have either yet, I would advise looking into the Arduino or similar to get started. If you are at the beginner stage I would point you towards googling “getting started with Arduino” and taking it from there. Moving on to Eclipse is very much for when you are more sure footed about AVR development.
Brew up a cup (or glass) of your favourite beverage and hopefully we will be done installing before it gets cold, warm or whatever temperature it shouldn’t be…well, we should be done at least before it sprouts mould.
Download

Firstly we will need to download Eclipse itself. I recommend having a separate workspace and Eclipse version because the AVR plug in seems to corrupt both the Eclipse installation and the workspace over time (every now and again the installation inexplicably breaks, taking the workspace with it). So if you have eclipse already I would advise having a second copy on your computer and an ‘AVR workspace’ for AVR development so that any failures breakages are contained to AVR workspace. More on these issues later.Go to the eclipse website and find the downloads page (at the time of writing this is here; http://www.eclipse.org/downloads/packages/release/helios/r). The list of versions contains an entry titled “Eclipse IDE for C/C++ Developers“, next to it there should be a one or more links. Click the “32 bit” option for the platform that you are running (for example click the 32 bitlink next to “Windows:” if you are running a Windows machine). This should take you to the download page.Near the top of the download page should be some text reading “Download eclipse-cpp-helios-linux-gtk.tar.gz from:” followed by a link titled …Mirror Service…(http) or similar. Click the link and the download should begin.I will refrain from posting a link because Eclipse is updated fairly regularly, so you need to check this page to get the latest version.
Once downloaded, you need to extract the Eclipse program from the compressed file you downloaded. This step differs depending on operating system, but broadly, if you double click on the download an extractor program will open.  Extract the program to an appropriate place, for Windows users the Programs folder is acceptable. Open the eclipse folder that you just extracted and double click the eclipse executable. Eclipse will now start.
Note: It is a good idea to make a desktop short cut that runs the executable, to save time and effort later.
The start up screen will ask you where to find a workspace. If you do not know what this is leave this as it is and press OK. For the more experienced programmers, a word to the wise; Back-up your workspace either with version control or even just a local copy and avoid using an existing work space.

Step 4: Install AVR-GCC and AVR Dude

The AVR GCC toolchain is the compiler that is used to compile data suitable for AVR’s. AVR-dude is a tool for putting that information onto your AVR (basically it communicates with the AVR via the physical programmer).Windows
On a Windows machine simply go to the WinAVR site and follow the installation instructions. WinAVR(Help page here and download page here) has both of the above and a few extra bits to make things like debugging easier. Now go to the next step (the stuff below is for Linux users)!Linux
On Linux it is necessary to install the packages required manually, however the effort involved is no that much different. Go to your Package Manager and install the following;
– gcc-avr
– binutils-avr
– gdb-avr
– avr-libc
– avrdude

Step 5: Note about the CDT Plugin

Some instructions you find online indicate that at this point you should install the C\C++ Development Tools (CDT) plug in. This is not necessary in this case because we have downloaded the C\C++ version of Eclipse, which already has it installed. So… no instructions here, go to the next step…Stop hanging round here…we have installing to do!
Install-AVR-Plugin
The AVR plug in allows us to easily deal with AVR‘s from within Eclipse. Once installed it will allow you to build and deploy a C project to an AVR device. There are also neat features such as being able to pull up data on chips without having to refer to the data sheet.
To install the AVR plugin go to top menu in Eclipse, select Help>Install New Software. A new window titled Install will open. Near the top is a drop down box with “work with:” to it’s left. Click the box and type http://avr-eclipse.sourceforge.net/updatesite/ then click add. In the pop up box that appears type AVR Eclipse Plugin into the “name” box.
In the box below an entry (CDT Optional Features) should appear after a short while. Select the check box directly to the left of this entry and click Next . The next screen asks if the selected new packages are correct. Press Next. The next page asks you to agree to the terms and conditions. Check the radio button next to ‘I agree’ and click Finish .
A progress bar will slowly fill up, indicating that eclipse is installing the plug-ins specified. If there are any security warnings just click OK or Continue. The security warnings just relate to the fact that the plugin is not authenticated, it’s no big deal.
A pop up informing you that you need to restart eclipse will appear when the installation is complete. Select Restart Now. Eclipse will shut itself down and restart. When eclipse restarts it will ask you to select a workspace (either select your workspace if you want a different one to that suggested or if you don’t know what this is just press OK). The AVR Plug in is now installed.
Now Eclipse has what it needs to talk to AVR‘s. Perhaps it’s time for a celebratory post installation biscuit (or snack) to go with that beverage?

For more details, click: How to get started with Eclipse and AVR


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top