Compiler error with nano (clone)

I hope I'm in the right place, I don't want to be horse-whipped by some senior members, I'm trying to learn.This is not a full time job, it's a hobby. Sorry if that offends some of you. Ok, so:

The scenario is thus:

I've been experimenting with a 2.4" TFT with SPI interface using different devices. As such I was trying different libraries and configurations on different boards. I was hoping to couple it with a 3.3v device to save the hassle of level conversion, but ran into issues there which we can consider irrelevant for this post. At this point I tried to upload an example graphics test from the Adafruit library and use resistors for the level conversion. That is when I got the compiler error below.

Arduino: 1.8.7 (Windows 10), Board: "Arduino Nano, ATmega328P (Old Bootloader)"

C:\Users\flagt\Documents\Arduino\libraries\Adafruit_GFX_Library\Adafruit_SPITFT.cpp: In member function 'drawPixel':

C:\Users\flagt\Documents\Arduino\libraries\Adafruit_GFX_Library\Adafruit_SPITFT.cpp:1341:1: internal compiler error: Segmentation fault

}

^

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: C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-gcc returned 1 exit status

compilation terminated.

c:/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

exit status 1
Error compiling for board Arduino Nano.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Truthfully I'm unsure as to whether I'm qualified to submit a bug report after reading the instructions. (Prior to retirement I had to submit bug reports to Bell Labs; the process was much simpler) So I'm not sure where to go with this issue.

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:

Here's the traditional 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 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.

Alternate workaround:
One of the Arduino developers recently worked on this and claims to have fixed it. There is a special beta testing hardware package you can install via the Arduino IDE's Boards Manager that has the fix:

  • (In the Arduino IDE) File > Preferences
  • In the "Additional Boards Manager URLs" field, enter: http://downloads.arduino.cc/packages/package_avr_7.3.0_index.json If you already have an additional Boards Manager URL in that field, you can separate multiple URLs with commas or click the button on the right side of the field to open a dialog that allows you to add each on its own line.
  • Click "OK"
  • Tools > Board > Boards Manager
  • Wait for the downloads to finish
  • Click on "Arduino AVR Boards by Arduino"
  • Click the "Update" button.
  • Wait for the update to finish.
  • Click "Close".

Thank You, Thank You, Thank You, Pert, I'll give that a try in order, and post results asap.

Hi, pert, The first work around did the trick. The verbose output looked like this:

Sketch uses 17896 bytes (58%) of program storage space. Maximum is 30720 bytes.
Global variables use 608 bytes (29%) of dynamic memory, leaving 1440 bytes for local variables. Maximum is 2048 bytes.
C:\Users\flagt\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino9/bin/avrdude -CC:\Users\flagt\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino9/etc/avrdude.conf -v -patmega328p -carduino -PCOM5 -b57600 -D -Uflash:w:C:\Users\flagt\AppData\Local\Temp\arduino_build_321312/graphicstest.ino.hex:i 

avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\flagt\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino9/etc/avrdude.conf"

         Using Port                    : COM5
         Using Programmer              : arduino
         Overriding Baud Rate          : 57600
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : Arduino
         Description     : Arduino
         Hardware Version: 2
         Firmware Version: 1.16
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% -0.00s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: reading input file "C:\Users\flagt\AppData\Local\Temp\arduino_build_321312/graphicstest.ino.hex"
avrdude: writing flash (17896 bytes):

Writing | ################################################## | 100% 5.08s

avrdude: 17896 bytes of flash written
avrdude: verifying flash memory against C:\Users\flagt\AppData\Local\Temp\arduino_build_321312/graphicstest.ino.hex:
avrdude: load data flash data from input file C:\Users\flagt\AppData\Local\Temp\arduino_build_321312/graphicstest.ino.hex:
avrdude: input file C:\Users\flagt\AppData\Local\Temp\arduino_build_321312/graphicstest.ino.hex contains 17896 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 3.82s

avrdude: verifying ...
avrdude: 17896 bytes of flash verified

avrdude done.  Thank you.

Many thanks. If/when you have a moment could you explain what the segmentation error is about, I'd really appreciate it.

I think you responded to my other post regarding my other Nano regarding reinstalling the bootloader could this fix that issue as well? Again many thanks I owe you a beer :slight_smile:

flagtrax:
Hi, pert, The first work around did the trick.

Great!

flagtrax:
Many thanks. If/when you have a moment could you explain what the segmentation error is about, I'd really appreciate it.

I don't think anyone, including the Arduino developers, understands what the segmentation error is about. I was probably the first person in the Arduino world to encounter this error, back during the beta testing period for avr-gcc 5.4.0, and I've spent a lot of time researching it without finding any answers. All I know is that there is a bug in Arduino's avr-gcc 5.4.0. I have not figured out if this issue is specific to Arduino's version of avr-gcc, or if it's a in issue with avr-gcc in general. The newer version of avr-gcc does not have this issue and hopefully Arduino will update to that version in their production packages soon.

flagtrax:
could this fix that issue as well

No, it's completely unrelated.

No, it's completely unrelated.

Yeah, found that out ;D :stuck_out_tongue:

No, it's completely unrelated.

Yeah, found that out ;D :stuck_out_tongue:
Btw the one that is working is still using the old bootloader.

Update:
Well, I must sheepishly state that I was wrong (again) :confused: I watched the led on the Nano happily blink in the wee hours and thought it was uploading. Unfortunately that wasn't the case. I blew out the candle before testing, and when I came back to it, found that not only did it not upload, It no longer communicates with the IDE, just like the other one that I can't reflash the bootloader to. Back to the drawing board. I'm now trying to build up courage to try loading a new bootloader.....sigh....

Back with good and bad news; good news one nano has been restored after some bizarre crazy problems but it now has a bootloader and accepts sketches. The bad news is the other one will still not accept a bootloader. I'm posting this for any and all in the event others come across a similar situation or have knowledge/resolution of the problem. Thanks for all the feedback. Here's the error:

Arduino: 1.8.7 (Windows 10), Board: "Arduino Nano, ATmega328P"

C:\Users\flagt\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino9/bin/avrdude -CC:\Users\flagt\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino9/etc/avrdude.conf -v -patmega328p -cstk500v1 -PCOM4 -b19200 -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xDA:m -Ulfuse:w:0xFF:m

avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

System wide configuration file is "C:\Users\flagt\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino9/etc/avrdude.conf"

Using Port : COM4
Using Programmer : stk500v1
Overriding Baud Rate : 19200
AVR Part : ATmega328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :

Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00

Programmer Type : STK500
Description : Atmel STK500 Version 1.x firmware
Hardware Version: 2
Firmware Version: 1.18
Topcard : Unknown
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Error while burning bootloader.
Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x0000ff
avrdude: Expected signature for ATmega328P is 1E 95 0F
Double check chip, or use -F to override this check.

avrdude done. Thank you.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.