[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
AW: [avr-gcc-list] interrupt optimization
From: |
Haase Bjoern (PT-BEU/EMT) * |
Subject: |
AW: [avr-gcc-list] interrupt optimization |
Date: |
Thu, 2 Feb 2006 18:37:08 +0100 |
Hi,
I'd like to suggest the following:
1.) use a seperate asm file for the part of your ISR that is excecuted
frequently.
2.) define an additional function that will safe all of the used
registers by
void __attribute__ ((signal))
to_be_excecuted_seldomly (void);
void
to_be_excecuted_seldomly (void)
{
sampling = 0x7F;
callInlineFunction();
}
3.) call "to_be_excecuted_seldomly" in your asm file.
You will be having a close to ideal situation. Namely the only
sub-optimal issue would be that you will be having one unnecessary call
and one unnecessary return instruction.
IMO, using the __naked__ attribute is very error-prone. I'd not
recommend that.
Bjoern.
> Hi,
>
> I have an interrupt which is called a lot of times but only really do
> something very rarely:
>
> ISR(...)
> {
> if (sampling-- == 0)
> {
> sampling = 0x7F;
> callInlineFunction();
> }
> }
>
> The problem is that I end up with a lot of push/pop that just eat up
all
> my CPU cycles most of the time. Using an inline function helped
removing
> all registers that were not used by the function at all (don't know
why
> the optimization doesn't do this already) but I still get a lot of
push
> not necessary by the "if" and that I would like to move before the
> function call inside the "if".
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- AW: [avr-gcc-list] interrupt optimization,
Haase Bjoern (PT-BEU/EMT) * <=