Hi,
Refere to:
https://forum.arduino.cc/index.php?topic=416147
and others.
The complete error message is;
/Applications/Arduino-1.6.12.app/Contents/Java/hardware/arduino/avr/cores/arduino/main.cpp: In function 'main':
/Applications/Arduino-1.6.12.app/Contents/Java/hardware/arduino/avr/cores/arduino/main.cpp:51:1: error: unable to find a register to spill in class 'NO_REGS'
}
^
/Applications/Arduino-1.6.12.app/Contents/Java/hardware/arduino/avr/cores/arduino/main.cpp:51:1: error: this is the insn:
(insn 1766 1763 1769 240 (set (mem:QI (post_dec:HI (reg/f:HI 32 __SP_L__)) [0 S1 A8])
(subreg:QI (reg/f:HI 1195) 1)) /Users/Robert/Data/Our Documents/Projets Techniques/Domotic/Arduino/Sketch/HomeAutomation/My_RFM_MQTT_COCO_12/_Rf_functions.ino:631 1 {pushqi1}
(expr_list:REG_ARGS_SIZE (const_int 5 [0x5])
(nil)))
/Applications/Arduino-1.6.12.app/Contents/Java/hardware/arduino/avr/cores/arduino/main.cpp:51: confused by earlier errors, bailing out
lto-wrapper: /Applications/Arduino-1.6.12.app/Contents/Java/hardware/tools/avr/bin/avr-gcc returned 1 exit status
/Applications/Arduino-1.6.12.app/Contents/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ld: lto-wrapper failed
collect2: error: ld returned 1 exit status
This error occurs in one of my script (too complex to describe here) since I am using IDE version, 1.6.11 and above including 1.8
I can't explain this issue, because I could not find any logical association between this error and the correction I have to made in my script (which is typically to Serial.print a variable, that has noting to do with compilation options taken in my script that seems to cause the issue).
So the only solution I could find is to remove the "flto" parameters in the platform.txt
See Contents/Java/hardware/arduino/avr/platform.txt
I test it with version 1.6.12, but the workaround is similar for 1.8 see below.
Any idea the origin of this issue and of course when should it be fixed?
Robert
Arduino AVR Core and platform.
------------------------------
For more info:
Arduino IDE 1.5 3rd party Hardware specification · arduino/Arduino Wiki · GitHub
name=Arduino AVR Boards
version=1.6.14
AVR compile variables
---------------------
compiler.warning_flags=-w
compiler.warning_flags.none=-w
compiler.warning_flags.default=
compiler.warning_flags.more=-Wall
compiler.warning_flags.all=-Wall -Wextra
Default "compiler.path" is correct, change only if you want to override the initial value
compiler.path={runtime.tools.avr-gcc.path}/bin/
compiler.c.cmd=avr-gcc
ACTUAL DEFINITIONS OF IDE Version 1.6.14
#compiler.c.flags=-c -g -Os {compiler.warning_flags} -std=gnu11 -ffunction-sections -fdata-sections -MMD -flto -fno-fat-lto-objects
#compiler.c.elf.flags={compiler.warning_flags} -Os -flto -fuse-linker-plugin -Wl,--gc-sections
#compiler.c.elf.cmd=avr-gcc
#compiler.S.flags=-c -g -x assembler-with-cpp -flto
#compiler.cpp.cmd=avr-g++
#compiler.cpp.flags=-c -g -Os {compiler.warning_flags} -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto
# REPLACED BY DEFINITIONS FROM IDE VERSION 1.6.10
compiler.c.flags=-c -g -Os {compiler.warning_flags} -std=gnu11 -ffunction-sections -fdata-sections -MMD
compiler.c.elf.flags={compiler.warning_flags} -Os -Wl,--gc-sections
compiler.c.elf.cmd=avr-gcc
compiler.S.flags=-c -g -x assembler-with-cpp
compiler.cpp.cmd=avr-g++
compiler.cpp.flags=-c -g -Os {compiler.warning_flags} -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD