Go Down

Topic: Cant load libraries - avr libc - sleep.h - IDE 1.0.5 (Read 8265 times) previous topic - next topic

jonmcosgrove

Hi there.

I've been struggling simply loading the libraries provided in avr libc. My main goal is to access sleep.h and power.h, however all my efforts have failed.

What I've tried:

- Used this tutorial with IDE 1.0 - no luck (http://andybrown.me.uk/wk/2012/04/28/avr-gcc-4-7-0-and-avr-libc-1-8-0-compiled-for-windows/)
- Copied the contents from C:\Users\Owner\avrgcc-4.7.0-avrlibc-1.8.0\avrgcc\avr\include to my sketchbook\libraries folder
     - This didn't show the libraries in orange like I would expect and screwed up the cores I had installed for ATtinys
- Editing the references within sleep.h and the other libraries included in it and its refrences directly to try to make it work in my sketchbook libraries.

Any suggestions for me. I've scoured the development section and no one seems to have this simple issue, yet I see many people including these libraries in sketches. I know I'm missing something simple, it seems like a reference or location issue to me since the files (I think) are there.

Below is what I get with things copied into my sketchbook libraries. [NOTE: Version.h and delay.h both appear to work but thats it]

Code: [Select]
[quote]
#include <boot.h>
#include <builtins.h>
#include <common.h>
#include <crc16.h>
#include <[color=#CC6600]delay[/color].h>
#include <eeprom.h>
#include <fuse.h>
#include <interrupt.h>
#include <io.h>
#include <io1200.h>
#include <io2313.h>
#include <io2323.h>
#include <io2333.h>
#include <io2343.h>
#include <io43u32x.h>
#include <io43u35x.h>
#include <io4414.h>
#include <io4433.h>
#include <io4434.h>
#include <io76c711.h>
#include <io8515.h>
#include <io8534.h>
#include <io8535.h>
#include <io86r401.h>
#include <io90pwm1.h>
#include <io90pwm216.h>
#include <io90pwm2b.h>
#include <io90pwm316.h>
#include <io90pwm3b.h>
#include <io90pwm81.h>
#include <io90pwmx.h>
#include <io90scr100.h>
#include <ioa6289.h>
#include <ioat94k.h>
#include <iocan128.h>
#include <iocan32.h>
#include <iocan64.h>
#include <iocanxx.h>
#include <iom103.h>
#include <iom128.h>
#include <iom1280.h>
#include <iom1281.h>
#include <iom1284p.h>
#include <iom128rfa1.h>
#include <iom16.h>
#include <iom161.h>
#include <iom162.h>
#include <iom163.h>
#include <iom164.h>
#include <iom165.h>
#include <iom165p.h>
#include <iom168.h>
#include <iom168p.h>
#include <iom169.h>
#include <iom169p.h>
#include <iom169pa.h>
#include <iom16a.h>
#include <iom16hva.h>
#include <iom16hva2.h>
#include <iom16hvb.h>
#include <iom16m1.h>
#include <iom16u2.h>
#include <iom16u4.h>
#include <iom2560.h>
#include <iom2561.h>
#include <iom32.h>
#include <iom323.h>
#include <iom324.h>
#include <iom324pa.h>
#include <iom325.h>
#include <iom3250.h>
#include <iom328p.h>
#include <iom329.h>
#include <iom3290.h>
#include <iom32c1.h>
#include <iom32hvb.h>
#include <iom32m1.h>
#include <iom32u2.h>
#include <iom32u4.h>
#include <iom32u6.h>
#include <iom406.h>
#include <iom48.h>
#include <iom48p.h>
#include <iom64.h>
#include <iom640.h>
#include <iom644.h>
#include <iom644p.h>
#include <iom644pa.h>
#include <iom645.h>
#include <iom6450.h>
#include <iom649.h>
#include <iom6490.h>
#include <iom649p.h>
#include <iom64c1.h>
#include <iom64hve.h>
#include <iom64m1.h>
#include <iom8.h>
#include <iom8515.h>
#include <iom8535.h>
#include <iom88.h>
#include <iom88p.h>
#include <iom88pa.h>
#include <iom8hva.h>
#include <iom8u2.h>
#include <iomx8.h>
#include <iomxx0_1.h>
#include <iomxx4.h>
#include <iomxxhva.h>
#include <iotn11.h>
#include <iotn12.h>
#include <iotn13.h>
#include <iotn13a.h>
#include <iotn15.h>
#include <iotn167.h>
#include <iotn22.h>
#include <iotn2313.h>
#include <iotn2313a.h>
#include <iotn24.h>
#include <iotn24a.h>
#include <iotn25.h>
#include <iotn26.h>
#include <iotn261.h>
#include <iotn261a.h>
#include <iotn28.h>
#include <iotn4313.h>
#include <iotn43u.h>
#include <iotn44.h>
#include <iotn44a.h>
#include <iotn45.h>
#include <iotn461.h>
#include <iotn461a.h>
#include <iotn48.h>
#include <iotn84.h>
#include <iotn85.h>
#include <iotn861.h>
#include <iotn861a.h>
#include <iotn87.h>
#include <iotn88.h>
#include <iotnx4.h>
#include <iotnx5.h>
#include <iotnx61.h>
#include <iousb1286.h>
#include <iousb1287.h>
#include <iousb162.h>
#include <iousb646.h>
#include <iousb647.h>
#include <iousb82.h>
#include <iousbxx2.h>
#include <iousbxx6_7.h>
#include <iox128a1.h>
#include <iox128a3.h>
#include <iox128d3.h>
#include <iox16a4.h>
#include <iox16d4.h>
#include <iox192a3.h>
#include <iox192d3.h>
#include <iox256a3.h>
#include <iox256a3b.h>
#include <iox256d3.h>
#include <iox32a4.h>
#include <iox32d4.h>
#include <iox64a1.h>
#include <iox64a3.h>
#include <iox64d3.h>
#include <lock.h>
#include <parity.h>
#include <pgmspace.h>
#include <portpins.h>
#include <power.h>
#include <sfr_defs.h>
#include <signal.h>
#include <signature.h>
#include <sleep.h>
#include <[color=#CC6600]version[/color].h>
#include <wdt.h>

[/quote]

joselorente

Let's say that you want to use the watchdog library from avr then you have to declare it like this:


Code: [Select]
#include <avr/wdt.h>


jonmcosgrove

Thanks for the reply but unfortunately that isn't my problem (see code below). Sleep just isn't being included for some reason.

Any other suggestions?

Code: [Select]
[quote]
#include <avr/sleep.h>
#include <avr\sleep.h>
#include <sleep.h>
#include </sleep.h>
#include <\sleep.h>

#include <avr/[color=#CC6600]version[/color].h>
#include <avr\version.h>
#include <[color=#CC6600]version[/color].h>
#include </[color=#CC6600]version[/color].h>
#include <\version.h>

[/quote]


jonmcosgrove

The author of the tutorial suggested that as the version that had worked for him. I've seen some people running into problems that seem to stem from different versions of the IDE and so I thought I'd stick with his suggestion.

Coding Badly


Do you own a Mega?  Do you have a program that compiles to more the 64K?  Does your greater-than-64K program have global constructors?

jonmcosgrove

No to all of the above. I'll look for a large sketch to test compile, but wont be able to upload.

What do you suspect with this line of questions?

Thanks for the help

Coding Badly

No to all of the above.


In which case, what do you hope to accomplish?

Even though the compiler that ships with the Arduino IDE is "old", for the vast majority of users it works very well.  All the evidence indicates you are a member of that class.

jonmcosgrove

My goal is simply to be able to use the libraries. Specifically sleep.h and power.h. You're correct I don't have any issues with the compiler, however the libraries aren't being recognized when I try to include them in a sketch.

Perhaps I'm way off base but the only place I have found libraries with these types of capabilities is at http://www.nongnu.org/avr-libc/

I've gotten the latest distribution and have been trying to copy the folders containing the libraries I'm interested in into the sketch/libraries to use with the arduino IDE.

The .h files I've found are located at this path in the distribution: C:\avrgcc-4.7.0-avrlibc-1.8.0\avrgcc\avr\include\avr

Am I getting way too complicated here?

Coding Badly

Am I getting way too complicated here?


Yes.  The Arduino IDE has everything you need.  There is no need to change the toolset.  Were I in your shoes, I would just start over.

Once you have a clean install of the Arduino IDE, just add this one line to the top of your sketch...
Code: [Select]
#include <avr/sleep.h>

I doubt you will ever need it but in case you do...
Code: [Select]
#include <avr/version.h>

joselorente

I just complied the following code in the IDE 1.0.4 and worked just fine.


Code: [Select]
#include <avr/sleep.h>

void setup()
{
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
sleep_enable();
}

void loop()
{

}

joselorente

By the way the avr libraries that the IDE is looking for are in the path "arduino-1.0.4\hardware\tools\avr\avr\include\avr", if you go there you will see the sleep.h file.

jonmcosgrove

Thank you guys, I guess my initial assumption that is was a library I needed to install, and that wasn't included already, led me down a unnecessary path.

I've got it working. Thanks again.

Go Up