Re: [cc65] Optimizing code fails - Found the error!

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2003-11-22 23:27:45


On Sat, Nov 22, 2003 at 02:13:07PM -0600, Geoffrey Wossum wrote:
> For gcc on the AVR microcontrollers, there's an __interrupt__ attribute that
> is used for ISR's, which insures that proper prologue and epilogue code is
> generated.

As mentioned before, this has already been discussed in detail a long time
ago, and it's not as easy as it looks on the first glance. I cannot find the
original discussion now, maybe it preceedes the mailing list archive. The
biggest problem is that the manipulation of the stack pointer is not interrupt
safe, so the stack pointer may be invalid when the interrupt routine is
entered. This means that the entry code will have to switch to another stack.
This stack has to be allocated somewhere, so just declaring something as
__interrupt__ or similar is not enough.


Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz_at_musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-11-22 23:28:07 CET