[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: darkschine
Subject: Re: [avr-gcc-list] assembly-c mix and interrupts
Date: Sun, 29 Nov 2009 22:11:42 -0800 (PST)

What I was trying to say was:


interruptHandler() was blindly destroying volatile registers which ISR
should have been preserving since they are the callers responsibility. ISR
was not preserving these registers because it was not aware that these
registers were currently in use. The attitude of the ISR seems to be that
the problem registers should have been stored before the ISR was triggered.
The problem registers are used to carry arguments and return values between
function calls and the ISR can be triggered at ANY time, so any chance of
avoiding this problem is impossible

A solution to the problem would have been:

   asm("push r18");
   asm("push r31");
   asm("pop r31");
   asm("pop r18");

or like you said, constrain the ISR to the ISR() macro. But this reduces
abstraction and the ability to test the code.

In my opinion, the best algorithm for an interrupt would be:


then unit testing can be carried out on processData() and getData() leaving
little testing required for the interrupt itself
View this message in context: 
Sent from the AVR - gcc mailing list archive at Nabble.com.

reply via email to

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