The Software serial multple serial test example does not compile

I tried compile the "Software serial multple serial test " example code for Mega 2560. But got an error:
c:/program files/arduino-1.0.5-r2/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr6/crtm2560.o: In function __vector_default': (.vectors+0xdc): relocation truncated to fit: R_AVR_13_PCREL against symbol __vector_55' defined in .text.__vector_55 section in core.a(HardwareSerial.cpp.o)

The code is unmodified and from examples in IDE. I list it here all the same.
/*
Software serial multple serial test

Receives from the hardware serial, sends to software serial.
Receives from software serial, sends to hardware serial.

The circuit:

  • RX is digital pin 10 (connect to TX of other device)
  • TX is digital pin 11 (connect to RX of other device)

Note:
Not all pins on the Mega and Mega 2560 support change interrupts,
so only the following can be used for RX:
10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69

Not all pins on the Leonardo support change interrupts,
so only the following can be used for RX:
8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).

created back in the mists of time
modified 25 May 2012
by Tom Igoe
based on Mikal Hart's example

This example code is in the public domain.

*/
#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(57600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}

Serial.println("Goodnight moon!");

// set the data rate for the SoftwareSerial port
mySerial.begin(4800);
mySerial.println("Hello, world?");
}

void loop() // run over and over
{
if (mySerial.available())
Serial.write(mySerial.read());
if (Serial.available())
mySerial.write(Serial.read());
}

Just one question. If your using a mega board which has four internal hardware serial ports why are you fooling around with software serial? It will never perform as well as just using the hardware serial ports.

I see. I thought that the Software serial is what is used with GSM library.

LMI:
I see. I thought that the Software serial is what is used with GSM library.

Not sure what the GSM library is using but using (even if having to modify) it with hardware serial would be better in my opinion.

This is a bit confusing. I thought that the software serial library uses interrupts with RX. And so is new or at least good to use.
This is from GSM modem's reference page.
"It relies on the Software Serial library for communication between the moden and Arduino. "

I got hardware serial port working. But if use them I must control the modem myself without GSM libraries.

Hi LMI

I got the same errors as you did when compiling that SoftwareSerial example on the 1.0.5 version of the IDE.

But it compiled without errors on version 1.5.6. I could not test if the program worked, however.

Regards

Ray

Hi

Yes, I have v.105-R2 too

R_AVR_13_PCREL is a known bug in the avr-gcc linker.

Hi LMI

Try installing 1.5.6 then. You can install it in a different folder from 1.0.5 and keep both of them on your system (at least on Windows). Then just click on the 1.5.6 executable to run it.

Regards

Ray

LMI:
I see. I thought that the Software serial is what is used with GSM library.

Presumably the library was written to work on the Uno which has only 1 hardware serial port.

I wonder could you trick the library by using something like #define mySoftSerial Serial1

Someone who is better at C/C++ can advise

...R

Even if the GSM shield uses SoftwareSerial (it does, but it's a bastardization of the original) that doesn't explain why you are trying to create another instance (of a different class) of a software serial implementation on a device with 4 hardware serial ports. Surely you are not trying to read from 6 serial devices at once.

PaulS:
Even if the GSM shield uses SoftwareSerial (it does, but it's a bastardization of the original) that doesn't explain why you are trying to create another instance (of a different class) of a software serial implementation on a device with 4 hardware serial ports. Surely you are not trying to read from 6 serial devices at once.

"The World Is Not Enough" but I used the Software serial because that was what the examples said. Using arduino libraries and examples is usually the easiest way and what I can see, the GSM libraries do not understand extra HW serial ports..

I just downloaded IDE Arduino IDE 156