Ticker problem on ppc405 - FIXED

Smith, Gene gene.smith at siemens.com
Wed Oct 20 13:26:50 UTC 2004


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

> 
> AFAIS, only the helas405 and the gen405 BSPs are affected.
> 
> 
>>>Gene.. the installed bspopts.h has it undef'ed?
>>>Where does the cpu.c get its define?
>>
>>cpu.c is seeing it undefined (or zero?) as I would have expected. 
>>irq_stub.S see it defined (non-zero?). (FWIW, the selectors are "#if x" 
>>not "#ifdef x".)
> 
> 
>>As a non-kluge solution I just went ahead and defined PPC_USE_SPGR as 1 in
>>cpukit/score/cpu/powerpc/rtems/score/ppc.h
> 
> 
> This is incorrect. PPC_USE_SPRG is a per-BSP define that is not supposed
> to be present nor accessed in cpukit. It is supposed to be defined in
> your BSP's bspopts.h and at no other place.

Ok.

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

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

Why does <BSP>/include/bspopts.h.in contain
#undef PPC_USE_SPRG
?

> autoheader (cd <rtems-4.6.2/c/src/lib/libbsp/powerpc/<BSP>; autoreconf)

Ran this but saw no change (but didn't really change any files).

> 
> Ralf
> 
> 



More information about the users mailing list