[Top][All Lists]

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

Re: [avr-gcc-list] Volatile bad compiled while

From: Paulo Marques
Subject: Re: [avr-gcc-list] Volatile bad compiled while
Date: Fri, 27 Nov 2009 12:43:58 +0000
User-agent: Thunderbird (X11/20090310)

max2009tiny wrote:
> Ok thanks i use gcc 4.3.2
> secondary question is if i remove volatile from code
> register unsigned char lastrec asm("r8")
> then while generate asm efficient but dont work why?
>   a0: 88 11           cpse    r24, r8
>   a2: ff cf           rjmp    .-2             ; 0xa2 <waitACK+0x2>

My educated guess (since you're not providing a full working example) is
that the interrupt routine that is supposed to change r8 is saving and
restoring its state in the prologue / epilogue. You might need to do a
naked interrupt routine or write it all in assembly.

As others have said, unless you're really desperate to shave off a few
cycles, all the issues that arise from trying to tweak the compiler's
behavior are really not worth it. IMHO, you'd be better of trying some
compiler options like David Brown suggested.

Paulo Marques
Software Development Department - Grupo PIE, S.A.
Phone: +351 252 290600, Fax: +351 252 290601
Web: www.grupopie.com

"I have not yet begun to procrastinate"

reply via email to

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