On our solutions (chapter 3), the following code will be proposed:
void shortpause(u_short duration)
{
u_short i;
for (i=0;i<duration;i++) {
}
}
But this code fragment will not work with AVR-GCC 4.x.x anymore. It seems to be optimized away (means no pause)...
With the following small changes, the pause will work as expected:
void shortpause(u_short duration)
{
u_short i;
for (i=0;i<duration;i++) {
asm volatile ("nop" ::);
}
}
Probably more changes are necessary, please post all further issues in this item...
Logged In: YES
user_id=687107
Originator: NO
Independent from the used gcc version, a "nop" in a busy wait loop is a good idea.
Is there a canonical solution to "how to compile nut/os with gcc 4.x" ?
Did someone fix the avr-gcc 4.x bug so far ?
I personally would prefer to stick with gcc 3.x until this gcc 4.x bug is fixed and not work around.
besides the winavr push, there is no need for 4.x. is it?