Warning when compiling I.MX6 kernel module.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Warning when compiling I.MX6 kernel module.

4,297 Views
takumiono
Contributor I


Hello everyone.

I am writing an I2C kernel module for the i.MX 6Quad SABER development board.
When I compile my module with ubuntu, I get the following warning:
> WARNING: "__aeabi_f2d" [/home/xxxxx/yocto/Kerne_driver/bme280_driver/bme280_driver.ko] undefined!
> WARNING: "__aeabi_fdiv" [/home/xxxxx/yocto/Kerne_driver/bme280_driver/bme280_driver.ko] undefined!
> WARNING: "__aeabi_i2f" [/home/xxxxx/yocto/Kerne_driver/bme280_driver/bme280_driver.ko] undefined!

Running insmod .ko on the board with the module created above gives:
> bme280_driver: Unknown symbol __aeabi_i2f (err -2)
> bme280_driver: Unknown symbol __aeabi_fdiv (err -2)
> bme280_driver: Unknown symbol __aeabi_f2d (err -2)
> insmod: ERROR: could not insert module bme280_driver.ko: Unknown symbol in module

I am using floating point operations (float, double) in a module.
Is that the cause?

Could you tell me how to avoid the warning?

Best regards.

Labels (2)
0 Kudos
14 Replies

4,115 Views
takumiono
Contributor I

Dear Wiglos Sun,

 

Thank you for your reply. 

Yes, I can load it if I don't use floating point in my kernel module, but I can't load it if I use floating point.

If it can be loaded, it works both in the ”root directory” and ”/lib/modules/4.19.35-1.1.0+g0f9917c56d59.”

Is there anything I should be aware of when using floating point in imx6?

(Kernel configuration, ToolChain settings, Source code description method, etc.)

Best regards,
takumi ono

0 Kudos

4,115 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hello Takumi,

About hard floating point, and softfp, karan gajjar's answer is correct, did you research it?

B.R,

Weidong

0 Kudos

4,101 Views
takumiono
Contributor I

 

Dear Weidong sun,

Thank you for your reply.

I am also experimenting with the contents of Karangajar.
However, I do not know if that method is correct.

I took the following steps:

1. After installing ToolChain, I changed the contents of the environment-setup-cortexa9hf-neon-poky-linux-gnueabi file from hard to softfp.
Toolchain -> environment-setup-cortexa9hf-neon-poky-linux-gnueabi
>> export CC="arm-poky-linux-gnueabi-gcc -mfpu=neon -mfloat-abi=softfp -mcpu=cortex-a9 --sysroot=$SDKTARGETSYSROOT"

2.Then I ran the source command to check CC.
xxxxxx@xxxxxx-HP-EliteDesk-800-G3-SFF:~/yocto/tool/populate_sdk$ source environment-setup-cortexa9hf-neon-poky-linux-gnueabi
xxxxxx@xxxxxx-HP-EliteDesk-800-G3-SFF:~/yocto/tool/populate_sdk$ echo $CC
arm-poky-linux-gnueabi-gcc -mfpu=neon -mfloat-abi=softfp -mcpu=cortex-a9 --sysroot=/home/xxxxxx/yocto/tool/populate_sdk/sysroots/cortexa9hf-neon-poky-linux-gnueabi

3.Then compiled.
*Executing the make command gives the same warning as before.
xxxxxx@xxxxxx-HP-EliteDesk-800-G3-SFF:~/yocto/Kerne_driver/bme280_driver$ make
make ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- -C /home/xxxxxx/yocto/imx-yocto-bsp/build-x11/tmp/work/imx6qsabresd-poky-linux-gnueabi/linux-imx/4.19.35-r0/build M=/home/xxxxxx/yocto/Kerne_driver/bme280_driver modules
make[1]: ディレクトリ '/home/xxxxxx/yocto/imx-yocto-bsp/build-x11/tmp/work/imx6qsabresd-poky-linux-gnueabi/linux-imx/4.19.35-r0/build' に入ります
CC [M] /home/xxxxxx/yocto/Kerne_driver/bme280_driver/bme280_driver.o
Building modules, stage 2.
MODPOST 1 modules
WARNING: "__aeabi_f2d" [/home/xxxxxx/yocto/Kerne_driver/bme280_driver/bme280_driver.ko] undefined!
WARNING: "__aeabi_fdiv" [/home/xxxxxx/yocto/Kerne_driver/bme280_driver/bme280_driver.ko] undefined!
WARNING: "__aeabi_i2f" [/home/xxxxxx/yocto/Kerne_driver/bme280_driver/bme280_driver.ko] undefined!
CC /home/xxxxxx/yocto/Kerne_driver/bme280_driver/bme280_driver.mod.o
LD [M] /home/xxxxxx/yocto/Kerne_driver/bme280_driver/bme280_driver.ko

4. Finally, I'm loading the kernel module the way you taught me.
root@imx6qsabresd:/# cd /lib/modules/4.19.35-1.1.0+g0f9917c56d59/
root@imx6qsabresd:/lib/modules/4.19.35-1.1.0+g0f9917c56d59# ls
bme280_driver.ko modules.alias.bin modules.dep.bin modules.symbols
extra modules.builtin modules.devname modules.symbols.bin
kernel modules.builtin.bin modules.order
modules.alias modules.dep modules.softdep
root@imx6qsabresd:/lib/modules/4.19.35-1.1.0+g0f9917c56d59# modinfo bme280_driver.ko
filename: /lib/modules/4.19.35-1.1.0+g0f9917c56d59/bme280_driver.ko
license: Dual BSD/GPL
author: Takumi Ono
srcversion: 54CFC6B0D34B45253A0E89B
alias: i2c:AE_BME280_Driver
depends:
name: bme280_driver
vermagic: 4.19.35-1.1.0+g0f9917c56d59 SMP preempt mod_unload modversions ARMv7 p2v8
parm: i2c_channel:int
parm: sampling_time:int
root@imx6qsabresd:/lib/modules/4.19.35-1.1.0+g0f9917c56d59# modprobe bme280_driver.ko
modprobe: FATAL: Module bme280_driver.ko not found in directory /lib/modules/4.19.35-1.1.0+g0f9917c56d59

Is it the right way?

Best regards,
takumi ono

0 Kudos

4,115 Views
takumiono
Contributor I

Dear Wiglos Sun,

Thank you for your reply. I changed the directory and tried the modprobe command.

It was the same result as before...

>root@imx6qsabresd:/lib/modules/4.19.35-1.1.0+g0f9917c56d59# ls
>bme280_driver.ko modules.alias.bin modules.dep.bin modules.symbols
>extra modules.builtin modules.devname modules.symbols.bin
>kernel modules.builtin.bin modules.order
>modules.alias modules.dep modules.softdep


>root@imx6qsabresd:/lib/modules/4.19.35-1.1.0+g0f9917c56d59# modprobe bme280_driver.ko
>modprobe: FATAL: Module bme280_driver.ko not found in directory /lib/modules/4.19.35-1.1.0+g0f9917c56d59

Are there other factors?

By the way, I've confirmed that the module loads correctly if it doesn't perform floating point operations.

Best regards,
takumi ono

0 Kudos

4,115 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hi Takumi,

   If you build it into kernel, Can it be correctly loaded?

weidong

0 Kudos

4,114 Views
takumiono
Contributor I

Dear Wiglos Sun,

I tried the modprobe command. Then the following message appears.

> root@imx6qsabresd:/# modprobe bme280_driver.ko
> modprobe: FATAL: Module bme280_driver.ko not found in directory /lib/modules/4.19.35-1.1.0+g0f9917c56d59

Is this an error about missing libraries?
Is it related to the "Unknown symbol __aeabi_i2f (err -2), Unknown symbol __aeeabi_fdiv(err -2), Unknown symbol __aee_f2d(err -2)" messages that I get when I run insmod .ko?

Best regards,
takumi ono

0 Kudos

4,115 Views
weidong_sun
NXP TechSupport
NXP TechSupport

copy bme280_driver.ko to /lib/modules/4.19.35-1.1.0+g0f9917c56d59, please !

Then try.

Weidong

0 Kudos

4,115 Views
takumiono
Contributor I

Dear Wigloss Sun

Thank you for your reply.

I understand. I will try using modprobe.

Sorry. It will probably take about a week before the next reply.
I will send you a message when the confirmation is over.

Best regards,
Ono Takumi

0 Kudos

4,115 Views
takumiono
Contributor I

Dear Wigros Sun

Thank you for your reply. I confirmed using the method below. Is the confirmation method correct? Is there anything else I should check?

root@imx6qsabresd:/# modinfo bme280_driver.ko
filename: //bme280_driver.ko
license: Dual BSD/GPL
author: Takumi Ono
srcversion: D035AB9A772DB0BDD8E4DD1
alias: i2c:AE_BME280_Driver
depends:
name: bme280_driver
vermagic: 4.19.35-1.1.0+g0f9917c56d59 SMP preempt mod_unload modversions ARMv7 p2v8
parm: i2c_channel:int
parm: sampling_time:int
root@imx6qsabresd:/# uname -r
4.19.35-1.1.0+g0f9917c56d59
root@imx6qsabresd:/# insmod bme280_driver.ko i2c_channel=3 sampling_time=1
bme280_driver: Unknown symbol __aeabi_i2f (err -2)
bme280_driver: Unknown symbol __aeabi_fdiv (err -2)
bme280_driver: Unknown symbol __aeabi_f2d (err -2)
insmod: ERROR: could not insert module bme280_driver.ko: Unknown symbol in module


Dear karan gajjar

Thank you for your reply. I will try using softfp. How can I change the environment variable to softfp?
Could you tell me how to change it?

 Is it okay to add "CC :=" to the Makefile as a way to try?


obj-m         := bme280_driver.o
ARCH          := arm
KVER          := 4.19.35-r0
CROSS_COMPILE := $(TARGET_PREFIX)
KERNEL_DIR    := $(HOME)/yocto/imx-yocto-bsp/build-x11/tmp/work/imx6qsabresd-poky-linux-gnueabi/linux-imx/4.19.35-r0/build
CC            := arm-poky-linux-gnueabi-gcc -mfpu=neon -mfloat-abi=softfp -mcpu=cortex-a9 --sysroot=$(HOME)/yocto/tool/sysroots/cortexa9hf-neon-poky-linux-gnueabi

all:
    make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KERNEL_DIR) M=$(PWD) modules
clean:
    make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KERNEL_DIR) M=$(PWD) clean

>>Also can you let us know which kernel version are you using, so we can check that at our end?
Thank you. Please refer to the above answer.

Best regards,
takumi ono

0 Kudos

4,115 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hi takumi,

Try to use modprobe command to load drivers.

[Comment]

modprobe will try to find drivers in path /lib/modules/4.19.35-1.1.0+g0f9917c56d59/.

B.R,

Weidong

0 Kudos

4,115 Views
takumiono
Contributor I

Dear karan gajjar

Thank you for your reply and the link.

I'm using a compiler made with bitbake meta-toolchain.
> source environment-setup-cortexa9hf-neon-poky-linux-gnueabi
> echo $CC
> arm-poky-linux-gnueabi-gcc -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/home/xxxxxx/yocto/tool/sysroots/cortexa9hf-neon-poky-linux-gnueabi

In my case,  "arm-linux-gnueabi-" is same as"arm-poky-linux-gnueabi-gcc"?


I thought I had to change "-mfloat-abi=hard" to "-mfloat-abi=soft" or "-mfloat-abi=softfp".
Is this correct?

Best regards,
takumi ono

0 Kudos

4,115 Views
karangajjar
Senior Contributor II

Hi takumi ono,

Yes, try using softfp. Also can you let us know which kernel version are you using, so we can check that at our end?

Regards,

Karan Gajjar

0 Kudos

4,115 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hello Takumi,

According to the prompt of the insmod command, your driver compilation environment does not match the kernel version running on the board. It has nothing to do with warning.


In other words, the Linux kernel running on the board is not compiled at the same time as the kernel you used when compiling the driver.

Check it , please!

Have a nice day!

B.R,

Weidong

0 Kudos

4,115 Views
karangajjar
Senior Contributor II

Hi takumi ono ,

Yes this seems to be because of use of floating point.

Below link might be useful:

https://community.nxp.com/thread/302748 

Let us know in case of any concern.

Regards,

Karan Gajjar

0 Kudos