Hi Everyone,
I know compiling Arduino sketches with Eclipse is not supported, but still, I hope someone can give me a hand with this.
I was using Eclipse to write code for the Arduino and it worked beautifully with versions up to 0014. My setup follows the eclipse guide in the Playground, but with a few differences:
After creating my new project, I copy all files from hardware/cores/arduino/
into an arduino/
folder inside the project, and I add that to the include directories for the C and C++ compilers. I do not use a pre-compiled core.a
file, but link against .o files from the arduino folder. That allows me to modify the arduino lib when needed. I simply delete the main.cxx file and use my own:
#include "WProgram.h"
void setup(void);
void loop(void);
int main(void) {
init();
setup();
for (;;)
loop();
}
I have a separate file that defines my setup() and loop(), blink.cpp in this case:
#include "WProgram.h"
void setup(void) {
pinMode(13, OUTPUT);
}
unsigned char state = HIGH;
void loop(void) {
state = !state;
digitalWrite(13, state);
delay(300);
}
This no longer works with the Arduino library from 0015 or SVN version.
This is the build log in eclipse, errors are highlighted at the end:
Compiling the blink example with the Arduino IDE with enabled verbose build:
As far as I can see, everything is about the same, with the only difference that I skip copying objects into the core.a file. I don't really understand all options passed to the compiler/linker. I'd be very happy if anyone can provide some insight.
I reviewed changes in the arduino library and noticed HardwareSerial.cpp does not rely on code in wiring_serial.c anymore. Deleting wiring_serial.c solves the duplicate interrupt handler issue, but the one for '__cxa_pure_virtual' remains. I suppose this is a problem of the compiler not being able to compile Print.cpp?!
Additional info about my setup:
OS: Ubuntu 9.04
avr-gcc 4.3.2
avr-libc 1.6.2 (both avr-gcc and avr-libc are the latest versions of the Ubuntu packages)
Eclipse: 3.4.1
AVR-Eclipse Plugin: 2.3.1
Arduino: Duemilanove with 328p
PS. This should probably be moved to 'Arduino Forum ? Software ? Troubleshooting'. Sorry, should have seen this category before posting.