1. 程式人生 > >如何在i.MX6UL平臺上實現硬浮點與軟浮點?

如何在i.MX6UL平臺上實現硬浮點與軟浮點?

needed dia profile src exc idt pcs readelf adding

i.MX 6UltraLite(簡稱為i.MX 6UL)是i.MX6系列的新產品。i.MX 6UltraLite采用單核ARM Cortex-A7,處理器主頻528MHz,采用NEON技術加速多媒體和信號處理算法,具有浮點運算單元。適合於物聯網,電子支付,智能家居,能源管理等領域。


如何在i.MX6UL平臺上實現硬浮點與軟浮點?

本次開發使用的硬件平臺為飛淩嵌入式OKMX6UL-C開發板(產品詳情:www.forlinx.com/69.htm),其它板卡請酌情參考使用,具體實現操作步驟如下:

技術分享圖片

硬浮點交叉編譯方法為

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

加入編譯參數 -mfloat-abi=hard,並且使用arm-linux-readelf -A 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

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

采用的是Tag_ABI_VFP_args: VFP registers ,已經采用硬浮點了。

軟浮點交叉編譯方法:

arm-linux-gcc -o teset_soft test.c 並且使用arm-linux-readelf -A test_soft查看,如下:

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

測試結果:

進行10億次加減乘除運算,硬浮點時間為1分34.8 軟浮點時間為4分19.7。


飛淩嵌入式福利:U盤免費領取

ARM相關技術日新月異,嵌入式開發平臺玲瑯滿目,工程師在對產品進行選型時往往會感到困惑。為了幫助您更方便的進行選型,我們整理了飛淩公司基於NXP、TI、SAMSUNG等品牌的主流開發板資料與一些嵌入式學習資料供您參閱,您只需索取 U 盤就可獲得,共計200個,數量有限,送完為止。

U盤申請時間:2018年1月2日-1月20日

U盤發放地址:飛淩嵌入式官方網站 www.forlinx.com/dongtai/216.htm



技術分享圖片

技術分享圖片

長按指紋“識別二維碼”關註




如何在i.MX6UL平臺上實現硬浮點與軟浮點?