problem with sleep.h

4 posts / 0 new
Last post
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have done some test with sleep mode and i got error message when i call sleep mode:

set_sleep_mode(SLEEP_MODE_IDLE);

C:\WinAVR-20090313\miracle\SST\SST\SST\test\default/../avr_example.c:110: undefined reference to `__BV'

Next lines are in

    do { \
        _SLEEP_CONTROL_REG = ((_SLEEP_CONTROL_REG & ~__BV(SM)) | (mode)); \
    } while(0)

AVR Studio 4.16.638
GUI Version 4, 16, 0, 626
AVR Simulator 1, 0, 2, 1
AT90S8515 220

Operating System
Major 5
Minor 1
PlatformID 2
Build 2600
Service Pack 3

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

_BV() is defined in sfr_defs.h which is itself included by avr/io.h. So make sure, as always, that you have:

#include 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
_BV() is defined in sfr_defs.h

Well, one would expect, that sfr_defs.h is then included in sleep.h, in one way or other, isn't it?

But it's not the point here: I'd say, the culprit is the double-underscored __BV(). I'd say, the developer who updated sleep.h had it defined somewhere in his custom headers, and this slipped in. I'd say, this is a bug, in one way or other.

JW

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Both are bugs, the lacking include for sfr_defs.h, as well as the double
underscore.

Please file avr-libc bug reports for it.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.
Please read the `General information...' article before.