Is there a way to log/Print the floating values inside the kernel.Does it depends on the FPU on which the kernel is running?
While compiling printk(KERN_DEBUG "error = %f " ,floatvalue)
,I am getting the error :
undefined reference to __aeabi_f2d
Using any kind of floating point arithmetic inside the Linux kernel is a bug.
If the processor you are running on does not have an FPU, then there is nothing to perform the calculation you are trying to do (software FPUs are driven from the kernel and does not work inside of it).
If the processor you are running on does have an FPU, the situation is even worse - since the kernel switches contexts between tasks it needs to save the context (set of registers) of each task. The time it takes to conetxt switch depends on the how much context needs to be saved. As an optimization, the kernel only saves and restores the context of the FPU when it schedules in and out a task that used the PFU but not when a system call or interrupt has triggered the context switch into the kernel and the same task stays the current task.
This means that if you write code that uses the FPU inside the kernel, you have potentially corrupted the FPU state of the currently running user space task.