pi4j-v2: Native binaries for ARMv6 (Pi Zeros) are incompatible.

As noted in issue #27, the native builds for ARMv6 (Pi Zeros and all Generation 1 models) are not working.
The 32-bit binaries compiled are not ARMv6 compatible.

This issue affects the following Raspberry Pi models

  • RPi 1 Model A
  • RPi 1 Model A+
  • RPi 1 Model B
  • RPi 1 Model B+
  • RPi Compute Module 1
  • RPi Zero
  • RPi Zero W

(from https://en.wikipedia.org/wiki/Raspberry_Pi)

Changes to native build happened here: https://github.com/Pi4J/pi4j-v2/commit/a7c29d098920a11d99217fe2b4a24c596709e9cf

I switched from ARM compiler toolchain available from RaspberryPi Tools to a newer GCC version 32-bit cross-compiler (gcc-arm-linux-gnueabihf) toolchain available in APT repositories.

REF: https://github.com/Pro/raspi-toolchain

By default, newer GCC versions do not create correct binaries for ARMv6. Even though you pass the correct -mcpu= flag to gcc, it will create startup code for the newer ARMv7 architecture. Running them on your RasPI Zero will cause an “Illegal Instruction” exception.

I probably need to instrument one of these custom toolchains in the build logic for building 32-bit rather than the default linarogcc-arm-linux-gnueabihf

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Comments: 36 (19 by maintainers)

Commits related to this issue

Most upvoted comments

The GCC compiler is pretty old in the RaspberryPi Tools repo that I was originally using. So maybe first we can try the one published here and see if they work for ARMv6+FP.

I’ll try to get this working soon.