Arduino Eclipse Plugin <Update>

@Jantje:
Oh! Sorry, I've overread that!

@eaman
I use exactly the same package on Debian Wheezy (in fact it is a mixed system, otherwise I couldn't use Debian Sid packages). For me it worked out of the box.

If you tried it before with an older package, you maybe need to delete the "Arduino Uno" project in Eclipse (be sure to delete it from the disc, not only discard it in Eclipse) and than recreate it (by creating a new Arduino project).

Spindoctor:
@eaman
I use exactly the same package on Debian Wheezy (in fact it is a mixed system, otherwise I couldn't use Debian Sid packages). For me it worked out of the box.

Actually I'm just trying to compile by command line, I've got Eclipse on an other workstation of mine and I could give it a try there.

Still, I'd like to use plain vim for Arduino development, but I won't hijack this thread about Eclipse.

eaman
Sorry but I had missed your post on the wiring.c.
I've checked the code and it seems that F_CPU has not been defined. This define is given with the compile command you can see that in the eclipse console.

avr-g++ -I"C:\arduino-1.0\hardware\arduino\cores\arduino" -I"C:\Users\IBM_ADMIN\Documents\data\Arduino1\MaaiRobot" -I"C:\arduino-1.0\hardware\arduino\variants\standard" -I"C:\Users\IBM_ADMIN\Documents\Arduino\libraries\JanHelpers" -I"C:\Users\IBM_ADMIN\Documents\Arduino\libraries\MegaMotoDriver" -DARDUINO=100 -Wall -Os -ffunction-sections -fdata-sections -fno-exceptions -g -mmcu=atmega328p -DF_CPU=16000000UL -MMD -MP -MF"MegaMotoDriver/MegaMotoDriver.d" -MT"MegaMotoDriver/MegaMotoDriver.d" -c -o "MegaMotoDriver/MegaMotoDriver.o" -x c++ "C:/Users/IBM_ADMIN/Documents/Arduino/libraries/MegaMotoDriver/MegaMotoDriver.cpp"

The example above shows the atmega328p which has a clock speed of 16000000 (-DF_CPU=16000000UL).
If this is not properly set it is probably because the board is not properly set in the project properties->arduino->arduino.
If it looks ok change it to another board; delete the existing Arduino library project (inclusive the content on disk) and then change back to your correct board.
You can delete the Arduino project again.
I hope this helps
Best regards
Jantje

I finally got this configured on Mac OSX (Snow Leopard). I was able to create a new sketch and compile it, however there were numerous "Unsupported operating systems" pop-ups during each activity (more than 5). The build seemed to work fine - don't have any hardware here so I couldn't test to make sure.

Using the latest version (1.1.3?) from your update site. Any ideas?

Drapal
I do not have a osx os at my disposal. As long as nobody tells me that it works like it should I consider it unsupported. There are 2 things I can do now

  1. Change the error to a warning. This will make the dialog boxes go away and only a logging in the error window will appear
  2. Support OSX. This will make the errors and warning go away. Before I do this I need to know whether it works out of the box. More precisely I need to know whether you needed to modify the box shown below.
    If so please show me your version of the dialog, this way I can have the plugin to set the correct settings
    If not tell me then I'll remove the error and the warning.
    Best regards
    Jantje

Here are the settings from the Preferences pages on the Mac. You can't use the browse button to set these, since the Arduino application on the Mac is a package. You can enter the paths by hand and they work fine - the build process generates exactly the same size code for the Blink application in Eclipse and the Arduino IDE.

Preferences->Arduino->Arduino:

Arduino IDE Path: /Applications/Arduino.app/Contents/Resources/Java

Preferences->Arduino->Paths:

AVR-GCC: /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin
GNU Make: /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin
AVR Header Files: /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/avr/include
AVRDude: /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin

Also, I may not understand how to use the Library Import feature of this plugin- I can't make it work on the Mac nor on Windows. The Finish button doesn't seem to do anything (even though it's enabled). I tried what is in your FAQ/Instructions on how to use the plugin and it won't import on either platform (again, version 1.1.3).

Jantje:
eaman
Sorry but I had missed your post on the wiring.c.
I've checked the code and it seems that F_CPU has not been defined. This define is given with the compile command you can see that in the eclipse console.

Thanks for the note, I've added the F_CPU flag in my Makefile and I've made a step forward, but my compile still doesn't work. As it is an issue probably related to my OS (Debian Sid) and command line environment (not Eclipse) I started a new thread:

Thanks again for your advice.

drapal
Thanks for your input. I made a new version 1.1.5 which I prereleased (I can't test it myself so I don't want to take the risk to release it)
You can get the prerelease version in eclipse with the standard update feature when you add following location to the update sites "http://www.baeyens.it/eclipse/prerelease"
I tested the library import. I have no problems on windows. I have updated the faq page with information on how to find out more about the problem This page has been moved
I hope this can help you out.
Can you let me know whether this new version works fine o mac os?
Best regards
Jantje

Jantje,

The 1.1.5 version works great for me on the Mac - thanks so much.

After posting yesterday, I figured out my issue with the library import function - I was making it much more complicated than it really was. It's working fine for me.

Thanks for the great tool!

Hi Jantje,

Thank you for all your work on this great plugin! I installed the new version, configured (per your instructions on the first page of this thread), created a project, and it just worked. This is cool! 8)

It seems very complete to me, except that I don't know if there is a Serial Monitor window, or equivalent. I found the "Target Management" project. Is that the best option that you know of? (I'm sure I could just use Putty, or something, too. It would just be nice to have it within Eclipse.)

Oh, one quirk that I noticed. But I expect this is part of the AVR plugin. I can hit Ctrl-B to build the project, but then if I click the AVR icon to upload, sometimes it says, "No AVR project selected". That seems funny, because Ctrl-B knew which one was selected and it just built with the AVR toolchain. Right now, I'm not sure how to reproduce that, other than to say that it happens sometimes when I open a workspace and do the build/upload right away. Please let me know if you'd like more information and I'll document the steps required.

BTW, I plan to write a blog post about this, but first I want to make a little more progress on our current project. (Mjolnir - which is also open-source.) It will definitely be a favorable post!

Thanks again,
Leland...

Drapal
Thanks for the feedback. I'm a bit busy now so I will not be able to release this soon. In the mean time I made some other changes so 1.1.5 will never become real release. I'm still fighting this update site feature.

aBoogieman
I'm happy to hear you like the plugin.
I also noticed this strange "project not found" behavior. I happened to be looking at the code to find the project because I needed it to find the active project when doing an import. 1.1.6 will have the project to import to filled in automatically.
As to the serial monitor the home page eclipse.baeyens.it states

There is no serial monitor in this project. Use the IDE one or any one of your choice

. I use the IDE because I also get the com port from there. I'll have a look at the "Target Management" project though.

Best regards
Jantje

Leland
I have been watching the differences in behavior of the build and the upload button.
When I can build but not upload I see the build builds all projects. In other words the build has no active project so he builds all projects. In this case the behavior seems correct because there is no single sketch to upload (the plugin can not upload all projects).
If you see incorrect behavior please try to reproduce and let me know how you would like it to work.
Best regards
Jantje

drapal:
The 1.1.5 version works great for me on the Mac - thanks so much.

The 1.1.5 worked fine for a plain sketch and a sketch with an external=user library.

However, when I tried to use the internal=supplied with Arduino library Wire.h, I had to import it manually digging into /Applications/Arduino.app/Contents/Resources/Java/libraries.

What is the parameter in charge of internal=supplied with Arduino libraries?

Avenue33
I do not understand your remark.
First of all there is no code/configuration or whatever that makes a distinction between internal and external libraries.
The only thing is that when you import a library the default folder is pointing to the subfolder of the arduino IDE delivered libraries.
The import does actually very little. What it does is:

  • Create a link folder to the selected folder in the selected project (this is very similar to the eclipse default import)
  • Add the folder (and subfolders) to the include path
  • Add the folder and subfolders (excluding ?xamples) to the source path

You have to add .h to the code yourself. (as is indicated in .h)
There is no validation or whatever on the code. You could even import an existing IDE folder containing a sketch this way (you have to delete the 2 created files in the project to avoid compile conflict)
I just tried the wire library and it works fine on my system. To be able to use the functionality you need to include wire.h as you can see below

// Only modify this file to include
// - function definitions (prototypes)
// - include files
// - extern variable definitions
// In the appropriate section

#ifndef test_H_
#define test_H_
#include "WProgram.h"
//add your includes for the project test here
#include "wire.h"

//end of add your includes here
#ifdef __cplusplus
extern "C" {
#endif
void loop();
void setup();
#ifdef __cplusplus
} // extern "C"
#endif

//add your function definitions for the project test here




//Do not add code below this line
#endif /* test_H_ */

Please be aware that eclipse is a complex environment and the eclipse plugin in contrast to the Arduino IDE assumes C C++ knowledge. There is a section in the faq that deals with this This page has been moved

If you think there is a genuine problem; please be more precise on what the problem is. What is your console output? If a dialog box appears; please add a screenshot. If you are not precise in the problem description I can not help you out.
Best regards
Jantje

Avenue33
There is a problem related to the eclipse plugin and the wire library in Arduino. I created a post that explains the problem and proposes a fix here http://arduino.cc/forum/index.php/topic,86344.0.html
You can apply the fix in your environment.

Best regards
Jantje

Jantje,

Thank you for your answers.

About Importing libraries — Menu File > Import, Select Arduino > Import an Arduino library in the current project,

First time, the window rightly points to /Applications/Arduino.app/Contents/Resources/Java/libraries —called internal libraries

Now, I go to my own libraries at /Users/avenue33/Documents/Sketchbook/Libraries —called external libraries or user libraries— and take the library I'm looking for.

Next time, if I want to import the Wire library inside /Applications/Arduino.app/Contents/Resources/Java/libraries, I can't go there because:

  • Wire is inside the application Arduino.app
  • Mac OS X doesn't consider Arduino.app as a folder but as an application
  • Mac OS X doesn't allow to go inside an application —except with the file browser Finder through the contextual menu Show bundle.

This is purely Mac OS X related.
Ouvrir = Open launches the app. Afficher le contenu du paquet = Show bundle gives that:

Avenue33
I understand the problem but I cant explain it. (I'm not related to mac 8) )
As you can see from the code below I always go back to the "internal libraries". controlLibraryPath.getText() returns the content of the dialog box and that should be empty. Therefore the path should always be set to the "internal libraries".
If there are mac experts who know how to solve this issue, please let me know.
Best regards
Jantje

			@Override
			public void widgetSelected(SelectionEvent event) {
				final Shell shell = new Shell();
				DirectoryDialog theDialog = new DirectoryDialog(shell);
				if ((controlLibraryPath.getText()==null) | (controlLibraryPath.getText()==""))
				{
					theDialog.setFilterPath(ArduinoInstancePreferences.getArduinoPath().append( ArduinoConst.LIBRARY_PATH_SUFFIX).toString());
				}
				else
				{
					theDialog.setFilterPath(controlLibraryPath.getText());
				}
				
				String Path = theDialog.open();
				if (Path!=null)	
					{
					controlLibraryPath.setText(Path);
					updateWidgetEnablements();
					}
			}

Hi,

Just wanted to confirm that this works on OSX! Thanks for the great work - I've been hoping someone will do this for ages!

I'd like to check whether I've understood compatibility with the Arduino editor correctly. It seems like to start working with an Arduino project which has multiple files, you need to:

  • add all the .pde files to your project
  • import libraries and add includes to $project.h
  • in $project.h declare any global functions and externs for all global variables, and copy all #defines
  • add #include "$project.h" to all .pde files

The last step means that it's not directly compatible with the Arduino editor any more, as there won't be a $project.h. Also, in order to keep the main file compatible, #defines need to be both in $project.pde and $project.h (if they are used in other files). I guess that they can get wrapped in an #ifdef

I'm trying to create a new project with a board: Arduino Mega (ATmega1280)

When I try to create the new project, I get an error:
Failed to create project test1
Path variable name cannot contain character: ).

Anyway I can modify the name of the board to take out the parenthesis?

Garetto
The ( problem in the board name should be fixed in the latest version 1.1.6 released earlier this week.

mo-seph
read this article Redirecting it will give you a better understanding on the compatibility.

The first thing to realize is that we talk about code compatibility. This means that both the IDE and Eclipse can compile the same code.
The second thing to ask is do you want
compatibility from Arduino IDE to eclipse.
or Eclipse to arduino IDE
or Arduino IDE from and to Eclipse (both directions)

Because the Arduino IDE provides functionality at the level of code preprocessing it is very hard to guaranteed 100% compatibility from the Arduino IDE to Eclipse. It is not my intention to add this preprocessing functionality to the plugin. (However if someone else wants to do it I don't care)
Because of this: when I talk about compatibility I talk about compatibility from Eclipse to Arduino only.
Because Eclipse has "less capabilities" code from Eclipse compiles as such in the arduino IDE.
BUT
Shakespeare already stated a lang time ago "There are more things in heaven and earth, Horatio, Than are dreamt of in your philosophy". 8)
So there is more than code only. There are also libraries, include paths and library paths.
When you import an Arduino library in Eclipse with the plugin the include path and library paths are changed for you.
When you compile Eclipse code in the Arduino IDE you need to provide this info to the Arduino IDE.
Luckily the Arduino IDE provides "more source functionality". Therefore a simple include of the header file of the library in the pde/ino file is enough to overcome this problem. It has to be the pde/ino file due to a short coming in the Arduino IDE.
Because this "extra" include (you already need to include the library header to use the functionality) is harmless in the Eclipse IDE you can have 100% compatible code.
You can have the IDE and eclipse "point" to the same folder so you do not have to move code around.

I hope this makes it clearer
Best regards
Jantje