Description
This issue is related to #391 and #414
I am trying to build for the Pi Zero W using target=arm-unknown-linux-gnueabihf. I think that's the right target for RPi, but there is no way to distinguish between building for ARMv6 (RPi 1 and Zero) vs. ARMv7 (RPi 2). The resulting binary is ARMv7, which works on RPi2, but crashes with a segmentation fault on RPi Zero.
I add the following in my simple Rust project's Cross.toml
file to avoid using the older "0.2" version docker image that was upgraded for #391
[target.arm-unknown-linux-gnueabihf]
image = "rustembedded/cross:arm-unknown-linux-gnueabihf"
AND I can confirm using docker images
after running cross build
that I'm not using the older arm-unknown-linux-gnueabihf-0.2.0
REPOSITORY TAG IMAGE ID CREATED SIZE
rustembedded/cross arm-unknown-linux-gnueabihf ba2dc7364b10 5 days ago 2.2GB
It appears to me that cross build
is creating an ARMv7 binary, and this causes the Seqmentation Fault on the Pi Zero, which is an ARMv6 CPU.
$ !readelf
readelf --arch-specific target/arm-unknown-linux-gnueabihf/debug/rpi-test
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "7-A"
Tag_CPU_arch: v7
Tag_CPU_arch_profile: Application
Tag_ARM_ISA_use: Yes
Tag_THUMB_ISA_use: Thumb-2
Tag_FP_arch: VFPv3-D16
Tag_ABI_PCS_GOT_use: GOT-indirect
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_rounding: Needed
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_needed: 8-byte
Tag_ABI_enum_size: int
Tag_ABI_VFP_args: VFP registers
Tag_CPU_unaligned_access: v6
Tag_ABI_FP_16bit_format: IEEE 754