Hi,
I am new to Arduino, Getting Following Error. Seeking Help to resolve!
Regards,
Arduino: 1.8.5 (Windows 7), Board: "Arduino/Genuino Uno"
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\main.cpp: In function 'main':
C:\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'
}
^
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\main.cpp:51:1: error: this is the insn:
(insn 929 926 932 62 (set (mem:QI (post_dec:HI (reg/f:HI 32 SP_L )) [0 S1 A8])
(subreg:QI (reg/f:HI 853) 1)) C:\Users\Abhijeet\Desktop\Modified_Panorama_Equipment_Control_Final_Program_with_XY_Remot\Modified_Panorama_Equipment_Control_Final_Program_with_XY_Remot.ino:316 1 {pushqi1}
(expr_list:REG_ARGS_SIZE (const_int 7 [0x7])
(nil)))
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\main.cpp:51: confused by earlier errors, bailing out
lto-wrapper: C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-gcc returned 1 exit status
c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ld.exe: error: lto-wrapper failed
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino/Genuino Uno.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Do a search It seems to be a compiler bug and there are workarounds (to my knowledge) but you might have to dig a little; maybe user @pert has the knowledge at hand.
pert
June 28, 2018, 7:06am
3
It's a compiler bug.
You will find a workaround described here:
opened 12:22PM - 13 Oct 15 UTC
closed 12:07PM - 17 Sep 19 UTC
I upgraded from Arduino IDE 1.0.6 to 1.6.5 and now my sketch have compile error:…
unable to find a register to spill in class 'POINTER_REGS'
I've narrow it down to a function (I've modified it to try to understand the compile error). Odd thing is if I remove any of the 4 line of code in the for loop, then it compiles ok. Here's the test sketch with this issue:
```
float dhistory[10];
float test;
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
test = getSlope(dhistory);
}
float getSlope(float history[]) {
float sumx = 0;
float sumy = 0;
float sumxy = 0;
float sumxsq = 0;
float rate = 0;
int n = 10;
for (int i=1; i< 11; i++) {
sumx = sumx + i;
sumy = sumy + history[i-1];
sumy = sumy + history[i-1];
sumxsq = sumxsq + (i*i);
}
rate = sumy+sumx+sumxsq;
return rate;
}
```
MarkT
June 28, 2018, 10:35am
4
Specifically its a bug in the register-allocation section of the code-generator - the part that allocates
variables to slots in the stack frame or machine registers. "Spilling" is the act of moving a register
value to the stack frame. The compiler is trying to free up a register for another variable and failing.
Its almost certainly trying to do heavy optimization of register use.
You could try changing the compiler options to reduce the level of optimization attempted by the
compiler.
Another way which usually works is simplify the expression which is causing the problem by breaking it up into two or more separate statements. If that doesn't help then move those statements into a separate function. See these two threads for a discussion about it.
https://forum.arduino.cc/index.php?topic=510473.0
https://forum.arduino.cc/index.php?topic=397909.0
Post your code in code tags .
Pete