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-, 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 http://www.protostack.com/index.php?main_page=library
  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