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

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

[avr-gcc-list] Re: optimizer removes volatile pin access code. why?


From: David Brown
Subject: [avr-gcc-list] Re: optimizer removes volatile pin access code. why?
Date: Wed, 28 Oct 2009 14:59:33 +0100
User-agent: Thunderbird 2.0.0.23 (Windows/20090812)

Joerg Desch wrote:
Hi David,

On Wed, 28 Oct 2009 11:02:35 +0100
David Brown <address@hidden> wrote:

Joerg Desch wrote:

Have you checked things like the direction setting for the pin, or if
it is used by a peripheral?  That might sound obvious, but sometimes
the little things get forgotten.

Yes, I know. But all this is working fine. Using -Os had solved the
problem.


The normal practice is to paste the snippet into the text of the email.

Without the Makefile is would be a snippet. ;-)

For now I have the problem, that I can't reproduce the code which leads
to the missing code. I've worked on the project after posting here. The
code snippet I had extracted this morning doesn't show the problem too.

So I have to play with it in order to get the same effects.

I've talked to an colleague this morning. He had the same problems with
WinAVR a few months ago. His solution was adding a asm volatile("nop")
between cbi() and sbi(). He had to generate a bus timing by software.

At the end, I don't have a snippet. But I'm trying to reproduce the effect.


In my experience, when code works or fails to work depending on the optimisation flags, it is the source code that is wrong - it is very rare that it is the compiler that is the problem. avr-gcc is not perfect, but incorrect code bugs are uncommon. But it's difficult to judge until you are able to isolate the problem code.

You could also try to get a copy of this colleague's problem code. If it turns out to be a bug in the compiler, most people on this list would like to hear about it. And if it's a bug or misunderstanding in the source code, it could also be interesting - we can all learn from other people's mistakes.





reply via email to

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