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 force GCC to not to remove "nop" statements ?


From: Weddington, Eric
Subject: RE: [avr-gcc-list] How to force GCC to not to remove "nop" statements ?
Date: Thu, 19 Feb 2009 11:14:40 -0700

 

> -----Original Message-----
> From: 
> address@hidden 
> [mailto:address@hidden
> org] On Behalf Of Vincent Trouilliez
> Sent: Thursday, February 19, 2009 11:02 AM
> To: address@hidden
> 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




reply via email to

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