Go Down

Topic: Arduino 1.5.2 and the F() macro. (Read 2351 times) previous topic - next topic

OutOfLine

On v1.5.2 I get errors similar to...   [from bad memory, as 1.5.2 does not run for me yet...]

Code: [Select]
'PSTR' not declared in this scope...

It looks to me as if using the F() macro would have brought that in.
Does the F() macro work for you on v1.5.2?

OutOfLine

Forgot to say, that an #error directive (in my code) also triggered the 'PSTR' error instead of displaying the error message. No F() macro involved, this time.

KurtE

In the porting of my code to run on the Due, I have brought in my own definitions to make things work.  It would be nice if one of the low level system include files did this for us, like was done for mpide...

Code: [Select]
#if defined(__SAM3X8E__)
    #define PROGMEM
    #define pgm_read_byte(x)        (*((char *)x))
//  #define pgm_read_word(x)        (*((short *)(x & 0xfffffffe)))
    #define pgm_read_word(x)        ( ((*((unsigned char *)x + 1)) << 8) + (*((unsigned char *)x)))
    #define pgm_read_byte_near(x)   (*((char *)x))
    #define pgm_read_byte_far(x)    (*((char *)x))
//  #define pgm_read_word_near(x)   (*((short *)(x & 0xfffffffe))
//  #define pgm_read_word_far(x)    (*((short *)(x & 0xfffffffe)))
    #define pgm_read_word_near(x)   ( ((*((unsigned char *)x + 1)) << 8) + (*((unsigned char *)x)))
    #define pgm_read_word_far(x)    ( ((*((unsigned char *)x + 1)) << 8) + (*((unsigned char *)x))))
    #define PSTR(x)  x
  #if defined F
    #undef F
  #endif
  #define F(X) (X)
#endif

Hope that helps
Kurt

OutOfLine


In the porting of my code to run on the Due, I have brought in my own definitions to make things work.  It would be nice if one of the low level system include files did this for us [...]


Let's hope somebody hears you,
and I join the choir ;)

Thank you.

cmaglie

Added an issue to remember this:
https://github.com/arduino/Arduino/issues/1317

C
C.


Go Up