> -----Original Message-----
> From: 
> avr-gcc-list-bounces+eweddington=cso.atmel....@nongnu.org 
> [mailto:avr-gcc-list-bounces+eweddington=cso.atmel....@nongnu.
> org] On Behalf Of Vincent Trouilliez
> Sent: Thursday, February 19, 2009 11:02 AM
> To: avr-gcc-list@nongnu.org
> Subject: [avr-gcc-list] How to force GCC to not to remove 
> "nop" statements ?
> 
> Hi list,
> 
> Like many people I guess, I am using in-lined "nop" asm statements to
> respect the timing of external devices, when toggling their control
> lines.
> 
<snip> 
> Am using avr-gcc 4.3.2
> 

If you are using WinAVR 20081205 then you can use one of the new builtin 
functions:

void __builtin_avr_delay_cycles(unsigned long __n);

The prototype can be found in <avr/builtins.h>, but you shouldn't need the 
prototype to call it.

The parameter is expecting the number of cycles that you want to delay, so in 
your case this should be:

__builtin_avr_delay_cycles(4);

And then let gcc handle generating the code for you. ;-)

Eric Weddington


_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to