DSPRelated.com
Forums

Stack problem

Started by rics_in April 19, 2004
Hi,
I am an amateur using Code composer studio for TMS320C5472 voip
processor. I am facing a unique problem. I have a main program which
has an infinite "for loop", when it gets an interrupt it should jump
to the interrupt service routine.
When the processor gets interrupted the PC is pushed into the stack
actually the stack must point to the next higher location but it
points below the location where my return address is stored. Due to
this my return from ISR is corrupted and hence unable to retrieve
back to my main program.

can anyone help on this

From,
sajan



Is the ISR a hand written assembly function or generated by the C
compiler?

In either case, the ISR must make sure the stack pointer must "be
aligned to a 32bit boundary" See Section 6.4 SPRU281C C55x C/C++
user's guide. An ISR doesn't can't know from what thread it
interrupted and the stack alignment at that time so it needs to do a
little stack manipulation first. I've seen the C compiler do this
for functions designated with the "interupt" keyword. Create a real
simple interupt functions in C and look at the assemnbly generated to
see how it guarantees proper stack alignment

-Shawn

--- In , "rics_in" <rics_in@y...> wrote:
> Hi,
> I am an amateur using Code composer studio for TMS320C5472 voip
> processor. I am facing a unique problem. I have a main program
which
> has an infinite "for loop", when it gets an interrupt it should
jump
> to the interrupt service routine.
> When the processor gets interrupted the PC is pushed into the
stack
> actually the stack must point to the next higher location but it
> points below the location where my return address is stored. Due to
> this my return from ISR is corrupted and hence unable to retrieve
> back to my main program.
>
> can anyone help on this
>
> From,
> sajan