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

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

RE: [avr-gcc-list] Options on avr-gcc


From: larry barello
Subject: RE: [avr-gcc-list] Options on avr-gcc
Date: Mon, 12 Feb 2007 08:16:06 -0800

Declaring N as volatile is a good solution.

The alternative is to disenable optimization on GCC (-o0) but I don't think
you will like the results.

Another solution is to put 

        asm("nop");

In your loop body.  That will force the compiler to implement the loop.

There might be some fancier compiler option just for loop optimization, but
I don't know about them.

-----Original Message-----
From: Javier Almansa Sobrino

Hi everybody. Let's see if you can help me....

I've been compiling a proyect based on a AT90USB1287 and I've something
like this:

uint16_t n;

for (n = 0; n < 1000; n++); /* Delay loop */
 --- rest of code --

originally, this piece of code generates a delay loop, but I've changed
the AVR-GCC options on my Makefile and now, if I want the delay loop
works correctly, I must declare n as volatile. 

Any one knows what option I must to pass to AVR-GCC when compile to
avoid this. I don't remember and I've lost the original Makefile.

Thanks in advance.






reply via email to

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