Go Down

Topic: Arduino Eclipse Plugin <Update> (Read 73383 times) previous topic - next topic

garretto

I'm actually already using version 1.1.6 and getting that issue.  Otherwise great plugin!!

Jantje

Garetto and Julius59
I tested it now and indeed it didn't work.
I used wikipedia to know all "problem Characters" http://en.wikipedia.org/wiki/Filename. Today; this page does not contain ( and )
I admit I didn't test this  :smiley-sad-blue:  and even worse I didn't test 1.1.7 I just released :smiley-mr-green: .
I hope it works now.
Best regards
Jan
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 -

garretto

Fantastic thank you!

One other problem I'm having, which isn't that big of a deal, is that Eclipse isn't able to find library classes like Serial.  When I write a line like Serial.println("Hello World"); Eclipse underlines it in red and says Serial cannot be resolved.  It ends up compiling just fine, however, so like I said it is not a big deal.  However, it would be nice if Eclipse could see the proper libraries so it doesn't mark this with an error.

Anyone know how to fix this?

kiwidude

Eclipse has a static analysis tool built in which looks at your code and points out any issues it has with it. It is independent of the compiler, although you could view it as one that doesn't produce code, just warnings. Like the compiler, the static analysis tool needs to know where the sources are. By and large eclipse (or probably rather the CDT plugin) tries to be automagic, but it doesn't always work.

There are some settings you can tweak:
Workspace preferences -> C/C++ -> Indexer.

Project properties:
C/C++ General -> Indexer.
C/C++ Build -> Discovery Options. I'm not too sure what best to put here. If you leave the discovery profile on "per language", make sure you check the settings for each language(!). The "clear discovered entries now:" has a clear button, use it (for all languages) to force a re-discovery after something is wonky.

You can make use of path variables:
Project properties -> Resource -> Linked resource, path variables tab.

Check the path discovery has worked correctly by looking at
C/C++ General -> Paths and Symbols -> Includes tab, for each(!) language.
The yellow/green folder icons are the paths found; they can't be edited. The purplish ones are the ones you added in C/C++ Build -> Settings -> Tool settings tab, (Asm Paths, C and C++ Compiler Directories).

Also make good use of clearing the index. In the project explorer, right click on the project, Index -> Rebuild.

Now all this advice comes with the proviso that I'm not 100% familiar with eclipse myself (it's too damn complicated), and I am only using the AVR plugin so far, but not the Arduino plugin. The problem you describe shows up for me though when something in indexing/discovery doesn't work properly.
There are also some reports of the CDT plugin being buggy in those areas, the AVR plugin having path problems, and "individual settings for build configurations" in the AVR plugin messing things up irrecoverably. By and large it works for me though, but it's possible I have to try moe than once to knock it into shape.

Another potential problem area is if your sources (like Arduino core, or official libraries ) are outside of your workspace. I suggest you use path variables then, and use them to tell eclipse where the paths are to search for sources (and hope indexer/discovery pick up on it). For starters I made one project in the workspace containing all of the core (this setup is required to keep code space down), with the libraries actually used in the project directory. I use Linux, so using symlinks is very convenient for the project layout without having to copy files. Don't use eclipse's virtual file/folder feature until you have everything working, there were some comments that that messes things up too.

Hope this helps :-)

Jantje

garetto

As for kiwidude comments
Quote
There are some settings you can tweak:
Workspace preferences -> C/C++ -> Indexer.

This is 4.4 of the installation instructions. Note some people state setting the option "index source and headers opened in the editor" helps.

Quote
C/C++ General -> Indexer.

Unless you know what you are doing do not enable project specific indexer settings.

Quote
C/C++ Build -> Discovery Options

Here you can remove "cashed includes" which may cause issues with the indexer. For instance f you changed Arduino versions in the windows->preferences->arduino. Select "per language" and click clear for each language.

Quote
Project properties -> Resource -> Linked resource, path variables tab.

I have never used this page. More info on how this could help indexing would be helpfull  :)

Quote
C/C++ General -> Paths and Symbols -> Includes tab, for each(!) language.

Turn on show built-values before validation. There should be "/${ARDUINOBOARDNAME}/arduino" if you use the arduino eclipse plugin in GNU C and GNU C++. s,S,asm should not have custom (those are printed in bold) settings. If you have imported libraries you have other values here as well.
Look at the source location to see how library code is added.

Quote
The purplish ones are the ones you added in C/C++ Build -> Settings -> Tool settings tab, (Asm Paths, C and C++ Compiler Directories).

You can also directly set them here. I think this is easier. The 2 locations are updated accordingly.

Quote
Also make good use of clearing the index. In the project explorer, right click on the project, Index -> Rebuild.

Spot on. Even if you got plenty of warning the plugin will rebuild the index, rebuilding this way helps out frequently.

Quote
I am only using the AVR plugin so far, but not the Arduino plugin

The arduino plugin contains a clone of the win AVR plugin. Basically it is the same thing. I added some pages that set Arduino specific things in the AVR plugin or set multiple settings based on the Arduino board. If you confortable with Win AVR there is little advantage to go to the arduino plugin because it will probably confuse you because you can set vallues at several locations (and that will confuse the arduino plugin)

Quote
There are also some reports of the CDT plugin being buggy in those areas

fully agree.

Quote
The AVR plugin having path problems

These manifest most when you start deleting imported libraries. If you find a way to reproduce tell me how and I will try to fix it.

Quote
"individual settings for build configurations"

Arduino plugin only has 1 configuration "release" and does not use this option.

Quote
plugin messing things up irrecoverably

Untill now I have been able to recover all of them but it is hard. Easiest is just creating a new project (easy with the wizard) reimport the libraries and copy the code, delete old project.

Hope it is clearer now.
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 -

garretto

Okay I checked "index source and headers opened in the editor" under indexer in C/C++ settings and that seemed to do the trick!  Thanks for your help everyone, this plugin has made my life so much easier working on Mac OS 10.7.

Jantje

garetto
Happy to hear it works fine for you
Makes me feel like the effort was worth it  :)
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 -

razorjack

i like Eclipse, i think that's a good move :)

but, what's wrong with  AVR Studio 5 ? it's free, isn't it?

Jantje

razorjack
Did someone say there is something wrong with AVR Studio 5?
I can't recall I did so. It would be very unwise as I don't know it. 8)
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 -

razorjack

why don't you use avr studio? are there any problems ?
i didn't use it, i'm just thinking about something more sophisticated than Arduino IDE (i'm accustomed to Eclipse and VisualStudio)

Jantje

razorjack
The discussion avr studio versus eclipse versus arduino IDE (and any others) is as religious as Windows versus mac versus Linux.
I'm not going there. (see my footer)
Note that I cannot find avr studio in the Arduino playground on the development page. It may be there under another name. If you really think avr studio is the way to go you should update that page.

I'm willing to share with the forum why I developed the eclipse plugin. I do not claim my decision are based on "knowledge and research". I just took the most obvious route with my the knowledge I had at that time. This is not a translation but it is similar to the story you can find at http://www.baeyens.it/#post8 in dutch posted some time ago.
I have been doing software development from beginning 1980. I have always been interested in electronics but never got my head around the 555. So when I learned about PIC's I was hopeful again, until I understood I needed a 555 to get it running. When I learned about Arduino a couple of years ago I was enthusiastic.  This was a board that I could extend with simple electronic circuits and with my programming knowledge programming would be easy.
Just like other people coming from software development I was happy it worked but frustrated by the lack of functionality of the Arduino IDE.
So I started looking at alternatives. And eclipse was the first I found, with was free and runs on windows.
It took me a lot of time to get the complete tool chain to work. This because I hardly know what AVR is all about and I didn't even realize the whole code was simply parsed by a c++ compiler  :smiley-eek:
I think WINavr in eclipse is good and is the way to go in eclipse if you understand about AVR but for me it asked to much time to understand and set all options correctly. This because it is not focused on Arduino but it is a general AVR development environment.

I had some spare time -which I could not spend on direct Arduino development- and therefore I build this eclipse plugin for my learning. I had never before build an eclipse plugin and for professional reasons I wanted to build one.

So I started of by building a plugin on top of -and in collaboration with- winAVR. Due to communications problems and differences in speed I ended up forking winAVR in my plugin. I consider this as a bad thing because changes to winAVR are not automatically promoted to this plugin. And because I do not want to give the impression I am taking the credits of winAVR.

Now the plugin is published I'm surprised about how many people download it and use it. I have 800+ hits a day on my site now (and rising) but I have no clue how many downloads have been done. I think this proves Arduino is maturing and growth paths to "more professional development tools" are needed.
Many people have told me that the plugin works "out of the box". I understand this as: "I know about eclipse and C++, further on I don't know what I am doing but I have been able to build a sketch and upload it to the Arduino board".  :)
So -without knowing all the other tools around- I dare to state that currently my plugin is the closest you can get to "an Arduino IDE's for dummies for experienced software developers".
For which I feel proud  8)

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 -


Jantje

razorjack
please do and share your findings.
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 -

Mr_RGB

Hi!

During December, I gave this plugin a spin. Once I got it set up, it definitely was preferable to using the Arduino IDE. However, getting it set up (more-or-less) correctly was quite difficult. Here are some of the problems I ran into. I would love it if the plugin handled more of these automatically so that new users weren't confused by these issues (and so they didn't have to follow a bazillion steps in setup instructions.)

Problem #1:
First of all, it would be helpful to make clear that users of this plugin are not expected to download the C++ edition of Eclipse to install it into. I did this at first, and it really confused me. You should probably clearly state very clearly exactly what version of Eclipse to use with the plugin.

Problem #2:
I found that in order to get my Arduino 1.0 code to compile properly, and also for many of its symbols to be resolved correctly in Eclipse as I was editing (otherwise they are marked as errors in edit windows), I needed to add some defined values to each of the following pages:

"Properties->C/C++ Build->Settings->Tool Settings->AVR Compiler->Symbols->Define Syms (-D)"
"Properties->C/C++ Build->Settings->Tool Settings->AVR C++ Compiler->Symbols->Define Syms (-D)"

Specifically, I added:

ARDUINO = 100
__AVR_ATmega328P__ = 1 (or whatever chip you are using) in GCC and/or G++
__IN_ECLIPSE__ = 1   (more on this later)

It would be nice if the plugin prompted for at least the first two of these in some obvious way (on a project configuration page?), so users didn't have to go digging into compiler options in order to set these values. Having to change them in two places is also annoying.

Problem #3:
That helped, but I was still seeing symbols such as Arduino-specific methods marked as errors. Therefore, in each of the following pages:

"Properties->C/C++ Build->Settings->Tool Settings->AVR Compiler->Directories->Include Paths (-I)"
"Properties->C/C++ Build->Settings->Tool Settings->AVR C++ Compiler->Directories->Include Paths (-I)"

I added the following entries:
<PathToMyArduinoIDEFolder>\arduino-1.0\hardware\tools\avr\avr\include
<PathToMyArduinoIDEFolder>\arduino-1.0\hardware\tools\avr\lib\gcc\avr\4.3.2\include

Again, it would be nice if the plugin automatically added these to the include paths, so users didn't have to go digging into compiler options in order to set these values.

This resolved most of the "red" text indicators. However, some were still left. It seems that Eclipse has some bugs in that if a file is imported via an #include which includes a relative path, such as '#include "avr/foo.h"', and it includes another include via the same relative path ("#include 'avr/bar.h") then at edit time, Eclipse doesn't seem to find and parse the most-deeply-nested included file. Among other things, this meant that my "Serial" object was always marked as an error. This resulted in me having to work around the problem by adding a few declarations into my source files that would only be processed when I was editing in Eclipse, thus quieting the error indicators. In one file, for instance, I added this at the top of the file:

#ifdef __IN_ECLIPSE__
extern HardwareSerial Serial;
static void eeprom_write_byte (uint8_t *__p, uint8_t __value);
#endif

Problem #4:
I was still seeing Eclipse warning messages about constructs like:

   const char helpText1[] PROGMEM = "stuff";

which stated "only initialized variables can be placed into program memory area". Apparently this is a bug with avr-g++:

http://www.avrfreaks.net/index.php?name=PNphpBB2&file=printview&t=57011

A bug report was filed against it, and is reported as "fixed" for version 4.6.2 of the gcc compiler:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34734

It would be nice if the plugin could include this version of the compiler or later.

My main advice to you would be to automate as much of this kind of setup as possible, so that users will not have to figure out what's wrong and what to do about it. It took me a long time to figure out how to get this working, and judging from some of the recent comments to this forum, I'm not the only one. Having the plugin ask some questions at install time (or when requested) and then setting itself up automatically from those would be really helpful, especially to people who are unfamiliar with the intricacies of the Eclipse C++ build process.
   
Thanks very much for writing the plugin!

Phille

Hi!
Great work on this plugin!

However, i have a slight problem everytime i try to upload to my Duemilanove 328. I constantly get the error message

"AVRDude does not support the project target MCU(Atmega328P)

Please select a different target MCU if you want to use AVRDude"

Is it something i missed out during the installation or is there a way around this?

I am running this on  OSX Snow Leopard.

Any help is greatly appreciated!

/Phil

Go Up