LowPowerLab Forum

Hardware support => MoteinoMEGA => Topic started by: Humancell on July 25, 2019, 06:10:19 PM

Title: Moteino MEGA Serial1.begin() fails to compile?
Post by: Humancell on July 25, 2019, 06:10:19 PM
Hello,

I saw that I ought to be able to use Serial1 on the Moteino MEGA.  I'm running into a weird issue ...

If I put:

Code: [Select]
Serial.begin(115200);

In my sketch, it works,

If I put:

Code: [Select]
Serial.begin(115200);
Serial1.begin(115200);

In my sketch it blows up with quite a wacky error:

Code: [Select]
lto1.exe: internal compiler error: in splice_child_die, at dwarf2out.c:4905

Please submit a full bug report,

with preprocessed source if appropriate.

See <http://gcc.gnu.org/bugs.html> for instructions.

lto-wrapper.exe: fatal error: D:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-gcc returned 1 exit status

compilation terminated.

d:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/bin/ld.exe: error: lto-wrapper failed

collect2.exe: error: ld returned 1 exit status

Uh ... WHAT?

If I comment that one Serial1 line ... everything works.

Ideas?
Title: Re: Moteino MEGA Serial1.begin() fails to compile?
Post by: Felix on July 26, 2019, 09:24:36 AM
What IDE version?

If you google around for the infamous "collect2.exe: error: ld returned 1 exit status" you will see its a prevalent bug. I see it quite often, especially when switching between board/MCU types. It can end up compiling after several retries, but most of the time I end up restarting the IDE and that solves it. I think I have also seen this elusive error when really there is some other problem (a real compile problem - but that real error is typically specified at the top of the ton of RED console text that is spit out after compilation) so this can trip you into thinking its something else. But in your case where the only difference is an obvious good line of code, then its just that IDE bug that I see as well.

Try restart the IDE, see if that solves it. If not latest version, try it on that.
I just tried MoteinoMEGA compilation of Blink with Serial1.begin(115200), no issues on 1.8.7 and 1.8.9.
Title: Re: Moteino MEGA Serial1.begin() fails to compile?
Post by: Humancell on July 27, 2019, 11:18:32 AM
What IDE version?

If you google around for the infamous "collect2.exe: error: ld returned 1 exit status" you will see its a prevalent bug. I see it quite often, especially when switching between board/MCU types. It can end up compiling after several retries, but most of the time I end up restarting the IDE and that solves it. I think I have also seen this elusive error when really there is some other problem (a real compile problem - but that real error is typically specified at the top of the ton of RED console text that is spit out after compilation) so this can trip you into thinking its something else. But in your case where the only difference is an obvious good line of code, then its just that IDE bug that I see as well.

Try restart the IDE, see if that solves it. If not latest version, try it on that.
I just tried MoteinoMEGA compilation of Blink with Serial1.begin(115200), no issues on 1.8.7 and 1.8.9.

Yeah ... this is really wacky.

I'm using v1.8.7 right now ... and will try updating later today to the latest.  Also Moteino AVR Boards v1.5.0.

I *do* switch between board types ... but have restarted the IDE numerous times now and it persists.  My entire sketch compiles and runs just fine, but I realized that I ought to be able to shift a SoftwareSerial interface to use the second hardware serial interface.

I compile just fine, then add the one line and compile fails.

Also, there are no other lines of output in the compile that are "red"/errors ... just what I posted.  It really is a mystery.

Now, Blink also compiles and works for me with Serial1.begin(115200); ... so now that only enhances the mystery.  :-)

I did find this one:  https://github.com/ImpulseAdventure/GUIslice/issues/83

I"ll post after updating the IDE and see if I get around this ...