Go Down

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

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 -

Go Up