Go Down

Topic: Windows/Linux/Mac Eclipse plugin to compile and upload arduino sketches (Read 119248 times) previous topic - next topic

Jantje

EDIT
version 1.0.10 is now tested on openSUSE
Latest version are tested and running on MAC
Added serial monitor
End EDIT

Hi
There is a free eclipse plugin available that makes development of big Arduino projects easier.  As you only need the Arduino IDE, Eclipe and the plugin this Arduino IDE alternative is completely free and open source.
The plugin suppports
1) Creation of an Arduino sketch
2) Import of an Arduino Library
3) Change the Arduino board
4) Change the com port
5) Upload to the board
6) Real time build
7) User selected build.
8 ) Integrated serial monitor
9) plenty of updated documentation is available at www.baeyens.it/eclipse

To use it you only need to install the Arduino IDE;install eclipse, install the plugin and configure the plugin. Detailed instructions are below.
The current version works with cpp files only (no pde out of the box). Below are some simple instructions on how to keep your code Arduino IDE compatible. I use those and I can compile the code between the Arduino IDE and eclipse without changes.

Note that the current version (1.0.8 ) works on windows only. I'm working to support Linux as well.

UPDATE: If you have a space in your Arduino Path or project name the plugin will not work. In general try to avoid spaces in names.

1) install the Arduino IDE
2) install eclipse indigo

2.1) download the code from here http://www.eclipse.org/downloads/
2.2) Unzip the file downloaded from eclipse( I assume c:/indigo)
3) Install the Arduino plugin
3.1) Start eclipse
3.2) run the program c:/indigo/eclipse/eclipse.exe
3.3) give a name to the workspace (I assume you use "Arduino")
3.4) Close the welcome screen
3.5) Select help->install new software
3.6) Enter the information as below (select the newest version of the plugin)
Site: http://www.baeyens.it/eclipse/update site

3.7) restart eclipse (as requested by eclipse)
3.8 ) open the workspace Arduino
4) Configure the plugin
4.1) open the preferences (windows -> preferences)
4.2) open the section Arduino->Arduino
Fill it in like below (using your Arduino IDE location)

4.3)Following setting in general-> work space is not needed but advised:
Set the auto save before build on to avoid different version between uploaded and visible code.

4.4) select OK to save the preferences

Creation of a Arduino sketch
Now you can create a new Arduino project with the plugin
Do file -> new -> project
Select the Arduino sketch and then next


Provide a name for the sketch and press next (note that in the image below the finish is enabled because I already created a sketch)


Provide the Arduino information and select finish (note that all this information will be stored so you will not need to reenter when you create a new sketch)


Now the plugin will create 2 projects. one for the Arduino library and one for the sketch. The image below holds more projects but the new ones are highlighted.

In the image above I opened the my sketch.cpp file by double clicking on it.
Pressing the hammer (marked in the image above) will compile the project.
Pressing the AVR button (marked above) will upload the project to your Arduino board.

Changing Arduino target board or com port
To change the board or com port right click on the project and select properties
you get the same dialog box where you can change the board and  com port.

After you pressed finish you get a new Arduino core project for the mcu if needed.


Importing a library
select file->import
Select the Arduino->Import a arduino library in the current project

Select the folder you want to import and the project you want to import to and select finish


Keeping the eclipse project compatible with the IDE
To be able to compile your code directly in the Arduino IDE you need to do something extra at three actions
1) After installation tell Eclipse to process pde like C++ file
2) After creation of a new sketch project tell the compiler to treat pde files like C++ files (-x c++ compiler option) and rename cpp file to pde
3) After inclusion of a library add a include of the library to the pde file.

Below are detailed instructions.
1) After installation tell Eclipse to process pde like C++ file
Windows ->preferences
In the section C/C++ -> file types press new
enter *.pde as filename and C++Source file as type.
2) After creation of a new sketch project tell the compiler to treat pde files like C++ files (-x c++ compiler option) and rename cpp file to pde
right click on the project ant select properties
In the section C/C++ -> settings select the tab tool settings (normally already selected)
In the section AVR C++ compiler change the command line pattern by adding -x c++ before {$INPUTS}
select OK to save the settings.

right click the .cpp file select rename and change the .cpp to .pde
3) After inclusion of a library add an include reference to the library to the pde file.
in the pde file at the top add a line that looks like
#include <[the imported library].h>
Note that if the library contains examples you will have to move them to another location in the current version of the plugin.

Please feel free to download, test and comment.

Best regards
Jantje



PS: Currently it only supports windows
Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

nuclearpowered

The software package link is down.  I would like to install this, but it cannot connect!

Jantje

nuclearpowered
I'm happy to see you want to try the plugin. I'm sorry you failed to download the plugin.
I just tried to connect to the site and all works fine for me.
Are you sure the link is down?  The site is run by a professional paid service provider so that should be ok (no adds  :) ).
Are you sure you used eclipse->install new software? (the browser will not find the page)
are you sure you used "http://www.baeyens.it/eclipse/update site" including " site"?

Best regards
Jantje

PS I changed the site so it will serve both "update" and "update site" now.
Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

pito

Jantje, nice job!
Let me aks you following - I cannot pass point 4.2 of your guide. I get  a red cross with "Folder is not correct" up on the screen where to enter path to Arduino Global Settings (OK inactive even I enter path to my arduino), or, "The currently displayed page contains invalid values" when trying open Avrdude or Paths in Preferences->Arduino.
Any hint?
Thanks, P.

Jantje

pito
The folder to enter is the folder that contains the subfolders : drivers, examples, hardware, java, lib, libraries, reference and tools.
The code checks whether the file "[provided folder]/hardware/Arduino/boards.txt" exists. If that file is not found you will get the message you described with the red cross.
Note on non windows systems this will never work (I tested it). On windows (XP and 7) systems it works.
I hope this helps you out.
Best regards
Jantje
Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

Klaro00

Hi Jantje,

everything is working fine so far. Thanks for your fast answers.

Another question: How would I add "Serial" support (talking to my board via predefined serial pins, e.g. for debugging)?

Hardware connection could be simple: At some other place I read that I could connect to my board by opening a SSH session to the appropriate COM port - this sounds plausible, didn't try it yet.

But how about writing the software: How could I use the methods coming along with the "Serial" lib? When using the Arduino IDE, I can simply reference "Serial" without #including anything - seems to be built-in into the Arduino IDE. If I add a line like "Serial.begin(9600);" in Eclipse the compiler complains about not knowing "Serial" - pretty correct from the compiler's view. But do you - or someone else - know what to do to get the standard "Serial" functions running? I looked through all the directories of the Arduino IDE, could not find any .h/.cpp file containing the "Serial" library...

// Klaus

Jantje

Klaus
Not sure why you can't use Serial.  All this works fine for me.
I assume you are referring to the console output that tells you that serial doesn't work. I ask because the eclipse indexer sometimes behaves weird and sees errors that are not errors.
As you already had plenty of problems it is -in my experience- best to just start from scratch with a new eclipse installation.
Best regards
Jantje
Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

pito

Jantje, thanks - I had the name of the folder .. /Arduino-extras/boards.. so this was the issue. Now I can compile, however eclipse shows:
Symbol 'Serial' could not be resolved
Method 'print' could not be resolved
Method 'println' could not be resolved
It compiles without error and I get hex files (hex not shown in Project Explorer).

But there is an issue which would be nice to fix - related to pins_arduino.c.
I am using (and maybe others as well) a special way how "pins_arduino.c" defines a set of various boards. To make the story short:
1. in folder ..hardware\Arduino\cores\arduino there is "pins_arduino.c" which contains ie:
...
#if defined(__AVR_ATmega128__)
   //*   pin defs for SOC-Amber128 web serverboard
   #include   "pins_amber128.cxx"

#elif defined(__AVR_ATtiny45__ )
   //*   pin defs for Avr attin45
   #include   "pins_attiny45.cxx"
...
2. in that folder there is a set of .cxx-es with respective boards pins definitions.
3. your setup attempts to compile everything with .cxx,  .c in that folder which creates errors, of course.
4. so I had to remove all .cxx-es and create a single "pins_arduion.c" for the board of choice in order to compile the stuff properly.
p.

Klaro00

Adding the line

    extern HardwareSerial Serial;

to a header file will "fix" the errors shown by eclipse regarding the "Serial" reference.

// Klaus

Jantje

Klaus
extern HardwareSerial Serial; will not fix the issue as the code compiles. (it should be defined as I include WProgram.h. It is an eclipse indexer problem.

Pito
Please see the freshly released web pages with more documentation. on http://www.baeyens.it/eclipse/ There is a faq that should answer your questions.

Best regards
Jantje

Eclipse tells me there are bugs in my code but it compiles ok.
Eclipse compiles you code in 2 ways. Once when you request a build (when you press on the hammer) and ones when you change code (save a file). The compiler is responsible for the build and the indexer is responsible for the continuous build.
The bugs (the red animals in the code) you see in the code can be found by any of the 2. The indexer behaves weird and sometimes doesn't find declarations that it knows. In that case you have the bug without a bug (in other words the code compiles ok).
Setting the option windows->preferences->C/C++->indexer->index unused headers seems to have fixed the issue on my system.
Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

pito


Jantje

Pito
Yes indeed the *.cxx question is not answered directly in the FAQ. It is indirectly answered in "I have modified my Arduino setup and... "
But to give you some background:
I don't compile *.cxx files  XD
My plugin uses avr eclipse that uses cdt, win avr and GNU compiler. CDT uses eclipse
It is cdt (which is a C/C++ plugin for eclipse) that compiles *.cxx
If you have read the "How to keep the IDE and plugin compatible" you must have seen how to add *.pde file as to be handled by the compiler.
Unfortunately you can not remove *.cxx files as they are supported by default.
In my humble opinion it is better to avoid mixing files of different sources. Having the *.cxx somewhere else may fix your problem.

Best regards
Jantje
Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

turdusmerula

#12
Nov 28, 2011, 09:54 pm Last Edit: Nov 28, 2011, 09:57 pm by turdusmerula Reason: 1
Seems a really great work !! but update site is broken  :(

Is there a lot of work to do a linux port?

Jantje

All
The plugin (version 1.0.10) -now available on the update site- also works under linux (only tested on openSUSE)
Are there candidates to test on other Linuxes?

I see in my site log that more than 100 downloads have already taken place. To those people: Please give feedback.

  • Did it work for you?

  • Were you stuck somewhere? (What exactly failed)?

  • Do you like it?

  • Which OS do you use?


I prefer it on the forum but you can also send your input to eclipse@baeyens.it

Version 1.0.10 also

  • excludes the examples folder when you import a library. This is (only?) useful for people who added pde files as source code.

  • No longer adds include folders to the assembler.



Best regards
Jantje
Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

MonkeyKnight

First off, I want to say - stellar job man! I am digging this! I have been trying to get Eclipse working for Arduino on and off for a while now.


I am game to be a tester for OS X.

Thus far, all is well. All but:

Code: [Select]


**** Build of configuration Release for project Arduino_test_002 ****

make all
Building file: ../Arduino_test_002.cpp
Invoking: AVR C++ Compiler
avr-g++ -I"/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino" -I"/Users/nick/Documents/Home_Workspace/Arduino_test_002" -D__IN_ECLIPSE__=1 -DARDUINO=22 -Wall -Os -ffunction-sections -fdata-sections -fno-exceptions -g -mmcu=atmega328p -DF_CPU=16000000UL -MMD -MP -MF"Arduino_test_002.d" -MT"Arduino_test_002.d" -c -o "Arduino_test_002.o" "../Arduino_test_002.cpp"
/bin/sh: avr-g++: command not found
make: *** [Arduino_test_002.o] Error 127

**** Build Finished ****


avr-g++ is not being found. I have no idea why though. avr-g++ is readily available on my $PATH.

Even more confusing, is when I have an AVR project, it sees and uses avr-gcc just fine.

Anyone have any clue to this?

Thanks in advance.
Frying boards one at a time. Sizzling components by the scores.

Go Up