I may have been looking at this too long, and missed something really obvious. If I have, I apologise.
My project doesn't seem to be doing what I expect, so I've broken the problem all the way down to the 'blink' example code. If I upload that using ardunio-0022 (on linux) to my duemilanove (with atmega328), it doesn't seem to work (the led comes on, but doesn't blink). If I upload the exact same code using arduino-0018, it works fine.
Assuming I had a hardware problem, I got a fresh duemilanove and tried with that - and got the same results.
(as a weird aside, I can get it to work with -0022, by putting either of Serial.begin(9600) or even more weirdly, Serial.end() into the setup() function).
I've seen some mention of -0022 doing optimisations which break the Eeprom library, and possibly some other stuff, but surely basic code like this should be fine, shouldn't it?
Is this just me? Am I going crazy (quite likely!)? What's going on?
int ledPin = 13; // LED connected to digital pin 13
// The setup() method runs once, when the sketch starts
void setup() {
// initialize the digital pin as an output:
pinMode(ledPin, OUTPUT);
}
// the loop() method runs over and over again,
// as long as the Arduino has power
void loop()
{
digitalWrite(ledPin, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(ledPin, LOW); // set the LED off
delay(1000); // wait for a second
}
That's the Blink from arduino-0018. It is not the same as Blink from arduino-0022.
Now, if this doesn't work please ignore everything in this post. Something is broken that I can't fix by remote control.
However if that one works, then note the following:
Some avr-gcc distributions for some Fedora Linux systems (maybe others too) have a buggy binutils package that doesn't work if the sketch doesn't have any variables. Look at the arduino-0022 Blink example: No variables!
Bottom line: I am not aware of any other bugs that would affect Arduino development, but, of course there is no way to prove a negative. This particular bug is not a show-stopper for practical programs, since they all have variables, but it is annoying and somewhat disheartening to find that the very simplest sketch (the fundamental "Hello World" for Arduino) doesn't work.
Or as my muse says from time to time: "Rats!"
Regards,
Dave
Footnote:
I discovered the bug when I built avr-gcc version 4.3.4 for my Centos system. The bug is not with gcc, but with the binutils package. If you are interested, try the following from a command line:
avr-as --version
I found that version 2.21 had this bug. I rebuilt with version 2.20.1 and all is well.
Yep, that's got it - you're absolutely right - blink with no variables does not work, blink with one variable declared and used (at least) once works fine. Also, yes, I have avr-binutils-2.21-1.fc14.i686 which appears to be broken.
(I tried the no-variables 'blink' on -0018, and sure enough, it doesn't work there either)
I'll try to remember to keep a couple of variables (not #define'd constants) kicking about when I comment out code in my own projects to avoid this problem.
coofercat:
...
I'll try to remember to keep a couple of variables...
Note that any use of Serial will create a global HardwareSerial object, so you may not have to keep any extra globals around just to overcome the bug.
Just for kicks, try the following:
Take the Arduino-0022 Blink sketch (the no-variables version) and put Serial.begin(9600); in its setup() function. Even though that sketch doesn't use any Serial I/O, this will cause the HardwareSerial object to be linked into the executable program and it will blink. (At least it blinked for me when I had the bad binutils version.)