How to Take i.MX6UL to do Hard-floating and Soft-floating

i.MX 6UltraLite(for short i.MX 6UL) is a single-core ARM Cortex-A7 SoC running at speed at up to 528MHz,  integrated with NEON MPE (Media Processing Engine) Co-processor which is applicable for IoT, E-payment, smart home, power management and other related applications.


How to do hard-floating and soft-floating by i.MX6UL platform? 

 

Here we'll take Forlinx OKMX6UL-C for demonstration(product details please refer to (https://www.forlinx.net/product/i.mx6ul-39.html):

Follow below steps to do hard-floating: 


arm-linux-gcc -march=armv7-a -mfpu=neon -mfloat-abi=hard -o test test.c

add in compiling parameters   -mfloat-abi=hard, and take arm-linux-readelf -A test to check as below 


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

  Tag_Advanced_SIMD_arch: NEONv1

  Tag_ABI_PCS_wchar_t: 4

  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_align_preserved: 8-byte, except leaf SP

  Tag_ABI_enum_size: int

  Tag_ABI_HardFP_use: SP and DP

  Tag_ABI_VFP_args: VFP registers

  Tag_DIV_use: Not allowed


we can get that it takes Tag_ABI_VFP_args: VFP registers for hard-floating 

 

Follow below steps to do soft-floating 


arm-linux-gcc -o teset_soft test.c and take arm-linux-readelf -A test_soft to check as below: 


Attribute Section: aeabi

File Attributes

  Tag_CPU_name: "ARM10TDMI"

  Tag_CPU_arch: v5T

  Tag_ARM_ISA_use: Yes

  Tag_THUMB_ISA_use: Thumb-1

  Tag_ABI_PCS_wchar_t: 4

  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_align_preserved: 8-byte, except leaf SP

  Tag_ABI_enum_size: int

  Tag_DIV_use: Not allowed


VFP was not used. 

 

Testing result: 

Do a billion times of computing, hard-floating time is one minute thirty four point 8, and soft-floating time is four minutes nineteen point seven.