Hey, I have been running into this error.
Building in release mode
Compiling .pio/build/teensy40/src/main.cpp.o
Illegal instruction
*** [.pio/build/teensy40/src/main.cpp.o] Error 132
Hey, I have been running into this error.
Building in release mode
Compiling .pio/build/teensy40/src/main.cpp.o
Illegal instruction
*** [.pio/build/teensy40/src/main.cpp.o] Error 132
Missing information:
platformio.ini
main.cpp
or the most minimal code which can reproduce the problemHello Max! Jan and I are working on this together. Thanks for the help again.
Info:
what operating system and IDE are you running on
I am trying to move the system you helped me with from a raspberry pi 4 to a raspberry pi zero W. This is PlatformIO Core on a reasperry pi zeroW.
what is the full platformio.ini
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:teensy40]
platform = teensy
framework = arduino
board = teensy40
platform_packages =
toolchain-gccarmnoneeabi@https://bintray.com/platformio/tool-packages/download_file?file_path=3579c14-toolchain-gccarmnoneeabi-linux_armv6l-1.90301.200702.tar.gz
tool-teensy@https://github.com/maxgerhardt/pio-tool-teensy-arm/archive/master.zip
main.cpp
or the most minimal code which can reproduce the problemProcessing teensy40 (platform: teensy; framework: arduino; board: teensy40)
-----------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/teensy/teensy40.html
PLATFORM: Teensy (4.11.0) > Teensy 4.0
HARDWARE: IMXRT1062 600MHz, 512KB RAM, 1.94MB Flash
DEBUG: Current (jlink) External (jlink)
PACKAGES:
- framework-arduinoteensy 1.153.0 (1.53)
- tool-teensy 1.152.200516 (1.52)
- toolchain-gccarmnoneeabi 1.90301.200702 (9.3.1)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 89 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/teensy40/src/main.cpp.o
Illegal instruction
*** [.pio/build/teensy40/src/main.cpp.o] Error 132
=============================================================== [FAILED] Took 24.02 seconds ===============================================================
Here is the rest of the output
Sounds to me like youāre trying to run the gcc toolchain compiled for a 32-bit system on a 64-bit operating system. Whatās the output of uname -a
on the target system?
Linux raspberrypi 5.4.72+ #1356 Thu Oct 22 13:56:00 BST 2020 armv6l GNU/Linux
Okay a armv6l
system running toolchain-gccarmnoneeabi-linux_armv6l
package seems fine to me at first glance. Please:
cd ~/.platformio/pacakges
@1.90301.200702
suffix. If that suffixed-folder exist, cd
into that, otherwise the one without the suffix.cd bin/
into itfile ./arm-none-eabi-gcc
ldd ./arm-none-eabi-gcc
./arm-none-eabi-gcc --version
[and post output]pi@raspberrypi:~/Documents/UploadTest $ cd ~/.platformio/packages/
pi@raspberrypi:~/.platformio/packages $ ls
contrib-piohome framework-arduinoteensy toolchain-gccarmnoneeabi@src-12d887f0bbffef90b4646370dd7372ae tool-teensy
contrib-pysite toolchain-gccarmnoneeabi tool-scons
pi@raspberrypi:~/.platformio/packages $ cd toolchain-gccarmnoneeabi@src-12d887f0bbffef90b4646370dd7372ae/
pi@raspberrypi:~/.platformio/packages/toolchain-gccarmnoneeabi@src-12d887f0bbffef90b4646370dd7372ae $ cd bin/
pi@raspberrypi:~/.platformio/packages/toolchain-gccarmnoneeabi@src-12d887f0bbffef90b4646370dd7372ae/bin $ file ./arm-none-eabi-gc
arm-none-eabi-gcc arm-none-eabi-gcc-ar arm-none-eabi-gcc-ranlib arm-none-eabi-gcov-dump
arm-none-eabi-gcc-9.3.1 arm-none-eabi-gcc-nm arm-none-eabi-gcov arm-none-eabi-gcov-tool
pi@raspberrypi:~/.platformio/packages/toolchain-gccarmnoneeabi@src-12d887f0bbffef90b4646370dd7372ae/bin $ file ./arm-none-eabi-gcc
./arm-none-eabi-gcc: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=e44abfbe3cf82773ba07252dbf98e4904079e6c6, not stripped
pi@raspberrypi:~/.platformio/packages/toolchain-gccarmnoneeabi@src-12d887f0bbffef90b4646370dd7372ae/bin $ ldd ./arm-none-eabi-gcc
/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so => /usr/lib/arm-linux-gnueabihf/libarmmem-v6l.so (0xb6f47000)
libiconv.so.2 => /home/pi/.platformio/packages/toolchain-gccarmnoneeabi@src-12d887f0bbffef90b4646370dd7372ae/bin/./libiconv.so.2 (0xb6e56000)
libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0xb6dc0000)
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6c72000)
/lib/ld-linux-armhf.so.3 (0xb6f5a000)
pi@raspberrypi:~/.platformio/packages/toolchain-gccarmnoneeabi@src-12d887f0bbffef90b4646370dd7372ae/bin $ ./arm-none-eabi-gcc --version
Segmentation fault
pi@raspberrypi:~/.platformio/packages/toolchain-gccarmnoneeabi@src-12d887f0bbffef90b4646370dd7372ae/bin $ pi@raspberrypi:~/.platformio/packages/toolchain-gccarmnoneeabi@src-12d887f0bbffef90b4646370dd7372ae/bin pi@raspberrypi:~/.platformio/packages/toolchain-gccarmnoneeabi@src-12d887f0bbffef90b4646370dd7372ae/bipi@raspi@raspi@raspi@raspi@pi@raspi@raspberrypi:~/.plapi@raspberrypi:~/.platformio/packages/tpi@raspberrypi:~/.platformio/packpi@raspberrypi:~/.platformipi@raspberrypi:~/.platformio/packages/toolchain-gccarmnoneeabi@src-12d887f0bbffef90b4646370dd7372ae/bin $
ls -lh /lib/ld-linux-armhf.so.3
?sudo apt update && sudo apt install libc6-dbg
(in reference to here). Then rerun ./arm-none-eabi-gcc --version
. Does it still crash?ls -lh /lib/ld-linux-armhf.so.3
?lrwxrwxrwx 1 root root 30 May 14 2019 /lib/ld-linux-armhf.so.3 -> arm-linux-gnueabihf/ld-2.28.so
Hit:1 http://archive.raspberrypi.org/debian buster InRelease
Get:2 http://raspbian.raspberrypi.org/raspbian buster InRelease [15.0 kB]
Fetched 15.0 kB in 3s (5,091 B/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
Reading package lists... Done
Building dependency tree
Reading state information... Done
libc6-dbg is already the newest version (2.28-10+rpi1).
libc6-dbg set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
pi@raspberrypi:~ $ cd ~/.platformio/pacakges
-bash: cd: /home/pi/.platformio/pacakges: No such file or directory
pi@raspberrypi:~ $ ls
Bookshelf Desktop Documents Downloads Music Pictures Public Templates Videos
pi@raspberrypi:~ $ cd ~/.platformio/pacakges
-bash: cd: /home/pi/.platformio/pacakges: No such file or directory
pi@raspberrypi:~ $ cd .platformio/packages/
pi@raspberrypi:~/.platformio/packages $ ls
contrib-piohome framework-arduinoteensy toolchain-gccarmnoneeabi@src-12d887f0bbffef90b4646370dd7372ae tool-teensy
contrib-pysite toolchain-gccarmnoneeabi tool-scons
pi@raspberrypi:~/.platformio/packages $ cd toolchain-gccarmnoneeabi@src-12d887f0bbffef90b4646370dd7372ae/
pi@raspberrypi:~/.platformio/packages/toolchain-gccarmnoneeabi@src-12d887f0bbffef90b4646370dd7372ae $ cd bin/
pi@raspberrypi:~/.platformio/packages/toolchain-gccarmnoneeabi@src-12d887f0bbffef90b4646370dd7372ae/bin $ file ./arm-none-eabi-gcc
./arm-none-eabi-gcc: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=e44abfbe3cf82773ba07252dbf98e4904079e6c6, not stripped
pi@raspberrypi:~/.platformio/packages/toolchain-gccarmnoneeabi@src-12d887f0bbffef90b4646370dd7372ae/bin $ ldd ./arm-none-eabi-gcc
/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so => /usr/lib/arm-linux-gnueabihf/libarmmem-v6l.so (0xb6f82000)
libiconv.so.2 => /home/pi/.platformio/packages/toolchain-gccarmnoneeabi@src-12d887f0bbffef90b4646370dd7372ae/bin/./libiconv.so.2 (0xb6e91000)
libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0xb6dfb000)
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6cad000)
/lib/ld-linux-armhf.so.3 (0xb6f95000)
pi@raspberrypi:~/.platformio/packages/toolchain-gccarmnoneeabi@src-12d887f0bbffef90b4646370dd7372ae/bin $ ./arm-none-eabi-gcc --version
Segmentation fault
For some reason the binary obtained from the toolchain-gccarmnoneeabi-linux_armv6l
is not executable on the Pi Zero W⦠Either some other package is missing (Iāve read about libc6-armhf-cross
but yoāre already running in a armhf system, no reason to have a cross libraryā¦), or the binary wasnāt built for ARMv6l and contains some instructions that donāt exist for ARMv6l. In that case the compiler would have to be recompiled on the target system and repackage. Iāll investigate on my Pi Zero W.
if this helps at all, I ran through the steps and did ./arm-none-eabi-gcc --version on the normal toolchain-gccarmnoneeabi and this was the result:
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 5.4.1 20160919 (release) [ARM/embedded-5-branch revision 240496]
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
pi@raspberrypi:~/.platformio/packages/toolchain-gccarmnoneeabi/bin $
I tried a few things that were suggested in another thread such as using an older version of teensy with this .ini
[env:teensy40]
platform = teensy@4.4.0
framework = arduino
board = teensy40
platform_packages =
toolchain-gccarmnoneeabi@https://bintray.com/platformio/tool-packages/download_file?file_path=3579c14-toolchain-gccarmnoneeabi-linux_armv6l-1.90301.200702.tar.gz
tool-teensy@https://github.com/maxgerhardt/pio-tool-teensy-arm/archive/master.zip
But unfortunately it didnāt change anything, and I still had the same error. I also looked into trying a different toolchain-gccarmnoneeabi but it didnāt work either, at this point Iām at a loss. Thanks!
Iāve setup my Raspberry Pi Zero W succesfully with the latest Raspbian Lite image. I can observe the exact same error as you regarding the illegal instruction. Sadly, running gdb
on the arm-none-eabi-gcc
doesnāt reveal any insights as to whatās going on inside, it just crashes at a very early stage.
So Iāve decided itās best to compile the needed GCC version (9.3.1
or similiar) on the Raspbi Zero W by following these steps
apt-get -f install -y \
build-essential \
autoconf \
autogen \
bison \
dejagnu \
flex \
flip \
gawk \
git \
gperf \
gzip \
nsis \
openssh-client \
p7zip-full \
perl \
python-dev \
libisl-dev \
scons \
tcl \
texinfo \
tofrodos \
wget \
zip \
texlive \
texlive-extra-utils \
libncurses5-dev
./install-sources.sh --skip_steps=mingw32
./build-prerequisites.sh --skip_steps=mingw32
./build-toolchain.sh --skip_steps=mingw32
Once the build completes you can find the binary and source tarballs in āpkgā along with the md5 checksum.
Now Iām just waiting to see whether these steps go through; as itās currently in the build-prerequisites.sh
. I fear that my 16GB SD card is too small for that or that the compilation will take up so much RAM that it will be swapping to SD card all the time, making compilation extremely slow. Building GCC even on a normal x86_64 laptop costs 45 minutes from my memory, and that Pi is⦠dramatically slower that that laptop. Iām expecting this to take time in the range of 4-8 hours.
So Iāll see how that works out and upgrade my SD card if space runs out, or if RAM runs out then too Iāll have to somehow get a cross-compiler for the Raspberry Pi Zero W; Just a matter of time.
Once arm-none-eabi-gcc is compiled and executable on the Pi itās just a matter of copying the build output and creating a new toolchain-gccarmnoneabi
package as Iāve done for other the other pacakages (GitHub - maxgerhardt/toolchain-riscv-macos: Short test for an updated PlatformIO RISCV toolchain for MacOS, GitHub - maxgerhardt/pio-tool-teensy-arm) and referencing that new package in platform_packages
.
So the ./build-prerequisites.sh --skip_steps=mingw32
actually went through and I still have 8.3GB available on the SD card. Now doing the ./build-toolchain.sh --skip_steps=mingw32
and crossing my fingers.
Update: Itās still building⦠10 hours later⦠letting it run overnight now. Seems to be compiling its standard library for ARM now.
Update 2: Aaaand it seems Iāve run out of diskspace. Compilation terminated when compiling libm
.
/home/pi/compiling_gcc/gcc-arm-none-eabi-9-2020-q2-update/src/newlib/newlib/libm/math/el_hypot.c:18:1: fatal error: error writing to /tmp/ccKwfh0l.s: Read-only file system
18 | }
| ^
Iāll see if I can salvage the intermediate build result or have to redo this at least 24 hour procedure with a bigger SD card. Just needs time.
Due to the reason above, this project is currently on hold until my 128GB microSD card arrives on monday. I have no further microSD card other than 16GB ones (which now has a corrupted ext4 filesystem after having been hopelessly overwritten) so I canāt complete the compile process. This process seems to have gone through if it wasnāt for a lack of space though, so if you have a bigger card yourself, you can try the above steps yourself in parallel to me.
Hello!
Do you want to send me your Venmo and I will reimburse you for the larger size SD card? We really appreciate what youāre doing, and donāt want you to spend your own money helping us on this!
Thanks, see PM. Now Iām up and running with a 128GB microSD card again for the second and hopefully successful run .
Update: Some 24 hour later and itās compiling its newlib standard-C library using arm-none-eabi-gcc
. Still going strongā¦
Update: All standard libraries have been compiled and itās now doing the final GCC compiler pass.
Update wednesday morning: still doing the final compiler passā¦
Update wednesday evening: stillā¦freakingā¦compiling. itās now compiling libstdc++
and friends in possible combinations for C++ language versions, ARM architectures (v7M, ARMv7E-M, ARMv8, ā¦) and soft,softfp,hard floating point support. Jeez.
Update thursday morning: STILL compiling. Itās somehow back to compiling gcc.
Update friday, 5am: Itās now building the size optimized (libx_s.a
) versions of all its standard libraries, for all ARM archs, FloatingPoint variants and C++ language versions. This got to be most punishing compilation Iāve ever done. Even when I compiled the entire Linux kernel for a MIPS32 device, it only cost 8 hours.
Update friday, 11am: Still compiling libstdc++-v3
, this time in the armv8-m.main+fp
architecture and float abi hard
.
Update friday, 8pm: GCC compilation has finished and itās now compiling GDB and other smaller tools. The end of the tunnel is near.
hahahahah, I am actually enjoying this saga, but looking forward to being able to use it even more! Let me know if you need anything else to move things along
Noooooooo
rm -rf *.aux *.cp *.cps *.fn *.ky *.log *.pdf *.pg *.toc *.tp *.vr
+2020-11-20:19:42:11 (./build-toolchain.sh:591): make
texi2pdf How-to-build-toolchain.texi
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2019/dev/Debian) (preloaded format=pdfetex)
restricted \write18 enabled.
entering extended mode
(./How-to-build-toolchain.texi (/usr/share/texmf/tex/texinfo/texinfo.tex
Loading texinfo [version 2018-01-09.11]: pdf, fonts, markup, glyphs,
page headings, tables, conditionals, indexing, sectioning, toc, environments,
defuns, macros, cross references, insertions, localization, formatting,
and turning on texinfo input format.)
(/home/pi/compiling_gcc/gcc-arm-none-eabi-9-2020-q2-update/build-native/build-m
anual/version.texi) [1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}]
[2] [-1] (Preface) Cross reference values unknown; you must run TeX again.
Chapter 1 [1] [2] [3] [4] Chapter 2 [5]
./How-to-build-toolchain.texi:234: epsf.tex not found, images will be ignored.
@image ...f.tex not found, images will be ignored}
@global @warnednoepsftrue ...
<argument> ... @image {macos_mojave_about,,,,.png}
@unskip @hfil
@centersub ...enalty @fi @line {@kern @leftskip #1
@kern @rightskip }
@\center ...{@hfil @ignorespaces #1@unskip @hfil }
@let @centersub @relax
l.234 @center @image{macos_mojave_about,,,,.png}
?
./How-to-build-toolchain.texi:234: Emergency stop.
@image ...f.tex not found, images will be ignored}
@global @warnednoepsftrue ...
<argument> ... @image {macos_mojave_about,,,,.png}
@unskip @hfil
@centersub ...enalty @fi @line {@kern @leftskip #1
@kern @rightskip }
@\center ...{@hfil @ignorespaces #1@unskip @hfil }
@let @centersub @relax
l.234 @center @image{macos_mojave_about,,,,.png}
./How-to-build-toolchain.texi:234: ==> Fatal error occurred, no output PDF fil
e produced!
Transcript written on How-to-build-toolchain.log.
/usr/bin/texi2dvi: pdfetex exited with bad status, quitting.
make: *** [Makefile:10: How-to-build-toolchain.pdf] Error 1
pi@raspberrypi:~/compiling_gcc/gcc-arm-none-eabi-9-2020-q2-update $
It freaking stopped on converting the āHow to build toolchainā manual⦠Ugh, gotta find a way to skip that check and keep all the previously compiled data without recompiling.
ITāS A FREAKING KNOWN BUG AGJGHJKDHGHGHGKHKJGFH Bug #1854471 ā9-2019-q4 toolchain compilation from sources failā : Bugs : GNU Arm Embedded Toolchain
Looks like Iām able to continue the build after installing the missing undocumented dependency and with a modified build-toolchain.sh
which skips over the already done parts without removing the already done work.