Complete explanations : http://eclipse.baeyens.it/
Why changing the IDE
If you're familiar with the Arduino IDE, you will agree that it's not very convenient to use. For exemple, you won't be able to do multiline tabulation, autocompletion and advanced programming tips in general. Well here's the good news : you can use a very powerful IDE, Eclipse (well known by Java developers) to make your Arduino developpements. This article is meant to help you doing this.
The first thing to do is to launch Eclipse IDE.If Eclipse tells you that JRE is missing, you'll have to install it manually. If you are running Windows 7 64bits, download the specific 64bits version of this JRE, otherwise it won't work.
After Eclipse has started, you'll be prompted for a wordspace folder, select wherever you want to save your future projects. Personnally, I've a root folder "EclipseForArduino" where are located Eclipse IDE, Arduino IDE and my workspace.
Ok, now you have to install the Eclipse extension for using AVR compilers. Go to help>Install new software. In the "Work with: " field, type http://www.baeyens.it/eclipse/update site/, and then select the Arduino eclipse extensions software. Install it, then restart Eclipse. You'll have a new menu item "AVR". Lets configure it with Window>preferences, Arduino tab , Arduino>Arduino Settings for this workspace. Put your arduino IDE (for me : D:\EclipseForArduino\arduino-1.0.1. Check "Use Arduino IDE tools in eclipse".
In AVRDude, the "Use custom configuration file for AVRDude" checkbox must be checked, and filled out with the avrdude.conf file from Arduino IDE.
OK, now you should be able to create a new project : File>New..>Other.. ; select Arduino>New Arduino Sketch. You'll have to select your serial port and board revision.
To avoid problems while using Serial ibraries (typically, Eclipse says there are bugs when you use Serial, but you still can compile it) :
windows->preferences->C/C++->indexer->index unused headers.
windows->preferences->C/C++->indexer->index source and header files opened in the editor.
windows->preferences->C/C++->indexer->Files to index upfront . Add arduino.h and or WProgram.h.
To import a library in your project, simply right click on it, then select "Import...", and "Import a arduino library in the current project". That's almost it. If you have some problems, first review the official plugin support site (I gave a link to it at the beginning of this article).
Export/Import your Arduino project
How to import an existing project, lets say, to an other computer ? First there are 2 prerequisites to make it possible :
- The needed libraries must have been placed in the folder specified under plugin preferences
- In additiont o the sources, .project and .cproject files must be present in the sources folder. Without those files, you'll have to manually import the needed libraries.
The steps of import procedure are :
- In Eclipse, choose the existing project import.
- Check that the plugin is well installed. The included libraries must be in the good folders (check both core and personal libraries)
- If the board you want to use is not il your existing projects, create a new Arduino project to generate it. You can next delete this newly created project as the board project wil stay.
- Under project preferences, Arduino tab, select the newly created board.
- Import is now over. One can continue to work on the project.