-----Original Message-----
From: Estabridis, Janet P
To: '[EMAIL PROTECTED]'
Sent: 9/27/01 2:58 PM
Subject: Floating Point in Real-Time Kernel

Hi,

I am using kernel 2.2.14 RTLV2.3.  I really can't change versions until
I get this code up and running.

I am constantly haunted by floating point problems.  So, I'd like to see
if anyone can educate me.

Here is my setup (which may not matter, but I'll lay it out anyway):

I have 1 ISR that gets triggered at 100Hz (it takes about 100usec for me
to do what I need to do) and I have one periodic thread that gets
executed every 30 Hz.  They are asyncronous.

1.  I have enabled floating point in the thread using
"pthread_setfp_np( pthread_self(), (int)1)" which I do set within the
thread.  And my thread calls some functions that do some floating point
operations.

2.  I also use the "www.aero.polimi.it/projects/rtai/" floating point
save_cr0_and_clts, save_fpenv (my code), restore_cr0, restore_fpenv
        OH, I JUST NOTICED THAT I ACCIDENTLY have the restores swapped
around COULD THIS       CAUSE THEM NOT TO WORK?
  Another question, do I only do the floating point save's once or am I
supposed to nest them or do them around small pieces of code but not
nest them?

3.  But, the real weird thing about this code now is that I added some
new code to do some coordinate translations (the final piece of code)
and the statement that crashes the code is assigning a double value that
I have just finished calculating locally into a double variable in the
old style shared memory so that a user space program can print it out
since the kernel does not support the printing of floats in kernel
space.

So, can anyone please help me learn to write "robust" floating point
code ?

Thanks in advance,

Janet Estabridis        
Electrical Engineer
NAWC
Code 47E400D
China Lake, CA 93555

-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/

Reply via email to