Skip to main content

AVR Eclipse Environment on Windows

In this tutorial we will show you how to setup an AVR Eclipse development environment on Windows.

Installing the AVR-GCC toolchain

The AVR-GCC toolchain is a collection of tools which are used to compile and upload firmware to AVR microcontrollers. The toolchain comprises of:

  • GCC – The C/C++ Compiler
  • GNU Binutils – A collection of tools, including the assembler, linker and other tools to manipulate the generated binary files
  • AVR Libc – A subset of the standard C Library with additional AVR specific functions.
  • GDB – The debugger
  • AVRDude – Used to upload and download firmware

There are many ways to get and install the toolchain including:

Each of these options draws the same codebase but there are differences in release schedules, packaging and compilation options for the binaries. We will be using the Atmel AVR toolchain Installer.

To install the toolchain:

  1. Navigate to http://www.atmel.com/dyn/products/tools.asp?family_id=607#soft, scroll down and click on the Register icon
  2. Downloading the AVR toolchain Installer from Atmel

  3. Enter your details then click “Click to Download”. You will be sent an email with the details of the download.
  4. After downloading the install file (avr-toolchain-installer-3.0.0.240-win32.win32.x86.exe), run it to start the installation.
  5. Install the toolchain with default options
  6. AVR Eclipse Environment on Windows

Install the Eclipse IDE

Whilst you can compile and upload firmware using the toolchain alone, an IDE makes life a lot easier. The Eclipse IDE is an extensible easy to use environment and is the subject of this tutorial. To install it:

  1. Navigate to http://www.java.com/en/download/
  2. Download and run the installer
  3. Install the Java Runtime Environment (JRE) with default options
  4. JRE installation

  5. Download the Eclipse IDE for C/C++ Developers (eclipse-cpp-helios-SR1-win32.zip) from http://www.eclipse.org/downloads/
  6. Unzip eclipse-cpp-helios-SR1-win32.zip to c:\Program Files\Eclipse
  7. Add Eclipse.exe to the Start Menu (I used the “Pin to Start Menu” option)
  8. JRE installation

Install and configure the AVR-Eclipse plugin

The AVR-Eclipse plugin provides AVR specific functionality within the Eclipse environment. To install it:

  1. Run Eclipse
  2. From the “Window” menu select “Preferences”
  3. Expand “Install/Update”, select “Available Software Sites” then click “Add”
  4. Enter “AVR Eclipse” and “http://avr-eclipse.sourceforge.net/updatesite/” then click OK
  5. AVR Eclipse Plugin Installation

  6. From the “Help” menu select “Install new Software”
  7. Select “AVR Eclipse – http://avr-eclipse.sourceforge.net/updatesite/”
  8. Expand “CDT Optional Features” and select “AVR Eclipse Plugin”
  9. Continue the installation of the plugin with default options
  10. AVR Eclipse Plugin Installation

    For some reason the AVR Eclipse plugin doesn’t always detect paths properly. The next few steps describe how to remedy this problem.

  11. From the “Window” menu select “Preferences”
  12. Expand “AVR” then select “Paths”
  13. Modify each path (except the last one) to be custom
  14. AVR Eclipse Plugin Installation

  15. Enter the paths shown below
  16. AVR Eclipse Plugin Installation

Setup an AVR Programmer

In this tutorial we will be using a USBASP Programmer. To set this up:

  1. Download and unzip the latest drivers from here
  2. If you are running windows vista or windows 7 64 bit, you will need to boot into “Driver Signature Enforcement Disabled” mode before you install and each time you wish to use the USB Programmer. This is done by pressing F8 at boot time.
  3. USBASP Programmer Setup

  4. Insert the USB Programmer
  5. When prompted for drivers, select the unzipped driver folder
  6. In Eclipse select “Preferences” from the “Window” menu
  7. Expand “AVR” then select “AVRDude”
  8. Click “Add” and enter the following Information
  9. USBASP Programmer Setup

Using Eclipse

Many AVR code examples will include a makefile which allows the code to be compiled using the toolchain. This can be imported into eclipse but it is better to rebuild the project from scratch to allow AVR-Eclipse functionality to be used. to do this:

  1. If needed, do a “make clean”
  2. Make Clean

  3. In Eclipse select “New” and “Project” from the “File” menu
  4. Select “C Project” then click “Next >”
  5. Enter the details for your project then continue the wizard, selecting options appropriate for your project
  6. Setting up a new project in Eclipse

  7. Right click on the Project name then select “Properties”
  8. Expand “AVR” then select “AVRDude”
  9. Select the “USBASP Programmer” configuration
  10. Select the USBASP Programmer configuration

  11. Right click on the Project name then select “Properties”
  12. Expand “C/C++ Build” then select “Settings”
  13. Select “Generate HEX file for Flash memory”
  14. Select the USBASP Programmer configuration

  15. To Build, click on the “Build All” icon on the toolbar
  16. To upload your firmware, click on the “Upload Firmware” icon on the toolbar
  17. Toolbar Icons

Related News

Pogo Pins and Photographing LCDs

This post is a new product post, a tutorial and a behind the scenes look,...

External Interrupts on an ATmega168

This tutorial will teach you how to use external and pin change interrupts on an...

HD44780 Character LCD Displays – Part 1

Introduction LCD character displays can be found in espresso machines, laser printers, children's toys and...

13 Comments

  1. Donnie

    Hi
    Will Eclipse work on window 2000? I have WinAvr installed
    I have been using assembler for the AVR but find it very hard to do math functions. For most projects I can by fine with avr studio and jtag ice.
    Don

  2. protostackadmin Author

    I can’t see why it wouldn’t work on Windows 2000. Have a go and let us know how it works.

  3. Paul

    Excellent tutorial Daniel. Very professional.

  4. Flywheel88

    I have followed the instructions two times on different machines now.
    I encounter two problems, perhaps you can advise:

    1. The zip files on protostack website with USBasp drivers are damaged. I had to download from the original site at http://www.fischl.de/usbasp/

    2. From scratch this Eclipse environment does not generate a proper make file.
    The ‘make clean’ command does not work and when I add a source file it still states ‘Nothing to build for project ‘. There is no make file, which I suspect should be made at ‘create project’ time?
    Can you provide help for this? I haven’t found a proper makefile. I guess you had an old one as you came from older software?

  5. max

    yea i had the same problem, right at the end on the last step i got

    “the file [file location/file.hex] for the flash memory does not exist or is not readable”

    1. max

      just had a look, it seems this was because an error in the code i was using…sry

  6. fotoflojoe

    Nice writeup. Wished this were available when I was setting up my environment. I’ve done this setup on both Win7 (x64) and Ubuntu Linux. The information is out there, but difficult to find all in one convenient place. However, once it’s set up, Eclipse is a true joy to use for development.

    Any advice/tips on setting up GDB for AVR? So far, I’ve been unsuccessful doing this.

    Thanks!

  7. M.

    Hi.
    Your tutorial is everything I’ve been looking for! AVR Studio 4 isn’t the best IDE, and I’ve used Eclipse before…so when I saw this, I literally jumped at the opportunity.
    However, I’m doing it on Ubuntu, and I’ve installed everything, and it seems to work, except for a very tiny bug.
    Even though is included (using avr-libc), the IDE fails to recognize PORTB, PORTD, ADCSRA, etc etc.
    I’ve included and and even . The defines and typedefs in them work perfectly fine. For some reason, is having issues.
    I can’t develop anything without those SFR definitions! Someone please help me!

  8. M.

    …Sorry, and before I forget, I’m using gcc-avr 4.3.5 and the avr-libc available in Synaptic (1.6.8-2). I also just included (the Mega16 include file) and compiled. I no longer get that error. But at the same time, I can’t keep finding the particular include file per chip, and there’s even a compiler error in iom16.h telling you to include io.h.
    Help, somebody,please!

  9. shreyas

    I followed all the steps shown above for eclipse installation and also USBASP programmer.
    there is an error I am getting:”could not initialize target hardware”.

  10. sriram

    how to connect avr jtag clone in that

Leave a reply

Shopping Cart