Identité Message:<[EMAIL PROTECTED]>
Identité Message:<[EMAIL PROTECTED]>
X-Sender: [EMAIL PROTECTED](Non vérifié)
X-Mailer: QUALCOMM Windows Eudora Pro Version 4.0.1 
Date: Tue, 11 Apr 2000 18:58:34 -0400
To: [EMAIL PROTECTED]
From: Stephane Bouchard <[EMAIL PROTECTED]>
Subject: floating point
Cc: [EMAIL PROTECTED],[EMAIL PROTECTED]
Mime-Version: 1.0
Content-Type: multipart/mixed;
        boundary="=====================_218944==_"

--=====================_218944==_
Content-Type: text/plain; charset="us-ascii"

Like Dave and Chuck, we have some problems with the floating point.

We do very simple test program like three operations in floating point in a
rt-thread and the computer jam or reboot or freeze.

I have add a very very simple and small test program in attach. Carefully,
this program freeze the computer. If we change the operation for int, all
run well. If we change the order of operation, the program can run... but
the same operation in an other order crash the computer.

My code is very simple, we can have make a error but, I mean this is more fp.

Sylvain and Stephane





--=====================_218944==_
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: attachment; filename="application.c"


#include <stdio.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <rtl_fifo.h>
#include <rtl_time.h>


int main() {

int fid;
int buf;

fid=open("/dev/rtf6", O_RDONLY);
 
while (read(fid,&buf,4)!=0)
{
        printf("data_fifo = %d\n", buf);
}

return 0;
};

--=====================_218944==_
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: attachment; filename="square.c"

#include <rtl.h>
#include <rtl_time.h>
#include <rtl_fifo.h>
#include <rtl_sched.h>

pthread_t thread;

void code_temps_reel(void *p) {

        double variable_test=27.33;
        int var2;

        while(1) {
                pthread_wait_np();

                var2=(int)variable_test;
                variable_test=(int)variable_test*variable_test;
                var2++;
                rtf_put(6,&var2,4);
        };

};

int init_module(void) {

        pthread_attr_t attr;
        struct sched_param sched_param;

        rtf_destroy((int)6);
        rtf_create(6,4000);

        pthread_attr_init(&attr);
        sched_param.sched_priority=1;
        pthread_attr_setschedparam(&attr, &sched_param);
        pthread_create(&thread, &attr, (void *)code_temps_reel, (void *) 1);
        pthread_make_periodic_np(thread, gethrtime(), 100000000);
        pthread_setfp_np(thread,1);

return 0;
}

void cleanup_module(void) {

        rtf_destroy((int)6);
        pthread_delete_np(thread);
};



--=====================_218944==_
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: attachment; filename="rtl.mk"

#Automatically generated by rtl Makefile
RTL_DIR = /usr/src/rtlinux-2.0/rtl
RTLINUX_DIR = /usr/src/rtlinux-2.0/linux
INCLUDE= -I/usr/src/rtlinux-2.0/linux/include -I/usr/src/rtlinux-2.0/rtl/include 
-I/usr/src/rtlinux-2.0/rtl
CFLAGS = -I/usr/src/rtlinux-2.0/linux/include -I/usr/src/rtlinux-2.0/rtl/include 
-I/usr/src/rtlinux-2.0/rtl -I/usr/src/rtlinux-2.0/rtl/include/posix -Wall 
-Wstrict-prototypes -O2 -fomit-frame-pointer -D__SMP__ -D__RTL__ -D__KERNEL__ -DMODULE 
-pipe -fno-strength-reduce -m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2 
-DCPU=586
ARCH = i386
CC = gcc
RTL_MODULES=/lib/modules/2.2.13-rtl2.0/misc

--=====================_218944==_
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: attachment; filename="makefile"

all: square.o application

include rtl.mk

square.o: square.c
        $(CC) ${INCLUDE} ${CFLAGS} -c square.c -o square.o

application: application.c
        $(CC) ${INCLUDE} -O2 -Wall application.c -o application

test: all
        (cd /usr/src/rtlinux-2.0/rtl; ./rmrtl)
        (cd /usr/src/rtlinux-2.0/rtl; ./insrtl)
        @insmod square.o
        ./application
  
kill:
        @rmmod square
        (cd /usr/src/rtlinux-2.0/rtl; ./rmrtl)

clean:
        rm -f *.o

--=====================_218944==_
Content-Type: text/plain; charset="us-ascii"


--=====================_218944==_--

-- [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/rtlinux/

Reply via email to