Author Topic: Cannot find avr/pgmspace.h when building  (Read 12099 times)

jamesingham

  • RFduino Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Cannot find avr/pgmspace.h when building
« on: January 27, 2014, 04:05:12 PM »
I was attempting to connect a ethernet jack (ENC28J60) to my RFduino which I have used on other Arduinos in the past using the EtherCard library, but I have been getting errors when building so I decided to run a blank script and just include the library like so:

Code: [Select]
#include <EtherCard.h>

void setup() {
}

void loop() {
}

The error I'm seeing is to do with avr:

Code: [Select]
In file included from sketch_jan27a.ino:1:
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/EtherCard.h:37: fatal error: avr/pgmspace.h: No such file or directory
compilation terminated.

However when I check the directory, avr/pgmspace.h does indeed exist at /Applications/Arduino1.5.5b.app/Contents/Resources/Java/hardware/tools/avr/avr/include/avr/pgmspace.h

So does anyone know what I've missed that is causing this to not build?

mkay

  • RFduino Team
  • *****
  • Posts: 405
  • Karma: +15/-0
    • View Profile
Re: Cannot find avr/pgmspace.h when building
« Reply #1 on: January 28, 2014, 05:11:12 PM »
Try this:

Copy the file pgmspace.h located : \hardware\arduino\sam\cores\arduino\avr\pgmspace.h

To hardware\arduino\RFduino\cores\arduino\avr\ (you will have to create the "avr" directory.

That should fix the compile error you are seeing

jamesingham

  • RFduino Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Cannot find avr/pgmspace.h when building
« Reply #2 on: January 29, 2014, 02:22:33 AM »
Thanks for the suggestion, this does indeed solve the error I was getting but now there's a whole lot more :/ It looks like something is being declared more than once. I'm guessing that at this time the library is just not supported for RFDuino. I'll post the new errors anyway:

Code: [Select]
Arduino: 1.5.5 (Mac OS X), Board: "RFduino"

/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.cpp:18: error: conflicting declaration 'word ENC28J60::bufferSize'
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.h:19: error: 'ENC28J60::bufferSize' has a previous declaration as 'uint16_t ENC28J60::bufferSize'
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.cpp:18: error: declaration of 'uint16_t ENC28J60::bufferSize' outside of class is not definition
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.cpp: In static member function 'static void ENC28J60::initSPI()':
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.cpp:267: error: 'SPCR' was not declared in this scope
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.cpp:267: error: 'SPE' was not declared in this scope
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.cpp:267: error: 'MSTR' was not declared in this scope
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.cpp:268: error: 'SPSR' was not declared in this scope
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.cpp:268: error: 'SPI2X' was not declared in this scope
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.cpp: In function 'void enableChip()':
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.cpp:272: error: 'cli' was not declared in this scope
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.cpp: In function 'void disableChip()':
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.cpp:278: error: 'sei' was not declared in this scope
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.cpp: In function 'void xferSPI(byte)':
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.cpp:282: error: 'SPDR' was not declared in this scope
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.cpp:283: error: 'SPSR' was not declared in this scope
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.cpp:283: error: 'SPIF' was not declared in this scope
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.cpp: In function 'byte readOp(byte, byte)':
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.cpp:293: error: 'SPDR' was not declared in this scope
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.cpp: In function 'void readBuf(word, byte*)':
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.cpp:310: error: 'SPDR' was not declared in this scope
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.cpp: At global scope:
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.cpp:366: error: prototype for 'byte ENC28J60::initialize(word, const byte*, byte)' does not match any in class 'ENC28J60'
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.h:24: error: candidate is: static uint8_t ENC28J60::initialize(uint16_t, const uint8_t*, uint8_t)
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.cpp:419: error: prototype for 'void ENC28J60::packetSend(word)' does not match any in class 'ENC28J60'
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.h:28: error: candidate is: static void ENC28J60::packetSend(uint16_t)
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.cpp:432: error: prototype for 'word ENC28J60::packetReceive()' does not match any in class 'ENC28J60'
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.h:29: error: candidate is: static uint16_t ENC28J60::packetReceive()
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.cpp: In static member function 'static uint8_t ENC28J60::doBIST(byte)':
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.cpp:526: error: 'SPCR' was not declared in this scope
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.cpp:526: error: 'SPE' was not declared in this scope

mkay

  • RFduino Team
  • *****
  • Posts: 405
  • Karma: +15/-0
    • View Profile
Re: Cannot find avr/pgmspace.h when building
« Reply #3 on: January 29, 2014, 02:49:16 PM »
You will need to make some modifications to that library, it looks like it has some AVR specific SPI stuff going on.

jamesingham

  • RFduino Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Cannot find avr/pgmspace.h when building
« Reply #4 on: January 31, 2014, 02:23:56 PM »
Ooops. I was missing an include. New test:

Code: [Select]
#include <enc28j60.h>
#include <EtherCard.h>
#include <net.h>

void setup() {
}

void loop() {
}

The SPI errors have gone now, but there are some type issues:

Code: [Select]
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.h:18: error: 'uint8_t' does not name a type
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.h:19: error: 'uint16_t' does not name a type
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.h:21: error: ISO C++ forbids declaration of 'uint8_t' with no type
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.h:21: error: expected ';' before '*' token
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.h:23: error: expected ';' before 'static'
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.h:24: error: 'uint8_t' does not name a type
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.h:28: error: 'uint16_t' has not been declared
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.h:29: error: 'uint16_t' does not name a type
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.h:31: error: 'uint8_t' has not been declared
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.h:31: error: ISO C++ forbids declaration of 'uint8_t' with no type
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.h:31: error: expected ',' or '...' before '*' token
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.h:32: error: 'uint8_t' has not been declared
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.h:32: error: 'uint8_t' has not been declared
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.h:33: error: 'uint8_t' does not name a type
/Applications/Arduino1.5.5b.app/Contents/Resources/Java/libraries/EtherCard/enc28j60.h:41: error: 'uint8_t' does not name a type

 

anything