How do determine whether Linux board is using hardware FPU or not?

I am using an embedded Linux board based on a fairly old Freescale ARM chip. How do I determine whether the Python interpreter there is using the hardware FPU on the chip or not?

My /proc/cpuinfo is:

Processor       : ARM926EJ-S rev 5 (v5l)
BogoMIPS        : 179.81
Features        : swp half thumb fastmult edsp java
CPU implementer : 0x41
CPU architecture: 5TEJ
CPU variant     : 0x0
CPU part        : 0x926
CPU revision    : 5
Asked By: SeanLabs

||

Try

awk '$1 == "fpu" { print $3 ; }' /proc/cpuinfo

which give

yes
yes

you cant refine with

 awk '$1 == "fpu" { print $3 ; exit ;}' /proc/cpuinfo

to have only one yes.

A mere grep would yield (flags line abbridged)

fpu         : yes
fpu_exception       : yes
flags               : fpu vme de pse tsc msr pae mce cx8 apic sep mtr ...
fpu         : yes
fpu_exception       : yes
flags               : fpu vme de pse tsc msr pae mce cx8 apic sep mtr ...

unfortunatly I don’t have a FPU less linux to make the test, maybe a rapsberry owner ?

Answered By: Archemar

In the ARM world from ARMv4 to ARMv7 floating-point support is called VFP, and hardware support for it appears in the Features line of /proc/cpuinfo or in the VFP support log message printed by the kernel while booting. (In ARMv8 it’s just “FP”.)

In /proc/cpuinfo on an Allwinner A20 this gives:

Features    : swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 

(see the various vfp features) and in the boot log:

VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 4

If VFP isn’t fully supported, the kernel will instead log

VFP support v0.3: not present

or

VFP support v0.3: no double precision support

As to whether your Python interpreter is capable of using this, it appears to depend mainly on the architecture of your ARM Linux distribution. If I understand things correctly, basic Debian armel won’t use the FPU, Debian armhf (and Raspbian armhf) will; the older Debian arm variant used FPU instructions, but these were emulated if the hardware didn’t support them. On armel you can install kernels or C libraries with FPU support (although no such C library appears to be available in the Debian archives).

Answered By: Stephen Kitt
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.