初级会员
- 积分
- 84
- 金钱
- 84
- 注册时间
- 2020-5-27
- 在线时间
- 14 小时
|
发表于 2022-4-26 16:15:07
|
显示全部楼层
Linux内核空间无法调用C库函数并且禁用FPU,可以放弃了。内核这么设计有利于上下文切换和调度。
实在要用的话,建议拷贝要用的函数到你的文件中。
经过我的实验,手动实现某些数学计算,如三角函数计算,只要涉及浮点数,编译时不会error,有一些warning如下:
- MODPOST 1 modules
- WARNING: "__aeabi_f2d" [/work/coding/1_diy/22_dts_i2c_mpu6050/mpu6050.ko] undefined!
- WARNING: "__aeabi_fcmplt" [/work/coding/1_diy/22_dts_i2c_mpu6050/mpu6050.ko] undefined!
- WARNING: "__aeabi_fmul" [/work/coding/1_diy/22_dts_i2c_mpu6050/mpu6050.ko] undefined!
- WARNING: "__aeabi_fdiv" [/work/coding/1_diy/22_dts_i2c_mpu6050/mpu6050.ko] undefined!
- WARNING: "__aeabi_f2iz" [/work/coding/1_diy/22_dts_i2c_mpu6050/mpu6050.ko] undefined!
- WARNING: "__aeabi_fcmple" [/work/coding/1_diy/22_dts_i2c_mpu6050/mpu6050.ko] undefined!
- WARNING: "__aeabi_fcmpge" [/work/coding/1_diy/22_dts_i2c_mpu6050/mpu6050.ko] undefined!
- WARNING: "__aeabi_fsub" [/work/coding/1_diy/22_dts_i2c_mpu6050/mpu6050.ko] undefined!
- WARNING: "__aeabi_d2f" [/work/coding/1_diy/22_dts_i2c_mpu6050/mpu6050.ko] undefined!
- WARNING: "__aeabi_dmul" [/work/coding/1_diy/22_dts_i2c_mpu6050/mpu6050.ko] undefined!
- WARNING: "__aeabi_i2f" [/work/coding/1_diy/22_dts_i2c_mpu6050/mpu6050.ko] undefined!
- WARNING: "__aeabi_fcmpgt" [/work/coding/1_diy/22_dts_i2c_mpu6050/mpu6050.ko] undefined!
- WARNING: "__aeabi_fadd" [/work/coding/1_diy/22_dts_i2c_mpu6050/mpu6050.ko] undefined!
复制代码 最终加载驱动时会报错如下:
- root@ATK-IMX6U:/work# insmod mpu6050.ko
- mpu6050: Unknown symbol __aeabi_fadd (err 0)
- mpu6050: Unknown symbol __aeabi_fcmpgt (err 0)
- mpu6050: Unknown symbol __aeabi_i2f (err 0)
- mpu6050: Unknown symbol __aeabi_dmul (err 0)
- mpu6050: Unknown symbol __aeabi_d2f (err 0)
- mpu6050: Unknown symbol __aeabi_fsub (err 0)
- mpu6050: Unknown symbol __aeabi_fcmpge (err 0)
- mpu6050: Unknown symbol __aeabi_fcmple (err 0)
- mpu6050: Unknown symbol __aeabi_f2iz (err 0)
- mpu6050: Unknown symbol __aeabi_fdiv (err 0)
- mpu6050: Unknown symbol __aeabi_fmul (err 0)
- mpu6050: Unknown symbol __aeabi_fcmplt (err 0)
- mpu6050: Unknown symbol __aeabi_f2d (err 0)
复制代码 原因是,当前使用Linux内核版本不支持ARM平台的相关运算,相同的内核代码在X86平台是没有问题的。
|
|