avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] How to reserve registers


From: Jens Bauer
Subject: Re: [avr-gcc-list] How to reserve registers
Date: Fri, 16 Dec 2011 23:34:15 +0100

Hi Omar,


> .global IncrementCounter
> IncrementCounter:
>     ldi r19, 1                          ; use to increment with carry
>     clc
>     adc counter_b0, r19
>     adc counter_b1, r1
>     adc counter_b2, r1
>     adc counter_b3, r1
>     ret

I think you could get rid of clc, if the first instruction is changed to...

        add counter_b0,r19

You might also want to find a way to 'inline' the assembler code, but I don't 
know how time-critical the code is.
-If the TIMER2_COMPA_vect only contains the assembler code, I think you should 
consider making the entire interrupt routine in assembler, but ofcourse, that 
still depends on if you would benefit from it.
(RET spends 5 clock cycles, rcall spends another 4)


Love,
Jens



reply via email to

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