自己編寫Makefile編譯應用程序報錯如下:
wys@ubuntu:/mnt/hgfs/projects/bd3/zlg/lcd驅動$ make
make: Warning: File `Makefile' has modification time 6.5 s in the future
/opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc -o spidev_test spidev_test.c -lpthread -static -mfloat-abi=soft
In file included from /opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/features.h:389:0,
from /opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/stdint.h:25,
from /opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/lib/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.9.1/include/stdint.h:9,
from spidev_test.c:14:
/opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/gnu/stubs.h:7:29: fatal error: gnu/stubs-soft.h: No such file or directory
# include <gnu/stubs-soft.h>
^
compilation terminated.
make: *** [modules] Error 1
解決辦法:
cc has a builtin define to denote hard abi when in use, e.g. when using -mfloat-abi=hard it will define __ARM_PCS_VFP to 1 and therefore we should check that to determine which calling convention is in use and not __VFP_FP__ which merely indicates presence of VFP unit
這些其實是在編譯選項裏面設定的,如果你傻傻的去找 __ARM_PCS_VFP那就很慘了,你會完全沒有頭緒。
其實只需要修改編譯參數,-mfloat-abi=hard 或者 -mfloat-abi=soft