pc386 benchmark timer driver Re: Timers problem

Ilian Donev idonev at flairbase.com
Fri Jan 10 23:27:08 UTC 2003


Hi all,

After a little research and a good direction given me by Joel, it seems to
me that the *pentium* macro is never passed to the compiler.
Here are the compiler flags when building RTEMS ( gcc 3.2.1,
rtems-ss-20021118 ):

...
i386-rtems-gcc --pipe -B../../../../../../../lib/ -B../../../../../../../pc5
86/lib/
  -specs
bsp_specs -qrtems -DHAVE_CONFIG_H  -ansi -fasm  -O4 -g -O2 -mcpu=pentium
  -o o-optimize/timer.o -c
/home/library/rtems-src/rtems-ss-20021118/c/src/lib/libbsp/i386/pc386/timer/
timer.c
...

The -mcpu is correct, but there's no defines for pentium nor __pentium__. I
think that anybody who builds RTEMS for a pentium based BSP ( pc586/pc686 )
will not be able to use the benchmarking timer.

My solution to that, without modifying any source file, is to pass the
macros as argument to Make when building RTEMS:

	make XCFLAGS+="-Dpentium -D__pentium__" all install

This worked well for me.

Feedback will be appreciated...

Enjoy !

Ian









-----Original Message-----
From: Joel Sherrill [mailto:joel.sherrill at OARcorp.com]
Sent: 09-January-2003 11:50
To: Ilian Donev
Cc: RTEMS Users
Subject: Re: pc386 benchmark timer driver Re: Timers problem




Ilian Donev wrote:
>
> Joel,
>
> Thanks for the quick answer.
>
>   >Does the file c/src/lib/libbsp/i386/pc386/timer/timer.c have versions
of
> the
>   >function for both a pentium class CPU and a default 486 and below
> version?
>
> Yes, it has versions of the function for both Pentium and 386/486 CPUs. I
> fixed the
> problem by simply adding a "#define pentium" line in the corresponding
> bsp.h. It's not a elegant solution, but it worked
> fine for me since I'm testing only on pentium machines. I just can't
figure
> out why the pentium flag has not been set.

What compiler version and flags are being used?  I suspect it must need
to trigger on more CPU types or a different variation of pentium
like __pentium__.

> Regards,
>
> Ian
>
> -----Original Message-----
> From: Joel Sherrill [mailto:joel.sherrill at OARcorp.com]
> Sent: 08-January-2003 16:17
> To: Ilian Donev
> Cc: RTEMS Users
> Subject: pc386 benchmark timer driver Re: Timers problem
>
> I clarified the subject just to point out that this is a BSP driver
> specific problem -- it is not related to the Timer managers in
> the Classic, POSIX, or ITRON APIs.
>
> --joel
>
> > Hello all,
> >
> > I'm new to RTEMS world and was (finally) able to build my first RTEMS
> (4.5.0) with success on a PC running Mandrake Linux.
> > I installed the latest precompiled tools for Linux from the "cd-working"
> directory and configured RTEMS for an i386 target, with bsp pc586 for
> testing purposes on a PC.
> > All the demos compiled just fine. I picked the standard "Hello world"
app
> and booted from a floppy using GRUB. Everything was just perfect. I tried
> several other apps from the sample directory
> > ( tasks, semaphores, etc ) and was pleased with the results. So far, so
> good.
> > Then the problem: each time I try to run an app which uses the
> "Timer_Initialize " function I get the error "raw handler connection
> failed".
> > I recompiled RTEMS for bsp pc386, tried it again on several PCs - same
> error.
> >
> > What could be the problem ?
>
> This is a problem with this BSP's benchmark timer driver.
>
> Does the file c/src/lib/libbsp/i386/pc386/timer/timer.c have versions of
> the
> function for both a pentium class CPU and a default 486 and below
> version?
>
> I suspect that if both versina re there that gcc is not defining the
> expecting cpp flag to indicate the CPU model.  The code is looking
> for pentium to be defined when on a 586 or above class x86 so you will
> know that the "rdtsc" instruction should be used for benchmarking.
>
> > Thank you in advance !
> >
>
> --
> Joel Sherrill, Ph.D.             Director of Research & Development
> joel at OARcorp.com                 On-Line Applications Research
> Ask me about RTEMS: a free RTOS  Huntsville AL 35805
> Support Available                (256) 722-9985

--
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985





More information about the users mailing list