Okay, it's my turn to dine on crow.

Once I got back to my saved mailing list archive and re-read the
documentation, I discovered that I was trying to compile the current version
of rtlinux code with (the equivalent of) a makefile designed for v1-code.
There are apparently a bunch of compiler switches and command-line #defines
that are setup in rtl.mk.mk that are absolutely necessary for the current
.h-files that weren't needed in v1.  After including that file into my
makefile AND using the CC defined in it instead of my own version of CC, I
found that everything compiled with no problem at all.

Which brings me to two points::
    1. My original, plaintive cry for help went out over two weeks ago.  How
come no-one answered it until now?
But much more importantly
    2. There are some things about what rtl.mk does that see to me to be
less than "ideal":
        A. It seems to me that turning off some warnings, e.g.
            -Wstrict-prototypes         -fno-strict-aliasing
        to avoid a flood of diagnostics isn't the right way to get a clean
compile because it mignt suppress diagnostics about my own code that I might
have needed to see

      B.  Implementing #defines fromt the compiler command-line
        -D__KERNEL__  -D__SMP__
        -DCPU=586        -D__RTL__
        -DMODULE         -D_LOOSE_KERNEL_NAMES
 most of which  (I believe) only affect the rtl-header files and should have
been in rtl.h rather than cluttering up the command-line.  Further, some of
these ( like __SMP__) might have no applicability to my system and at least
one ( CPU=586) could be wrong for some implementations.

    All of this makes we wonder exactly what woes we're trying to cover up
with these things.

        Norm


----- Original Message -----
From: Michael Barabanov <[EMAIL PROTECTED]>
To: Norm Dresner <[EMAIL PROTECTED]>
Cc: rtlinux, <[EMAIL PROTECTED]>
Sent: Sunday, August 19, 2001 7:18 AM
Subject: Re: [rtl] Examples and such


> So examples/v1api/frank doesn't compile?
> Did you enable CONFIG_RTL_USE_V1_API and recompile RTL?
>
> Norm Dresner ([EMAIL PROTECTED]) wrote:
> > Okay, I confesss, I've seen these questions a hundred times.  But I'm
not at
> > work and my main e-mail computer at home is down and I don't have the
> > archive on the backup e-mail server.  So I appologize for asking it yet
once
> > again.
> >
> > I was first trying to get an old v1-api program to compile and had no
luck,
> > just a flood of diagnostics about things being multiply-defined and/or
> > unknown.
> >
> > So I took a step back and decided to try to emulate one of the examples.
> > After that didn't improve the situation, I tried to compile just one of
the
> > examples.  Below is the output and source from frank_module.  The errors
I
> > get there are similar to (some of) what I see in my own program so I
feel
> > that if I can get past frank, I'll be a long way toward getting my
program
> > compiled too.
> >
> > All help is appreciated.  BTW, the system is RH 6.2 w/2.2.18 and RTL 3.0
> >
> >
> >  Norm Dresner
> >  Fellow Systems Engineer & ARE/SGI Laboratory Administrator
> >  Radar Systems Engineering Department
> >  MS 520/1154
> >
> > Voice: (410) 993 - 2096 Mornings in Flight Test; all-day voice-mail
> >  (410) 765 - 9235/82 Occasionally in the SGI Lab; all-day voice-mail
> >  (410) 969 - 8068 Afternoons at home; answering machine
> > FAX: (410) 993 - 8084 On-site in Flight Test
> >  (410) 969 - 8068 Afternoons at home; call first to arrange
> > E-Mail: Mornings: [EMAIL PROTECTED]
> >  Afternoons: [EMAIL PROTECTED]
> >
> > ############ here are the errors #########################
> >
cc -I/usr/src/rtlinux/linux/include -I/usr/src/rtlinux-3.0/include -I/usr/sr
> >
c/rtlinux-3.0/include/compat  -D__KERNEL__ -Wall -Wstrict-prototypes -fno-st
> >
rict-aliasing -D__SMP__ -pipe -fno-strength-reduce -m486 -malign-loops=2 -ma
> >
lign-jumps=2 -malign-functions=2 -DCPU=586 -g -D__RTL__ -DMODULE -D_LOOSE_KE
> >
RNEL_NAMES -O2 -I/usr/src/rtlinux/linux/include -I/usr/src/rtlinux-3.0/inclu
> >
de -I/usr/src/rtlinux-3.0/include/compat -I/usr/src/rtlinux-3.0/include/posi
> > x -c frank_module.c -o frank_module.o
> > In file included from frank_module.c:5:
> > /usr/src/rtlinux-3.0/include/rtl_sched.h:89: `RTL_PTHREAD_KEYS_MAX'
> > undeclared here (not in a function)
> > /usr/src/rtlinux-3.0/include/rtl_sched.h: In function
`pthread_getspecific':
> > /usr/src/rtlinux-3.0/include/rtl_sched.h:216: warning: control reaches
end
> > of non-void function
> > /usr/src/rtlinux-3.0/include/rtl_compat.h: At top level:
> > In file included from /usr/src/rtlinux-3.0/include/rtl_sched.h:380,
> >                  from frank_module.c:5:
> > /usr/src/rtlinux-3.0/include/rtl_compat.h:41: parse error before `RTIME'
> > /usr/src/rtlinux-3.0/include/rtl_compat.h:42: warning: function
declaration
> > isn't a prototype
> > /usr/src/rtlinux-3.0/include/rtl_compat.h: In function
> > `rt_task_make_periodic':
> > /usr/src/rtlinux-3.0/include/rtl_compat.h:44: `start_time' undeclared
(first
> > use in this function)
> > /usr/src/rtlinux-3.0/include/rtl_compat.h:44: (Each undeclared
identifier is
> > reported only once
> > /usr/src/rtlinux-3.0/include/rtl_compat.h:44: for each function it
appears
> > in.)
> > /usr/src/rtlinux-3.0/include/rtl_compat.h:44: `period' undeclared (first
use
> > in this function)
> > /usr/src/rtlinux-3.0/include/rtl_compat.h:44: warning: passing arg 1 of
> > `pthread_make_periodic_np' from incompatible pointer type
> > make: *** [frank_module.o] Error 1
> >
> > ################### here's the source code #################
> > #include <linux/errno.h>
> > #include <rtl.h>
> > #include <time.h>
> >
> > #include <rtl_sched.h>
> > #include <rtl_fifo.h>
> > #include "control.h"
> >
> > pthread_t tasks[2];
> >
> > static char *data[] = {"Frank ", "Zappa "};
> >
> > #define TASK_CONTROL_FIFO_OFFSET 4
> >
> > void *thread_code(void *t)
> > {
> >  int fifo = (int) t;
> >  int taskno = fifo - 1;
> >  struct my_msg_struct msg;
> >  while (1) {
> >   int ret;
> >   int err;
> >   ret = pthread_wait_np();
> >   if ((err = rtf_get (taskno + TASK_CONTROL_FIFO_OFFSET, &msg,
sizeof(msg)))
> > == sizeof(msg)) {
> >    rtl_printf("Task %d: executing the \"%d\" command to task %d; period
> > %d\n", fifo - 1,  msg.command, msg.task, msg.period);
> >    switch (msg.command) {
> >     case START_TASK:
> >      pthread_make_periodic_np(pthread_self(), gethrtime(), msg.period *
> > 1000);
> >
> >      break;
> >     case STOP_TASK:
> >      pthread_suspend_np(pthread_self());
> >      break;
> >     default:
> >      rtl_printf("RTLinux task: bad command\n");
> >      return 0;
> >    }
> >   }
> >   rtf_put(fifo, data[fifo - 1], 6);
> >  }
> >  return 0;
> > }
> >
> > int my_handler(unsigned int fifo)
> > {
> >  struct my_msg_struct msg;
> >  int err;
> >
> >  while ((err = rtf_get(COMMAND_FIFO, &msg, sizeof(msg))) == sizeof(msg))
{
> >   rtf_put (msg.task + TASK_CONTROL_FIFO_OFFSET, &msg, sizeof(msg));
> >   rtl_printf("FIFO handler: sending the \"%d\" command to task %d;
period
> > %d\n", msg.command,
> >     msg.task, msg.period);
> >   pthread_wakeup_np (tasks [msg.task]);
> >  }
> >  if (err != 0) {
> >   return -EINVAL;
> >  }
> >  return 0;
> > }
> >
> >
> >
> >
> > /* #define DEBUG  */
> > int init_module(void)
> > {
> >  int c[5];
> >  pthread_attr_t attr;
> >  struct sched_param sched_param;
> >  int ret;
> >
> >  rtf_destroy(1);
> >  rtf_destroy(2);
> >  rtf_destroy(3);
> >  rtf_destroy(4);
> >  rtf_destroy(5);
> >   c[0] = rtf_create(1, 4000);
> >  c[1] = rtf_create(2, 4000);
> >  c[2] = rtf_create(3, 200); /* input control channel */
> >  c[3] = rtf_create(4, 100); /* input control channel */
> >  c[4] = rtf_create(5, 100); /* input control channel */
> >
> >  pthread_attr_init (&attr);
> >  sched_param.sched_priority = 4;
> >  pthread_attr_setschedparam (&attr, &sched_param);
> >  ret = pthread_create (&tasks[0],  &attr, thread_code, (void *)1);
> >
> >  pthread_attr_init (&attr);
> >  sched_param.sched_priority = 5;
> >  pthread_attr_setschedparam (&attr, &sched_param);
> >  ret = pthread_create (&tasks[1],  &attr, thread_code, (void *)2);
> >
> >  rtf_create_handler(3, &my_handler);
> >  return 0;
> > }
> >
> >
> > void cleanup_module(void)
> > {
> > #ifdef DEBUG
> >  printk("%d\n", rtf_destroy(1));
> >  printk("%d\n", rtf_destroy(2));
> >  printk("%d\n", rtf_destroy(3));
> >  printk("%d\n", rtf_destroy(4));
> >  printk("%d\n", rtf_destroy(5));
> > #else
> >  rtf_destroy(1);
> >  rtf_destroy(2);
> >  rtf_destroy(3);
> >  rtf_destroy(4);
> >  rtf_destroy(5);
> > #endif
> >  pthread_cancel (tasks[0]);
> >  pthread_join (tasks[0], NULL);
> >  pthread_cancel (tasks[1]);
> >  pthread_join (tasks[1], NULL);
> > }
> >
> >
> > ----- End of forwarded message from [EMAIL PROTECTED] -----
> > -- [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/

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