--- In AVR-Chat@yahoogroups.com, "Chuck Hackett" <egroupscdh@...> wrote:
> "Compiler optimizations disabled; functions from <util/delay.h>
> won't work as> designed"
Clearly, you can't use the delay.h macros/functions without optimization enabled so if you insist on having optimization off, simply comment out the inclusion of delay.h.
> [U]ntil I compile with optimization after everything is working.
I understand the intention, it is common among new avr-gcc users (see the many posts at AVR Freaks). You'll find, however, that the generated code with optimization turned off is downright horrific. My advice is to use -Os or a similar high level of optimization and deal with the very rare optimization issue as it arises. I've been compiling our AVR code base with -Os for seven years or more and have never encountered bad code due to optimization.
The counter argument is that it makes debugging somewhat more difficult. I claim that you quickly get accustomed to the types of things the optimizer does and you'll be able to debug your code with ease.
Don Kinzer
ZBasic Microcontrollers
http://www.zbasic.net