Press "Enter" to skip to content

Arduino on eclipse! – Part III – Uploading

How to configure AVRDude to upload binaries to Arduino.

This tutorial is based on a Windows 64-bit system. But the fact that eclipse is multi-platform should ease things.

Uploading compiled code to Arduino Mega2560 from Eclipse

I’ve been following a lot of different tutorials about how to make this done. But no specific information about Mega2560 the configuration of the different tools drives me crazy after one day of work. (No tutorial describes exactly what I’m looking for!!) However, I need to say that the official tutorial is great and you should take a look at it.

Let’s start! Open Eclipse…

Configuring AVRDude

The first thing to notice, AVRDude in WinAVR is not valid for Mega2560 so you need to use the one included in Arduino IDE.

  1. On Eclipse go to menu Window>Preferences. On the Preferences window that opens, on the left side open section AVR>Paths.
  2. On the right side of the window, you will see a list, find the AVRDude element. Click on it and press the Edit… button at the right of the list.
  3. A window called Change Path for AVRDude opens. Select Custom on Path source enumeration.
  4. Browse for your Arduino IDE path and from it go to ‘\hardware\tools\avr\bin’. In my case looks like this:
    C:\Program Files (x86)\Arduino\hardware\tools\avr\bin
  5. Confirm the path and Apply the changes in the Preferences window.
  6. Still in Preferences go to section AVR>AVRDude.
  7. Check the Use custom configuration file for AVRDude and Browse… to the Arduino IDE path and from there to ‘\hardware\tools\avr\etc\avrdude.conf’. In my case looks like this:
    C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf
  8. On the list below, Programmer configurations click on the Add… button at right. A window called Edit AVRDude Programmer Configuration <Configuration name> opens.
  9. Put a configuration name and a description according to your platform, something like Arduino Mega2560.
    This configuration is horizontal to all the projects in the same platform always that the COM port doesn’t change, COM port could change if you connect the Arduino board to another USB port!
  10. The parameters that you should change are listed here:
    • Programmer Hardware Wiring… WIRING
      Other tutorials suggest using STK500v2 or Arduino but… NO. Please don’t. Because, as written in the file ‘avrdude.conf’:

      # Basically STK500v2 protocol, with some glue to trigger the bootloader.
    • Override default port ‘\\.\<arduino COM port>’, in my case looks like this:
    • Override default baudrate 115200
    • Other options -v -v
      This option will enable verbose mode, useful to see what is happening on the Eclipse console.

Configuring the project

The general configuration for the AVRDude is done, but still, some other changes should be applied to our project.

  1. Open the Project>Properties.
  2. Navigate to section AVR>AVRDude on the left tree.
  3. Select the Programmer page on the right side of the window.
  4. Set the Programmer configuration to the configuration that we have created in previous steps.
  5. Now, and this is important, go to the Advanced page. And check the Auto Chip Erase Cycle (-D) option!
    No tutorial that I’ve checked has this step, and this will crash the uploading procedure with the next output.

    avrdude: erasing chip
    avrdude: stk500v2_command(): command failed
    avrdude done. Thank you.
  6. Navigate to section AVR>Target Hardware on the left tree again.
  7. Set next parameters
    • MCU Type ATmega2560
    • MCU Clock Frequency 16 000 000 (six zeroes)
  8. Apply and confirm the configuration.

If everything went well you now can use the AVR upload button (The hardest-to-configure button of the world.).

You can make auto-upload when building if you check Project>Properties>C/C++ Build>Settings>Additional Tools in Toolchain>AVRDude.

This is my first post (yes, I started with part II) and tutorial on this blog! So… Hello world!


  1. maria bote alonso maria bote alonso 20th October 2014

    Wow, it’s so interesting. Thank you for to share with us

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.