Re: MPS430-gcc on Mac...
"William \"Chops\" Westfield" <[email protected]>
| Newsgroups | gmane.comp.hardware.texas-instruments.msp430.gcc.user |
|---|---|
| Message-ID | <[email protected]> |
On Mar 27, 2013, at 4:47 AM, Peter Bigot wrote:
> is the code actually wrong?
Good question. I can't tell just by looking at it, you can't tell either.
I don't think that is a good thing, especially since there is an "obvious" translation that looks just as efficient. I'll have to analyze more…
It does look like a newer avr-gcc creates very similar code, so it is probably some gcc-level optimization rather than something msp430 specific. (Terrific; I'll try to see which incomprehensibly-defined -f option controls this optimization. Sigh.)
It looks like it's doing
// mysteriously initialize temp
for() {
if (pwmx + temp < 0)
led_xxx_off;
:
temp = temp + -1;
}
which will be correct, and probably even better on a truly RISCy CPU (no immediate math, no decrement instruction), but it sure looks weird with a typical microcontroller instruction set.
BillW
------------------------------------------------------------------------------
Own the Future-Intel® Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game
on Steam. $5K grand prize plus 10 genre and skill prizes.
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d