[Top][All Lists]

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

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

From: David Brown
Subject: [avr-gcc-list] Re: assembly-c mix and interrupts
Date: Fri, 20 Nov 2009 00:19:26 +0100
User-agent: Thunderbird (Windows/20090812)

darkschine wrote:
Before I continue, I would like to suggest a resolution to my problem. I am
using the ATmega328P
My assembly code follows a standard that ALL registers used are pushed and
popped from the stack. However, my assembly code does NOT store the SREG.
Could this be causing my problems?

We can't say for sure if this is /the/ cause of your problems, but we can pretty much guarantee that it will lots of problems. Make sure you save the SREG.

A far better solution in most cases would be to re-write the interrupt routine in C. The compiler will then make sure that all necessary registers, including SREG, are saved and restored properly. The days of having to write interrupt routines in assembly are far in the past, except for very exceptional cases.

reply via email to

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