[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] assembly-c mix and interrupts

From: Joerg Wunsch
Subject: Re: [avr-gcc-list] assembly-c mix and interrupts
Date: Mon, 30 Nov 2009 06:18:06 +0100 (MET)

darkschine <address@hidden> wrote:

> my code was actually already written in C and looked something like:
> ISR(vector){
>    interruptHandler();
> }

Which is less than ideal because the compiler *always* has to preserve
all the registers that could possibly be destroyed by
interruptHandler().  If possible, always write the code directly into
the ISR.

> The compiler does not make sure that all necessary registers are
> saved and restored properly and apparently I am the first to notice
> this.

The chances that this is really the case are about 1E-6. ;-)

As the thread subject is about assembly-C mix, it is much more likely
that your mix is the reason rather than the compiler-generated code
that has been used by millions of AVR-GCC users before.

> I'm starting to wish I wrote the whole thing in assembly! ;)

You should probably have written the whole thing in C instead, as this
completely avoids the class of errors you are currently running into.

cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]