[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] avr-gcc adding 'cli's in function prologues...
From: |
Denis Chertykov |
Subject: |
Re: [avr-gcc-list] avr-gcc adding 'cli's in function prologues... |
Date: |
18 May 2001 18:29:47 +0400 |
Ludovic COURTES <address@hidden> writes:
> Hi !
>
> I finally found what was going wrong with gcc's prologue and epilogue.
> As i wrote before (see below), avr-gcc uses Y (r29:r28) to store stack
> pointer and then decrement it in order to reserve some space for local
> variables in SRAM (this is done in function prologue) and then increment
> it with the same value to restore original SP (this is done in epilogue).
>
> The problem is that gcc doesn't save Y at the end of prologue. Therefore,
> if your code uses theses registers and modify them, then the ret instruction
> won't do what you want it to (as the SP will be wrong) !
> I fixed it just by adding a "push y" and a "pop y" at the beginning and
> at the end of my code.
Please !
Send me an example.
Denis.