Pages: 1 [2]   Go Down
Author Topic: Blink does not blink...  (Read 5736 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
God Member
*****
Karma: 32
Posts: 507
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I seem to remember a bug in a version of avr-binutils causing the delay function not to work correctly. You can check the version by executing the command "avr-as --version".  I version I use on my machine is  "GNU assembler (GNU Binutils) 2.20.1.20100303"

Yes this is correct. What happens is, in any sketch with no initialised global variables (no data section), the linker puts the uninitialised globals (bss section) at an illegal address, and one of those uninitialised globals is the micros counter. Hence delay won't work properly. See these two threads:

http://arduino.cc/forum/index.php/topic,49900.15.html
http://arduino.cc/forum/index.php/topic,51000.msg363998.html#msg363998
Logged


Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Stimmer,

That seems to be the right analysis of the problem. I tested this version of Blink:

Code:
char dummyvar = 123;

/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.
 
  This example code is in the public domain.
 */

void setup() {
  dummyvar++;
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  pinMode(13, OUTPUT);     
}

void loop() {
  digitalWrite(13, LOW);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(13, HIGH);    // set the LED off
  delay(1000);              // wait for a second
}

And that works. More a workaround than a solution, of course..

Ko.
Logged

Global Moderator
Italy
Online Online
Brattain Member
*****
Karma: 335
Posts: 23137
Logic is my way
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This is a "fake" solution, because only the Blink sketch works....

If you use some sketch more complex than Blink, you won't get your code working.
A few days ago I changed OS, from Ubuntu to Arch, and I had to fight with the binutils-avr bug. Using this solutions just fix the Blink sketch. But if I try to use this fix with ArduinoISP when I go to flash an external micro I get "programmer is out of synch".

But if I compile the ArduinoISP on a old computer of mine running Lubuntu, I get a "perfect working" sketch and I can flash standalone chips like a charme....

So, this fix does NOT... fix the problem. There should be something else related to the buggy linker that comes up during compilation.
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

HI.. I've just bought an Arduino Uno (I'm from taly also smiley-wink ).. I'm runining on archlinux and i tryed to start the blink sketch and it was not working. So I've searched around and i found a warning on Archlinux wiki. I've just updated binutils-avr so i've got:
Code:
$> avr-as --version
GNU assembler (GNU Binutils) 2.21

So the problem wasn't fixed with the new version.. Any really workaround to bring back the dalay() function?

Cheers
Logged

Pages: 1 [2]   Go Up
Jump to: