I have tried to compile some software that has to do with LoRa. After compiling I get this error message:
D:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\main.cpp: In function 'main':
D:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\main.cpp:51:1: error: unable to find a register to spill in class 'NO_REGS'
}
^
D:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\main.cpp:51:1: error: this is the insn:
(insn 959 956 962 47 (set (mem:QI (post_dec:HI (reg/f:HI 32 __SP_L__)) [0 S1 A8])
(subreg:QI (reg/f:HI 905) 1)) D:\Program Files (x86)\Arduino\libraries\arduinoLoRaWAN\arduinoLoRaWAN.cpp:1606 1 {pushqi1}
(expr_list:REG_ARGS_SIZE (const_int 11 [0xb])
(nil)))
D:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\main.cpp:51: confused by earlier errors, bailing out
lto-wrapper: D:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-gcc returned 1 exit status
d:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ld.exe: lto-wrapper failed
collect2.exe: error: ld returned 1 exit status
The code I used is this:
#//Minimote Werkend
#include <Wire.h>
// Cooking API libraries
#include <arduinoUART.h>
#include <arduinoUtils.h>
// LoRaWAN library
#include <arduinoLoRaWAN.h>
int knop = 13;
uint8_t error;
uint8_t socket = SOCKET0;
void setup() {
char APP_SESSION_KEY[] = "000102030405060708090A0B0C0D004A";
char NWK_SESSION_KEY[] = "0102030405060708091011121314104A";
error = LoRaWAN.ON(socket);
error = LoRaWAN.setDeviceEUI();
error = LoRaWAN.setDeviceAddr();
error = LoRaWAN.setNwkSessionKey(NWK_SESSION_KEY);
error = LoRaWAN.setAppSessionKey(APP_SESSION_KEY);
error = LoRaWAN.saveConfig();
LoRaWAN.getDeviceEUI();
LoRaWAN.getDeviceAddr();
pinMode(knop, INPUT);
}
void loop() {
char data[]="";
char k[] = "30";//0
if(digitalRead(knop)==HIGH){
strcpy(k,"31");//1
}
sprintf(data, "%s%s",data, k);
delay(100);
error = LoRaWAN.ON(socket);
// delay(100);
error = LoRaWAN.joinABP();
//delay(100);
error = LoRaWAN.sendUnconfirmed(3, data);
if( error == 0 )
{
Serial.println(F("Send Unconfirmed packet OK"));
if (LoRaWAN._dataReceived == true)
{
Serial.print(F(" There's data on port number "));
Serial.print(LoRaWAN._port,DEC);
Serial.print(F(".\r\n Data: "));
Serial.println(LoRaWAN._data);
}
}
else
{
Serial.print(F("Send Unconfirmed packet error = "));
Serial.println(error, DEC);
}
// delay(100);
error = LoRaWAN.OFF(socket);
delay(25000);
}
I have no idea where this error comes from, because with simple codes like "blinky" it works fine. I have tried multiple builds from arduino but with all these build I get the same error. Can someone help me find the cause of this problem?
The libraries for this code can be found here: Libraries LoRaWAN
Thanks in advance!