Loading...
Pages: 1 [2]   Go Down
Author Topic: Library Problem With IDE V1.5.1r2 And Due  (Read 2499 times)
0 Members and 1 Guest are viewing this topic.
Forum Administrator
Milano, Italy
Offline Offline
Full Member
*****
Karma: 19
Posts: 209
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Arctic_Eddie:

The file avr/io.h contains definitions for registers that are available only on AVR architecture.
If your project needs that include it means that you're using some feature available only on AVR hardware (and should be rewritten to use an equivalent SAM3X feature if you want to make it run on the Due).

One check that you can do is:

remove the #include <avr/io.h> from your biggest project, try to compile it for Mega, and look where it fails: these are the places that needs to be ported.

C
Logged

C.

St. Petersburg, FL
Offline Offline
Jr. Member
**
Karma: 1
Posts: 61
Retired physicist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The call to avr/io.h was shown in the compiler error statement as coming from line 25 in twi.c. I added my work-around using the __SAM3X8E__ trick just assuming that sam/pio.h was the equivalent. However, the trick partially worked but sam/pio.h was not found. There are going to be a lot of hardware discrepancies where AVR calls don't work. Since I don't know what the Due equivalent will be, I'll just have to wait until someone else sorts this problem out satisfactorily. There is also a problem with paths in the IDE. When I supply the absolute path to a .H file, it still says it can't find it. Maybe a sketch won't work because it's AVR specific but it should at least find it. All of the #include errors are coming from within included libraries and not my sketch. Some of the substitute files for the Due haven't been created yet so I'm at a stand-still. I'll continue with the Mega and watch the forum for future progress.

Thanks for the help from all contributors.
Logged

Forum Administrator
Milano, Italy
Offline Offline
Full Member
*****
Karma: 19
Posts: 209
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I understand, but my point was that the avr/io.h equivalent for ARM doesn't exist and its not going to exist. You'll never find a "sam/pio.h" that works as a drop-in replacement for avr/io.h, because it can't be done.

The call to avr/io.h was shown in the compiler error statement as coming from line 25 in twi.c.

This is strange because the Wire library is one of the first library that was ported to Due, and I saw many reports from users that used it successfully.
Are you using the Wire library found in arduino-1.5.1?
Logged

C.

St. Petersburg, FL
Offline Offline
Jr. Member
**
Karma: 1
Posts: 61
Retired physicist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

My V1.5.1r2 has two copies in the unzipped folder. One is in avr/libraries and the other is in sam/libraries. Both are dated 11/23/12. There is also an original in Documents/Arduino/libraries. I assume the compiler knows which one to use since I've told it to compile for the Due. The same sketch works if I select the Mega board. When I use a more complete path to Wire.h it says file or folder not found.

#include <sam/libraries/Wire/Wire.h>
Logged

St. Petersburg, FL
Offline Offline
Jr. Member
**
Karma: 1
Posts: 61
Retired physicist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The compiler is looking for the old version.

C:\Users\xxxx\Documents\Arduino\libraries\Wire\utility\twi.c:25: fatal error: avr/io.h: No such file or directory
Logged

St. Petersburg, FL
Offline Offline
Jr. Member
**
Karma: 1
Posts: 61
Retired physicist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The Wire.h file in sam has this in the heading but the compiler is looking elsewhere. Sure seems like lots of users are seeing path errors in the IDE.

 * TwoWire.h - TWI/I2C library for Arduino Due
 * Copyright (c) 2011 Cristian Maglie <c dot maglie at bug dot st>.
 * All rights reserved.
Logged

Forum Administrator
Milano, Italy
Offline Offline
Full Member
*****
Karma: 19
Posts: 209
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The compiler is looking for the old version.

C:\Users\xxxx\Documents\Arduino\libraries\Wire\utility\twi.c:25: fatal error: avr/io.h: No such file or directory

The IDE prioritize the libraries found in {sketchbook_folder}\libraries. Try to move the Wire folder in sketchbook elsewhere, and the IDE should find the correct library (the one inside sam/libraries).
Logged

C.

St. Petersburg, FL
Offline Offline
Jr. Member
**
Karma: 1
Posts: 61
Retired physicist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If I eliminate the one in {sketchbook_folder}\libraries, will the compiler find the right one in sam or avr according to board selection. Will this damage my ability to use V1.0.3 for other boards.
Logged

St. Petersburg, FL
Offline Offline
Jr. Member
**
Karma: 1
Posts: 61
Retired physicist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Moving the Wire library from the sketch folder to some other place, eliminates the avr/io.h error. The sketch still compiles when selecting the Mega. However, now I get another error about a missing item, square. Including math.h does not solve the problem. There is still a path problem when selecting the Due.

C:\Users\xxxxx\Documents\Arduino\libraries\PlainFFT\PlainFFT.cpp:143: error: 'square' was not declared in this scope
Logged

Pages: 1 [2]   Go Up
Print
 
Jump to: