Serial and I²C with ATmega2560

Hi there,

I'm trying to get an arduino program working on my ATMega2560 but it won't compile.
When I'm trying to compile my code I get a ld segmentation fault:

collect2: error: ld terminated with signal 11 [Segmentation fault]

I reduced my program to the very elementary things that produce the error:

#include <Wire.h>

void setup() {Serial.begin(9600); }

void loop() {}

The problem here seems to be that I'm using both the Wire and the Serial functions. When I remove one of the #include or the Serial.begin,
the program compiles without any error.
What makes this issue even more interesting is the fact, that when I'm compiling this for an ATMega1280 or some other ATMega, it also
compiles without errors. I only get this error when i select ATMega2560.
Do I have to use another serial library for the ATmega2560 or do you have any other ideas to get this working?

Thanks in advance,
DaDrivel

When I compile your minimal sketch on 1.0, for the Mega2560, I get:

Binary sketch size: 4544 bytes (of a 258048 byte maximum)

What version of the IDE are you using?

Mh, strange. I'm using the Arduino 1.0.1 IDE for Linux, which should be the latest.

Thanks for your reply,
DaDrivel

I got the same results with 1.0.1 (on Windows 7).

What distribution?

There have been known issues with some of the avr tools that some distributions install.

I've got a "debian 7 testing". But it doesn't seem to work on 1.0.1 for
Windows 7 either.
And when I use Arduino 1.0 IDE, it works. I guess, I'll just use that IDE then.
Thanks for your help :slight_smile:

DaDrivel

So, its busted in 1.0.1 but not 1.0?

Binary sketch size: 4,358 bytes (of a 258,048 byte maximum)

1.0.1 on OSX compiles it fine.

So, its busted in 1.0.1 but not 1.0?

Not busted in either one on Windows 7. Since OP seems to be having a problem on Win7, too, I suspect that it is his/her installation that is the problem, not the IDE.

Not busted in either one on Windows 7. Since OP seems to be having a problem on Win7, too, I suspect that it is his/her installation that is the problem, not the IDE.

Oh, i understood it didn't work with your 1.0.1. I'm gonna check my libraries then cause using the old version makes me feel a little uneasy.
Thanks to all for your information so far :slight_smile:

DaDrivel

Just to finish this thread:
I reinstalled my Arduino 1.0.1 IDE + libraries and it's all working fine now :slight_smile:
Thanks for your help and patience.

DaDrivel