SV: SV: [Icc-avr] Stack problems

Bengt Ragnemalm benra at imt.liu.se
Mon Aug 18 00:30:45 PDT 2008


This was (maybe by mistake) posted only to me but I post the answer to the
group.

Yes, you are right. I have small checking function that I do call. Thank you
for reminding me, I have avoided this elsewhere but have forgotten this
here.

/Bengt

> -----Ursprungligt meddelande-----
> Från: Johannes Assenbaum [mailto:jassenbaum at htp-tel.de]
> Skickat: den 15 augusti 2008 23:25
> Till: benra at imt.liu.se
> Ämne: Re: SV: [Icc-avr] Stack problems
> 
> Register saving looks like you are calling c function(s) from within an
> interrupt handler. This may be suboptimal on small controller targets like
> AVRs...
> 
> Best regards,
> Johannes
> 
> 
> > Sorry, this was of course the same reason that before, the big local
> array.
> > After changing into one global this problem disappeared. But maybe
> someone
> > could describe this a little so I understand what happened? The stack
> > checking bytes was not overwritten.
> 
> > /Bengt
> 
> >> -----Ursprungligt meddelande-----
> >> Från: icc-avr-bounces at imagecraft.com [mailto:icc-avr-
> >> bounces at imagecraft.com] För Bengt Ragnemalm
> >> Skickat: den 15 augusti 2008 13:03
> >> Till: benra at imt.liu.se; 'Discussion list for ICCAVR and ICCtiny Users.
> You
> >> do NOT needtosubscribeto icc-announce if you are a member of this.'
> >> Ämne: [Icc-avr] Stack problems
> >>
> >> I am beginning to get a hold on my problems now. Of course it was
> several
> >> problems as it usual are if you don't find the error quickly. First I
> have
> >> increased the hardware stack to 20 as it was overflowing. But know I
> have
> >> noticed that at entering a timer overflow interrupt, the interrupt
> routine
> >> is writing in my registers.
> >>
> >> Here is the first line, copied from Studio so you can see C and
> assembler:
> >> @0000080E: SampleRateTimerOverflowInt
> >> 329:      void SampleRateTimerOverflowInt(void)
> >> +0000080E:   D48F        RCALL   PC+0x0490        Relative call
> subroutine
> >>
> >> The RCALL goes here:
> >> +00000C9E:   920A        ST      -Y,R0            Store indirect and
> >> predecrement
> >> +00000C9F:   921A        ST      -Y,R1            Store indirect and
> >> predecrement
> >> +00000CA0:   922A        ST      -Y,R2            Store indirect and
> >> predecrement
> >> +00000CA1:   923A        ST      -Y,R3            Store indirect and
> >> predecrement
> >> +00000CA2:   924A        ST      -Y,R4            Store indirect and
> >> predecrement
> >> +00000CA3:   925A        ST      -Y,R5            Store indirect and
> >> predecrement
> >> +00000CA4:   926A        ST      -Y,R6            Store indirect and
> >> predecrement
> >> +00000CA5:   927A        ST      -Y,R7            Store indirect and
> >> predecrement
> >> +00000CA6:   928A        ST      -Y,R8            Store indirect and
> >> predecrement
> >> +00000CA7:   929A        ST      -Y,R9            Store indirect and
> >> predecrement
> >> +00000CA8:   930A        ST      -Y,R16           Store indirect and
> >> predecrement
> >> +00000CA9:   931A        ST      -Y,R17           Store indirect and
> >> predecrement
> >> +00000CAA:   932A        ST      -Y,R18           Store indirect and
> >> predecrement
> >> +00000CAB:   933A        ST      -Y,R19           Store indirect and
> >> predecrement
> >> +00000CAC:   938A        ST      -Y,R24           Store indirect and
> >> predecrement
> >> +00000CAD:   939A        ST      -Y,R25           Store indirect and
> >> predecrement
> >> +00000CAE:   93AA        ST      -Y,R26           Store indirect and
> >> predecrement
> >> +00000CAF:   93BA        ST      -Y,R27           Store indirect and
> >> predecrement
> >> +00000CB0:   93EA        ST      -Y,R30           Store indirect and
> >> predecrement
> >> +00000CB1:   93FA        ST      -Y,R31           Store indirect and
> >> predecrement
> >> +00000CB2:   B60F        IN      R0,0x3F          In from I/O location
> >> +00000CB3:   920A        ST      -Y,R0            Store indirect and
> >> predecrement
> >> +00000CB4:   9508        RET                      Subroutine return
> >>
> >> The subroutine is obviously saving all registers. The question is
> there? Y
> >> is 0xBE, counting down for each save. And yes, 0xBE are right into my
> >> registers.
> >>
> >> What should I look for to solve this?
> >>
> >> /Bengt
> >>
> >>
> >> _______________________________________________
> >> Icc-avr mailing list
> >> Icc-avr at imagecraft.com
> >> http://dragonsgate.net/mailman/listinfo/icc-avr
> 
> 
> > _______________________________________________
> > Icc-avr mailing list
> > Icc-avr at imagecraft.com
> > http://dragonsgate.net/mailman/listinfo/icc-avr





More information about the Icc-avr mailing list