TinyCircuits

TinyCircuits Products => TinyDuino => Topic started by: IanBZa on January 07, 2019, 07:14:56 AM

Title: Compile error when linking TinyDuino with Rockblock
Post by: IanBZa on January 07, 2019, 07:14:56 AM
Hi.

I am trying to connect a TinyDuino to a Rockblock Iridium but im getting compile errors and I have no idea why.

The error i'm getting is:
Code: [Select]
lto1: internal compiler error: in lto_output_varpool_node, at lto-cgraph.c:624
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
lto-wrapper: fatal error: /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-gcc returned 1 exit status
compilation terminated.
/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino Pro or Pro Mini.

I'm using the stock standard example for the Rockblock - but i've switched it to software serial:
Code: [Select]
#include <IridiumSBD.h>
#include <time.h>
/*
 * Time
 *
 * This sketch demonstrates how to retrieve the Iridium system time
 * from the modem using the new getSystemTime method. This uses
 * the Iridium command AT-MSSTM to acquire the time.  The method will
 * fail if the Iridium network has not yet been acquired.
 *
 * Assumptions
 *
 * The sketch assumes an Arduino Mega or other Arduino-like device with
 * multiple HardwareSerial ports. It assumes the satellite modem is
 * connected to Serial3. Change this as needed. SoftwareSerial on an Uno
 * works fine as well.
 */
#include <SoftwareSerial.h>


SoftwareSerial IridiumSerial(4, 5);
/*#define IridiumSerial Serial3*/
#define DIAGNOSTICS false // Change this to see diagnostics

// Declare the IridiumSBD object
IridiumSBD modem(IridiumSerial);

void setup()
{
  int err;
 
  // Start the console serial port
  Serial.begin(115200);
  while (!Serial);

  // Start the serial port connected to the satellite modem
  IridiumSerial.begin(19200);

  // If we're powering the device by USB, tell the library to
  // relax timing constraints waiting for the supercap to recharge.
  modem.setPowerProfile(IridiumSBD::USB_POWER_PROFILE);

  // Begin satellite modem operation
  Serial.println("Starting modem...");
  err = modem.begin();
  if (err != ISBD_SUCCESS)
  {
    Serial.print("Begin failed: error ");
    Serial.println(err);
    if (err == ISBD_NO_MODEM_DETECTED)
      Serial.println("No modem detected: check wiring.");
    return;
  }
}

void loop()
{
   struct tm t;
   int err = modem.getSystemTime(t);
   if (err == ISBD_SUCCESS)
   {
      char buf[32];
      sprintf(buf, "%d-%02d-%02d %02d:%02d:%02d",
         t.tm_year + 1900, t.tm_mon + 1, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec);
      Serial.print("Iridium time/date is ");
      Serial.println(buf);
   }

   else if (err == ISBD_NO_NETWORK)
   {
      Serial.println("No network detected.  Waiting 10 seconds.");
   }

   else
   {
      Serial.print("Unexpected error ");
      Serial.println(err);
      return;
   }

   // Delay 10 seconds
   delay(10 * 1000UL);
}

#if DIAGNOSTICS
void ISBDConsoleCallback(IridiumSBD *device, char c)
{
  Serial.write(c);
}

void ISBDDiagsCallback(IridiumSBD *device, char c)
{
  Serial.write(c);
}
#endif

Any ideas as to what could be happening?

Thanks in advance.
 
Ian
Title: Re: Compile error when linking TinyDuino with Rockblock
Post by: IanBZa on January 08, 2019, 01:30:14 AM
So I have found a solution:

----
This bug is specific to the 5.4.0-atmel3.6.1-arduino2 version of avr-gcc used by Arduino AVR Boards 1.6.22 and newer. It has been reported here:
https://github.com/arduino/ArduinoCore-avr/issues/39

A workaround is described in the link above.

Here's a less desirable, but possibly easier alternative workaround:

* Tools > Board > Boards Manager
* Wait for downloads to finish.
* When you move the mouse pointer over "Arduino AVR Boards", you will see a "Select version" dropdown menu appear. Select "1.6.21".
* Click "Install".
* Wait for installation to finish.
* Click "Close".

Due to a bug, this alternative workaround doesn't work with Arduino IDE 1.8.6, but it will work with any other version of the Arduino IDE.

If you have File > Preferences > Check for updates on startup checked, the Arduino IDE may occasionally notify you that a new version of Arduino AVR Boards is available, you'll need to refrain from updating back to the new Arduino AVR Boards version, otherwise you'll be back to seeing the segmentation fault error again.

------
The above is taken from: https://forum.arduino.cc/index.php?topic=574020.0 - so not my solution :)