chipKIT® Development Platform

Inspired by Arduino™

Philips color graphic lcd library compilation error.

Created Tue, 14 Jun 2011 23:01:01 +0000 by pial


pial

Tue, 14 Jun 2011 23:01:01 +0000

I am trying to run an example sketch of Philips PCF8833 graphics lcd library and getting the following error:

fatal error: avr/pgmspace.h: No such file or directory compilation terminated.

Is there anything that mpIDE has that replaces this header file?


Jacob Christ

Tue, 14 Jun 2011 23:25:55 +0000

Here's what I've done to circumvent this issue:

/* PGMSPACE */
#if defined(__PIC32MX__)
    // neither PROGMEM or PSTR are needed for PIC32, just define them as null
    #define PROGMEM
    #define PSTR(s) (s)
#else
    #include <avr/pgmspace.h>
#endif

and if you use printProgStr add this:

#if defined(__PIC32MX__)
    #define printProgStr(s)     Serial.print(s);
#else
    /* given a PROGMEM string, use Serial.print() to send it out */
    /* Some non-intuitive casting necessary:                           */
    /* printProgStr(PSTR("Func.Mode:\t0x"));                           */
    /* printProgStr((char*)pgm_read_word(&mtpopNames[(op & 0xFF)]));   */
    void printProgStr(const char* str )
    {
      if(!str) {
        return;
      }
      char c;
      while((c = pgm_read_byte(str++))) {
        Serial.print(c,BYTE);
      }
    }
#endif

I'm not sure if it works, I haven't completed the port of what I'm working on.

Jacob

My two axioms of embedded development First Axiom: If the tools work, then your job is easy. Second Axiom: The tools never work.


pial

Wed, 15 Jun 2011 05:27:08 +0000

Thanks for the reply Jacob. I tried what you suggested and seems like it's looking for the following now..

_SFR_BYTE _BV pgm_read_word

Are these also not needed to be defined?


Jacob Christ

Wed, 15 Jun 2011 05:49:34 +0000

I'm not sure what those are for. I did get my code working but it looks like your lib is using somethings mine is not. I'll dig into it a bit more tomorrow or the next day.

I only converted the parts of pgmspace.h I needed to get my lib working.

Jacob


Jacob Christ

Fri, 17 Jun 2011 00:36:48 +0000

Can you post some code that is using these calls?

I think you can probably do something like this:

#define pgm_read_byte_near(address_short) (address_short) #define pgm_read_word_near(address_short) (address_short) #define pgm_read_dword_near(address_short) (address_short)

But I couldn't say for sure if this will work without seeing the code that is calling these functions.

Jacob


Mark

Fri, 17 Jun 2011 06:06:38 +0000

These are already defined in wiring.h

#if !defined(AVR) #define PROGMEM #define pgm_read_byte_near(x) (*((char )x)) #define pgm_read_byte_far(x) (((char )x)) #define pgm_read_word_near(x) (((short )x)) #define pgm_read_workd_far(x) (((short *)x))

#define	prog_void		const void
#define	prog_char		const char
#define	prog_uchar		const unsigned char
#define	prog_int8_t		const int8_t
#define	prog_uint8_t	const uint8_t
#define	prog_int16_t	const int16_t
#define	prog_uint16_t	const uint16_t
#define	prog_int32_t	const int32_t
#define	prog_uint32_t	const uint32_t
#define	prog_int64_t	const int64_t
#define	prog_uint64_t	const uint64_t

#endif


Jacob Christ

Sun, 19 Jun 2011 23:11:10 +0000

These are already defined in wiring.h

Is wiring.h an Arduino lib, or was it made special for chipKIT?

The Arduino sketches I'm looking at seem to expect prog_read_byte(x) to come from avr/pgmspace.h. If they are looking in avr/pgmspace.h, why are these defined in wiring.h?

Jacob