Re: RTAI module: rtai functions undefined

Junhong Liu <[email protected]>
Newsgroups gmane.linux.real-time.rtai
Message-ID <CAJWYAW2tjtgKFsDq1bsuD3AqD=BXndzQjVwPFHWmKezRxnkhyw@mail.gmail.com>
Hello, Paolo,

Thank you  very much! This short program is a miniature from the showroom
/kern/latency. For simplicity and clarity, only a few codes are included
while the symptom is the same.

1. the short program is now called "latency.h":

// ------ rtProcess.c ----- define MODULE

#include <linux/kernel.h> /* Needed for KERN_INFO */
#include <linux/module.h>  /*Needed by all modules*/
#include <linux/moduleparam.h>
#include <linux/init.h> /* Needed for the macros */
#include <linux/stat.h>
#include <linux/proc_fs.h>
#include <linux/stringify.h>
#include <asm/io.h>
#include <linux/errno.h>   /*EINVAL, ENOMEN*/

#include <rtai.h> // RTAI configuration switches
#include <rtai_sched.h>
#include <rtai_sem.h>  // RTAI semaphores
#include <rtai_fifos.h>
#include <rtai_proc_fs.h>

MODULE_LICENSE("GPL");

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

static int __latency_init(void) // entry point
{
    // ---1---
    rt_set_oneshot_mode();
    start_rt_timer(1); // the execution starts
    // ---1---
    printk("Hello in INIT!\n");

    return 0;
}

static void __latency_exit(void)
{
     // ---2---
    stop_rt_timer(); rt_busy_sleep(10000000);
    // ---2---

    printk("Goodbye & EXIT!\n");
    return;
}

module_init(__latency_init);
module_exit(__latency_exit);

2. The "Makefile" is:
#Makefile

#RTAI_CFLAGS += $(shell rtai-config --lxrt-cflags)
# # -I. -I/usr/realtime/include -Wall -Wstrict-prototypes -pipe

#RTAI_LIBFLAGS += $(shell rtai-config --lxrt-ldflags )
# -L/usr/realtime/lib -llxrt -lpthread
rtai_srctree := /usr/src/rtai
EXTRA_CFLAGS += -I$(LINUX)/include -D__KERNEL__ -DMOUDLE -O2
EXTRA_CFLAGS += $(shell rtai-config --module-cflags) -msse \
        -I/usr/realtime/include -D__IN_RTAI__ \
        -I$(rtai_srctree)/base/include \
        -mpreferred-stack-boundary=4

KBUILD_EXTRA_SYMBOLS := $(shell rtai-config
--prefix)/modules/Module.sysmvers

obj-m += latency.o

CURRENT = $(shell uname -r)
    KDIR ?= /lib/modules/$(CURRENT)/build
    PWD := $(shell pwd)

modules:
    $(MAKE) -C $(KDIR) M=$(PWD) modules

modules_install:
    $(MAKE) -C $(KDIR) M=$(PWD) modules_install

clean:
    $(MAKE) -C  $(KDIR) M=$(PWD) clean

3. By "make" as:
 root@huapeng-GA-990XA-UD3:/home/huapeng/Yritys/RT/latency# make, the
following message comes:
root@huapeng-GA-990XA-UD3:/home/huapeng/Yritys/RT/latency# make
make -C /lib/modules/3.10.32-rtai/build M=/home/huapeng/Yritys/RT/latency
modules
make[1]: Entering directory `/usr/src/linux-headers-3.10.32-rtai'
  CC [M]  /home/huapeng/Yritys/RT/latency/latency.o
<command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by
default]
<built-in>:0:0: note: this is the location of the previous definition
  Building modules, stage 2.
  MODPOST 1 modules
WARNING: "rt_busy_sleep" [/home/huapeng/Yritys/RT/latency/latency.ko]
undefined!
WARNING: "stop_rt_timer" [/home/huapeng/Yritys/RT/latency/latency.ko]
undefined!
WARNING: "start_rt_timer" [/home/huapeng/Yritys/RT/latency/latency.ko]
undefined!
WARNING: "rt_set_oneshot_mode" [/home/huapeng/Yritys/RT/latency/latency.ko]
undefined!
  LD [M]  /home/huapeng/Yritys/RT/latency/latency.ko
make[1]: Leaving directory `/usr/src/linux-headers-3.10.32-rtai'
root@huapeng-GA-990XA-UD3:/home/huapeng/Yritys/RT/latency# make
make -C /lib/modules/3.10.32-rtai/build M=/home/huapeng/Yritys/RT/latency
modules
make[1]: Entering directory `/usr/src/linux-headers-3.10.32-rtai'
  CC [M]  /home/huapeng/Yritys/RT/latency/latency.o
<command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by
default]
<built-in>:0:0: note: this is the location of the previous definition
  Building modules, stage 2.
  MODPOST 1 modules
WARNING: "rt_busy_sleep" [/home/huapeng/Yritys/RT/latency/latency.ko]
undefined!
WARNING: "stop_rt_timer" [/home/huapeng/Yritys/RT/latency/latency.ko]
undefined!
WARNING: "start_rt_timer" [/home/huapeng/Yritys/RT/latency/latency.ko]
undefined!
WARNING: "rt_set_oneshot_mode" [/home/huapeng/Yritys/RT/latency/latency.ko]
undefined!
  CC      /home/huapeng/Yritys/RT/latency/latency.mod.o
<command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by
default]
<built-in>:0:0: note: this is the location of the previous definition
  LD [M]  /home/huapeng/Yritys/RT/latency/latency.ko
make[1]: Leaving directory `/usr/src/linux-headers-3.10.32-rtai'
root@huapeng-GA-990XA-UD3:/home/huapeng/Yritys/RT/latency#

4. Do "insmod" in two ways and receive the following info:
root@huapeng-GA-990XA-UD3:/home/huapeng/Yritys/RT/latency# insmod latency.ko
insmod: ERROR: could not insert module latency.ko: Unknown symbol in module
root@huapeng-GA-990XA-UD3:/home/huapeng/Yritys/RT/latency# insmod
./latency.ko
insmod: ERROR: could not insert module ./latency.ko: Unknown symbol in
module

By "dmesg|tail", obtain:
root@huapeng-GA-990XA-UD3:/home/huapeng/Yritys/RT/latency# dmesg|tail
[16666.583390] I-pipe: head domain RTAI unregistered.
[16666.634074] RTAI[hal]: unmounted.
[20291.607043] latency: Unknown symbol rt_busy_sleep (err 0)
[20291.607082] latency: Unknown symbol start_rt_timer (err 0)
[20291.607112] latency: Unknown symbol stop_rt_timer (err 0)
[20291.607142] latency: Unknown symbol rt_set_oneshot_mode (err 0)
[20305.727466] latency: Unknown symbol rt_busy_sleep (err 0)
[20305.727504] latency: Unknown symbol start_rt_timer (err 0)
[20305.727534] latency: Unknown symbol stop_rt_timer (err 0)
[20305.727564] latency: Unknown symbol rt_set_oneshot_mode (err 0)
root@huapeng-GA-990XA-UD3:/home/huapeng/Yritys/RT/latency#

By only "dmesg", obtain huge amount of information, selected ALL and saved
into a file "latencyKOdmesg" attached (too long to be in the email body)

Your ideas will be  greatly appreciated!

Junhong

_______________________________________________
Rtai mailing list
[email protected]
https://mail.rtai.org/cgi-bin/mailman/listinfo/rtai
latencyKOdmesg (application/octet-stream, 27.2 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.