|
From: | Graham Davies |
Subject: | Re: [avr-gcc-list] Problem with delay loop |
Date: | Fri, 28 Sep 2007 07:25:42 -0400 |
Royce Pereira wrote:
So I have to write more 'C' code :) to get the same stuff done, in the 'new & smarter' compiler!
Not more code, just correct code.Have you tried returning the final value of your delay argument from the function? If the compiler optimizes only within the boundaries of individual functions it won't be able to take advantage of the fact that the result is not used. Strictly, this isn't correct either as the compiler could just assign zero and return. But, it may not be smart enough to do that and you may get closer to your original assembly language. Another way to go would be to write the function directly in assembly language.
Graham.
[Prev in Thread] | Current Thread | [Next in Thread] |