I think i just discovered a compiler bug in Arch linux, Ubuntu seems to be OK though... I'm wondering if there's a bug affecting some distributions and not others.
The bug would lead to a very similar problem to that which you describe. Please try uploading the Blink example, and tell me if it blinks correctly, or too fast, or not at all.
I think i just discovered a compiler bug in Arch linux, Ubuntu seems to be OK though... I'm wondering if there's a bug affecting some distributions and not others.
The bug would lead to a very similar problem to that which you describe. Please try uploading the Blink example, and tell me if it blinks correctly, or too fast, or not at all.
It's ArchLinux. Blink doesn't work - the light is constantly on, not blinking. AVR-GCC is v 4.5.2-1
Read this thread: http://arduino.cc/forum/index.php/topic,49900.0.html
Although that thread is about the Mega I think it is a similar bug. It affects programs with no initialised global variables, that's why your first example fails but the third one works. The thread also explains how to do a disassembly.
stimmer:
Read this thread: http://arduino.cc/forum/index.php/topic,49900.0.html
Although that thread is about the Mega I think it is a similar bug. It affects programs with no initialised global variables, that's why your first example fails but the third one works. The thread also explains how to do a disassembly.
Even if I initialize hue (int hue=0;) it still doesn't work. I tried every combination.
I don't know how specific it is, so far I've only seen people running Arch linux mention it. Someone on the other thread downgraded the compiler to 4.3.5 (?) on Arch Linux but still had the problem. It isn't affecting Ubuntu.
You might try avoiding the problem by applying good programming practice, and declare hue in the function where it's used (instead of using a global variable):
Thanks, I usually apply good programming practices. I just got my arduino today and was experimenting. It's not like it's some kind of a production code. Besides in a one-file, 50 liner it really doesn't matter if you use global variables.
And working around compiler bugs like this is way more evil than bad programming practices.
I don't know if compiling from source would help, if you've got the time and the patience you could try it. I couldn't get the compiler to compile on Ubuntu and I just gave up.
It could be gcc version or configure switches. I adapted PKGBUILDs from tinyos and compiled latest vanilla binutils (2.21) and gcc (4.5.2) and still the same problem.
If you know anything about compiling gcc-avr tell me if you see something suspicious here: