arduino / arduino-cli

Arduino command line tool
https://arduino.github.io/arduino-cli/latest/
GNU General Public License v3.0
4.35k stars 377 forks source link

"Out of memory" error when installing `arduino:samd` platform #1059

Closed arock093 closed 1 year ago

arock093 commented 3 years ago

I thought about posting this in the forum. It seems like a underlying technical issue so hopefully this will be alright.

I'm using a raspberry pi zero w. Based off of reports by others on the forum, it should be able to handle arduino-cli. I tested the command arduino-cli core install arduino:avr and it worked fine. I'm trying to run the commands, arduino-cli core install arduino:samd and arduino-cli core install adafruit:samd

This is the output. Both commands get hung up on "Installing arduino:arm-none-eabi-gcc@7-2017q4..." and then are Killed.

Downloading packages...
arduino:arm-none-eabi-gcc@7-2017q4 downloaded                                   
arduino:bossac@1.7.0-arduino3 downloaded                                        
arduino:openocd@0.10.0-arduino7 downloaded                                      
arduino:CMSIS@4.5.0 downloaded                                                  
arduino:CMSIS-Atmel@1.2.0 downloaded                                            
arduino:arduinoOTA@1.2.1 downloaded                                             
arduino:samd@1.8.9 downloaded                                                   
Installing arduino:arm-none-eabi-gcc@7-2017q4...
Killed

The process is getting killed for some reason.

dmesg output indicates a memory issue:

Out of memory: Killed process 514 (arduino-cli) total-vm:938304kB, anon-rss:398624kB, file-rss:0kB, shmem-rss:0kB, UID:1000 pgtables:598kB oom_score_adj:0
per1234 commented 3 years ago

Hi @arock093. Thanks for your bug report.

Please post the output from this command:

arduino-cli version
arock093 commented 3 years ago

Hi @arock093. Thanks for your bug report.

Please post the output from this command:

arduino-cli version

arduino-cli Version: 0.13.0 Commit: 693a045

per1234 commented 3 years ago

OK, I think this bug might have been fixed since the time of the 0.13.0 release version you're using (https://github.com/arduino/arduino-cli/pull/981).

Please try again with the nightly build of Arduino CLI and then let us know if that fixes the issue: https://arduino.github.io/arduino-cli/latest/installation/#nightly-builds

arock093 commented 3 years ago

OK, I think this bug might have been fixed since the time of the 0.13.0 release version you're using (#981).

Please try again with the nightly build of Arduino CLI and then let us know if that fixes the issue: https://arduino.github.io/arduino-cli/latest/installation/#nightly-builds

I used the nightly build and it allowed me to install the cores. Now I'm having an issue compiling.

I've also opened an issue on Adafruit/samd repository - https://github.com/adafruit/ArduinoCore-samd/issues/271

arduino-cli compile --fqbn adafruit:samd:adafruit_trinket_m0 MyFirstSketch
/home/pi/.arduino15/packages/adafruit/hardware/samd/1.6.3/cores/arduino/WInterrupts.c: In function 'detachInterrupt':
/home/pi/.arduino15/packages/adafruit/hardware/samd/1.6.3/cores/arduino/WInterrupts.c:378:1: internal compiler error: Illegal instruction
 }
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
/home/pi/.arduino15/packages/adafruit/hardware/samd/1.6.3/cores/arduino/cortex_handlers.c: In function 'Reset_Handler':
/home/pi/.arduino15/packages/adafruit/hardware/samd/1.6.3/cores/arduino/cortex_handlers.c:543:1: internal compiler error: Illegal instruction
 }

I am able to compile for a different board.

arduino-cli compile --fqbn arduino:avr:mega MyFirstSketch
Sketch uses 1536 bytes (0%) of program storage space. Maximum is 253952 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 8183 bytes for local variables. Maximum is 8192 bytes.

I am also able to compile the sketch for the board on a different computer.

Using a Raspberry Pi 4, the sketch compiles without any issues for the Adafruit Trinket M0 board. This leads me to believe the issue has something to due with the relationship between the Rasperry Pi Zero W and adafruit:samd.

I get the same errors when I try to compile for other adafruit:samd boards on the Raspberry Pi Zero W.


gcc --version
gcc (Raspbian 8.3.0-6+rpi1) 8.3.0

Section of verbose output:

/home/pi/.arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/arm-none-eabi-gcc -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -MMD "-D__SKETCH_NAME__=\"\"\"MyFirstSketch.ino\"\"\"" -DF_CPU=48000000L -DARDUINO=10607 -DARDUINO_TRINKET_M0 -DARDUINO_ARCH_SAMD -DCRYSTALLESS -DADAFRUIT_TRINKET_M0 -D__SAMD21E18A__ -DARM_MATH_CM0PLUS -DUSB_VID=0x239A -DUSB_PID=0x801E -DUSBCON -DUSB_CONFIG_POWER=100 "-DUSB_MANUFACTURER=\"Adafruit\"" "-DUSB_PRODUCT=\"Trinket M0\"" -I/home/pi/.arduino15/packages/adafruit/hardware/samd/1.6.4/cores/arduino/TinyUSB -I/home/pi/.arduino15/packages/adafruit/hardware/samd/1.6.4/cores/arduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore -I/home/pi/.arduino15/packages/adafruit/hardware/samd/1.6.4/cores/arduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src -Os -I/home/pi/.arduino15/packages/adafruit/tools/CMSIS/5.4.0/CMSIS/Core/Include/ -I/home/pi/.arduino15/packages/adafruit/tools/CMSIS/5.4.0/CMSIS/DSP/Include/ -I/home/pi/.arduino15/packages/arduino/tools/CMSIS-Atmel/1.2.0/CMSIS/Device/ATMEL/ -I/home/pi/.arduino15/packages/adafruit/hardware/samd/1.6.4/cores/arduino -I/home/pi/.arduino15/packages/adafruit/hardware/samd/1.6.4/variants/trinket_m0 /home/pi/.arduino15/packages/adafruit/hardware/samd/1.6.4/cores/arduino/WInterrupts.c -o /tmp/arduino-sketch-704E54BF84B4765302A16BBD33C1F4E6/core/WInterrupts.c.o
/home/pi/.arduino15/packages/adafruit/hardware/samd/1.6.4/cores/arduino/WInterrupts.c: In function 'detachInterrupt':
/home/pi/.arduino15/packages/adafruit/hardware/samd/1.6.4/cores/arduino/WInterrupts.c:378:1: internal compiler error: Illegal instruction
 }
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
/home/pi/.arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/**arm-none-eabi-gcc** -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -MMD "-D__SKETCH_NAME__=\"\"\"MyFirstSketch.ino\"\"\"" -DF_CPU=48000000L -DARDUINO=10607 -DARDUINO_TRINKET_M0 -DARDUINO_ARCH_SAMD -DCRYSTALLESS -DADAFRUIT_TRINKET_M0 -D__SAMD21E18A__ -DARM_MATH_CM0PLUS -DUSB_VID=0x239A -DUSB_PID=0x801E -DUSBCON -DUSB_CONFIG_POWER=100 "-DUSB_MANUFACTURER=\"Adafruit\"" "-DUSB_PRODUCT=\"Trinket M0\"" -I/home/pi/.arduino15/packages/adafruit/hardware/samd/1.6.4/cores/arduino/TinyUSB -I/home/pi/.arduino15/packages/adafruit/hardware/samd/1.6.4/cores/arduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore -I/home/pi/.arduino15/packages/adafruit/hardware/samd/1.6.4/cores/arduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src -Os -I/home/pi/.arduino15/packages/adafruit/tools/CMSIS/5.4.0/CMSIS/Core/Include/ -I/home/pi/.arduino15/packages/adafruit/tools/CMSIS/5.4.0/CMSIS/DSP/Include/ -I/home/pi/.arduino15/packages/arduino/tools/CMSIS-Atmel/1.2.0/CMSIS/Device/ATMEL/ -I/home/pi/.arduino15/packages/adafruit/hardware/samd/1.6.4/cores/arduino -I/home/pi/.arduino15/packages/adafruit/hardware/samd/1.6.4/variants/trinket_m0 /home/pi/.arduino15/packages/adafruit/hardware/samd/1.6.4/cores/arduino/cortex_handlers.c -o /tmp/arduino-sketch-704E54BF84B4765302A16BBD33C1F4E6/core/cortex_handlers.c.o
/home/pi/.arduino15/packages/adafruit/hardware/samd/1.6.4/cores/arduino/cortex_handlers.c: In function 'Reset_Handler':
/home/pi/.arduino15/packages/adafruit/hardware/samd/1.6.4/cores/arduino/cortex_handlers.c:545:1: internal compiler error: Illegal instruction
 }
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
Error during build: exit status 1

I was thinking about manually updating gcc but I'm not sure if it's using Raspberry PI OS included gcc to compile or the one it downloads with Adafruit:samd.

ubidefeo commented 3 years ago

@arock093 unfortunately there will always be some issues with armv6 because some tools (or versions of them) do not run happily on it. If you move to armv7 (Pi3) you should have no issues. The Zero is also quite slow and runs on 512MB of RAM. The tests I ran on it a while back took an excruciatingly long time to compile for SAMD and when it came to mbedos I could sit there forever :(

Right now my only hope when it comes to that format is that Raspberry Pi Foundation releases a Zero form-factor board with more RAM and a new CPU :)

arock093 commented 3 years ago

Thanks for the help and feedback everyone. I apologize for opening an issue when it was less of a software issue and more hardware compatibility problem.

I was able to get an Arduino Micro to work with the Raspberry Pi Zero.

As far as this issue goes, should I close it and try to get the adafruit:SAMD repo to mention somewhere about the Pi zero having compatibility issues?

ubidefeo commented 3 years ago

@arock093 when it comes to 3rd party cores we don't have power, but we are working towards making sure that dependencies are properly installed when they are properly defined in the core package. I haven't gone through Adafruit's ones, but I know they do their research and are very responsive when it comes to issues reports :)

umbynos commented 1 year ago

Closing because the original Out of Memory bug was resolved. Thanks for the interest in the project :heart: