Go Down

Topic: Arduino+Eclipse tutorial, from start to finish (Read 17 times) previous topic - next topic

Aeturnalus

I actually use Eclipse for 99.5% of my Arduino development, which is why I've been following this thread. 

However, I actually run linux as a primary OS, which is probably why I haven't encountered, for example, your case sensitivity issues - it runs without any such errors in my case.

As for includes, the path specification in the linker settings (project properties -> C/C++ build -> linker) allows you to set default paths to look in for library header files, which should resolve the inclusion problems you're having.

One notable difference, I think, is that I've imported the Arduino core as a separate project in Eclipse, and I can thus recompile the code for whatever processor and clock speed I might be using.

In regards to the toolchain:

avr-gcc is the compiler and linker, and it hasn't changed in any significant way for a number of years.
avrdude is the firmware flasher, which interfaces with a hardware programmer of some sort - this, admittedly, has made some pretty big shifts (arguably for the better).

The Arduino system has most compiler warnings and errors disabled, which is why you usually don't encounter them - it's not a compatibility issue so much as just hiding the output.

As for fuses in Eclipse: Eclipse's fuse editor is very well designed, BUT the Arduino bootloader doesn't support writing fuses (I believe it returns 0x00 for everything).  Go to the avrdude settings and disable fuse burning, and the errors should disappear.  The fuses in the Arduino IDE's boards.conf are used when burning the bootloader, which requires a full hardware programmer of some sort (be it the AVR-ISP sketch or an avrispv2). 

FalconFour

Interesting! Good to know about the fuses thing. Funny that avrdude using its "arduino" configuration still tries to write fuses, then. It's admirable that avrdude includes an "arduino" config to begin with, of course! I think the fuses thing may be due to the fact that it imports the stk500v1 (oh yes, I did a LOT of work on this stuff last night) loading procedure after doing some custom setup for Arduino (reset with DTR, etc).

Maybe the avr-gcc system hasn't changed much, but something about the way it compiles... I directly slapped the avr-gcc binaries from WinAVR into my Arduino software in their respective folders, and it nearly ate itself... the best I got to was some error about "cc1.exe" unable to load some file (and cc1.exe wasn't in the referenced folder to begin with). Nothing I could do would make it work right, so I just gave up and reverted to the backup files from Arduino. It seems like every aspect of compilation -> linking -> assembly -> upload is custom in some way to Arduino...

I'm curious about how you managed to get it to compile included Arduino libraries, though. What's your library folder structure look like, are the libraries in individual folders like Arduino? Do you use different #include statements or anything? I'd really like to use Eclipse, as it builds and uploads really quick (although I sorely dislike that the default button is "build all" - I only ever want to build the current project, and it insists on building them all!), and has some really amazing structure management that'd help move development along on some of my bigger projects... I'm not writing it off entirely, but I mean, it REALLY took a toll on me, mentally and physically, last night trying to get it working right :(

Aeturnalus

I always got the impression that the 'arduino' config was left in for compatibility purposes - using a bootloader, in general, precludes fuse changes.

My folder structure is as such:

Code: [Select]

Arduino-328P (this is a static library)
  |Debug (compiled binaries)
  |various files from the source folder on Arduino.cc
Blinkenlights (example blink program)
  |Debug (compiled binaries)
  | main.cc
  | pins.h


In the build settings, all paths are set to include "${workspace_loc:/Arduino-328P/Debug}" and "${workspace_loc:/Arduino-328P}", with debugging info disabled (Arduino bootloader doesn't support JTAG, and it saves compiled code size)

I have attached an Eclipse export of my configuration for you (I honestly don't remember all the things I changed), so hopefully that will help you out.  I reiterate, though, that I'm running the whole thing on a full install of Linux, and thus have avoided at least a few of your problems.

sixeyes

I have Eclipse working on Windows XP. It took ages to get working. I think I had three attempts and for some reason on the third attempt it just worked.

I had the Arduino library compiled as a separate project. I've also got GLCD as a separate library. I think I had to set up the include paths in a particular way to get it to compile, but I've not worked with it for over six months so I can't remember what I did.

Re: Build all, if you don't build all, eclipse doesn't detect dependencies correctly. There's a bug logged about it but it hadn't been fixed in the Helios build I installed last year. The down side with this is if you're working with libraries (I was) your changes don't get compiled into the image :-(

So I ended up having to build all every time. At least it doesn't compile every file like the Arduino IDE, it only checks for out of date files.

Iain

oscarcar

BTW, I've had lots of problems with cygwin and changing the "/" and "\" and such.

And it runs differently when running in a windows command shell compared to running in a cygwin shell.

I would go with a virtual machine or a dual-boot of linux, or a separate pc that you remote into.

Go Up