Newbie how to FP Math, RTAI-3.1, Kernel 2.6.8.1?

Lester Godwin godwin at pushcorp.com
Tue Oct 12 18:21:45 CEST 2004


I am new to RTAI but up to now everything has gone pretty smoothly.  I 
have successfully installed RTAI-3.1 and run the test suites and have 
written and run a very simple RT kernel module.  However, my application 
will need to use a little floating point math in the kernel module.  So 
to get my feet wet I wrote the following little program derived from 
some docs I found:

<code>
#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/version.h>
#include <linux/init.h>
#include <rtai.h>
#include <rtai_math.h>
#include <rtai_sched.h>
#include <rtai_fifos.h>

MODULE_DESCRIPTION("Realtime SIN module");
MODULE_LICENSE("GPL");

#define TICK_PERIOD 1000000
#define TASK_PRIORITY 1
#define STACK_SIZE 10000
#define FIFO 0

static RT_TASK rt_task;

static void rt_fun(int t)
{
   int counter = 0;
   double sin_value;

   while (1)
   {
     sin_value = sin(2*M_PI*1*rt_get_cpu_time_ns()/1E9);
      rtf_put(FIFO, &counter, sizeof(counter));
      rtf_put(FIFO, &sin_value, sizeof(sin_value));
      counter++;
      rt_task_wait_period();
    }
}

static int __init sinmod_init(void)
{
-- 
Lester Godwin
Tel   1.972.840.0208 x412
Fax   1.972.840.1046
Email lgodwin at pushcorp.com
Web   http://www.pushcorp.com

   RTIME tick_period;
   rt_set_periodic_mode();

   rtf_create(FIFO, 8000);
   rt_task_init(&rt_task,rt_fun, 1, STACK_SIZE, TASK_PRIORITY, 1, 0);

   tick_period = start_rt_timer(nano2count(TICK_PERIOD));
   rt_task_make_periodic(&rt_task, rt_get_time() + tick_period,tick_period);

     printk(KERN_INFO "sinmod loaded into %s.\n", UTS_RELEASE);
     return 0;
}

static void __exit sinmod_exit(void)
{
     rt_task_delete(&rt_task);
     rtf_destroy(FIFO);

     printk (KERN_INFO "sinmod removed.\n");
}

module_init(sinmod_init)
module_exit(sinmod_exit)

</code>

However, when I insmod the module I get an "Unknown symbol in module" 
error and the following from dmesg:

RTAI[math]: loaded.
sinmod: Unknown symbol __floatdidf
sinmod: Unknown symbol __nexf2
sinmod: Unknown symbol __negxf2
sinmod: Unknown symbol __gtdf2
sinmod: Unknown symbol __gexf2
sinmod: Unknown symbol __extenddfxf2
sinmod: Unknown symbol __extendsfdf2
sinmod: Unknown symbol __truncxfdf2
sinmod: Unknown symbol __negdf2
sinmod: Unknown symbol __divdf3
sinmod: Unknown symbol __negsf2
sinmod: Unknown symbol __muldf3
sinmod: Unknown symbol __truncxfsf2
sinmod: Unknown symbol __truncdfsf2
sinmod: Unknown symbol __nedf2
sinmod: Unknown symbol __gesf2
sinmod: Unknown symbol __gtxf2
sinmod: Unknown symbol __gedf2

Is there something else I need to link in?  If so how do I accomplish 
that with the 2.6 module make file?  Any help would be appreciated!

-- 
Lester Godwin




More information about the Rtai mailing list