Ticker problem on ppc405 - FIXED

Ralf Corsepius ralf_corsepius at rtems.org
Wed Oct 20 14:49:05 UTC 2004


On Wed, 2004-10-20 at 15:26, Smith, Gene wrote:
> Ralf Corsepius wrote, On 10/19/2004 11:02 PM:
> 
> > On Tue, 2004-10-19 at 19:20, Smith, Gene wrote:
> > 
> >>Joel Sherrill <joel at OARcorp.com> wrote, On 10/19/2004 7:08 AM:
> >>
> >>
> >>>Smith, Gene wrote:
> >>>
> >>>
> >>>>Figure out what the problem is but not why or how to correctly fix it. 
> >>>>The problem was due statements like this for selecting code:
> >>>>
> >>>>#if (PPC_USE_SPRG)
> >>>>   do this way
> >>>>#else
> >>>>   do that way
> >>>>#end
> >>>>
> >>>>In file old_exception_processing/cpu.c "do that way" is selected, while
> >>>>in old_exception_processing/irq_stub.S "do this way" is selected. The 
> >>>>conflict resulted in some bad memory accesses.  I don't see anywhere 
> >>>>that PPC_USE_SPRG is explicitly defined in the code except under 
> >>>>build-rtems there is a automatically generated file bspopts.h that contains
> >>>>#define PPC_USE_SPRG 1
> >>>>But the file that (I think) controls this, bspopts.h.in, contains
> >>>>#undef PPC_USE_SPRG
> >>>>
> >>>>The kluge fix was to just add
> >>>>#define PPC_USE_SPRG 0
> >>>>in irq_stub.S so both files generate "do that way" code.
> >>>>
> >>>>Anyhow, ticker now runs.
> >>>
> >>>
> >>>Ralf.. how is this happening?  This is one of those
> >>>macros from the BSP's configure.ac.  bspopts.h should
> >>>have it as a 1 if I am reading the configure code correctly.
> > 
> > Seems like a bug having persisted for a very long time to me.
> > 
> > PPC_USE_SPRG is a per-bsp option being used by
> > old_exception_processing/cpu.c. All bsp options are supposed to be
> > propagated through bspopts.h, but old_exception_processing/cpu.c does
> > not include bspopts.h nor bsp.h.
> > 
> > So, one fix would be to let cpu.c include bsp.h.
> 
> Just add
> #define <bsp.h>
> ?
Yes, cf. PR 696
http://www.rtems.org/cgi-bin/gnatsweb.pl?debug=&database=RTEMS&cmd=view+audit-trail&cmd=view&pr=696
 
> > To let bspopts.h contain it, you have to add the corresponding
> > configure-script magic to your BSP's configure.ac
> > (cf. c/src/lib/libbsp/powerpc/helas403/configure.ac) and then to run
> 
> configure.ac here already contains line:
> RTEMS_BSPOPTS_SET([PPC_USE_SPRG],[*],[1])
> Is this the "magic" for defining it to 1?
Not quite, it is the magic to let it default to 1.

You can override it when invoking the configure script via an
environment variable.

> Is the above magic what causes bspopts.h to contain:
> #define PPC_USE_SPRG 1
> ?
Yes.

> Why does <BSP>/include/bspopts.h.in contain
> #undef PPC_USE_SPRG
> ?
This file is an "autoheader", i.e. it is automatically generated by
autoheader reading configure.ac as input file.

bspopts.h.in later is used as input template for generating bspopts.h
when running the configure script.

Ralf





More information about the users mailing list