[Icc-avr] Stack problems

Bengt Ragnemalm benra at imt.liu.se
Fri Aug 15 04:02:56 PDT 2008


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




More information about the Icc-avr mailing list