Pages: [1]   Go Down
Author Topic: Arduino 1.5.2 and the F() macro.  (Read 1708 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 1
Posts: 66
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Code:
'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?
Logged

Offline Offline
Jr. Member
**
Karma: 1
Posts: 66
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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
Logged

Offline Offline
Jr. Member
**
Karma: 1
Posts: 66
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley-wink

Thank you.
Logged

Forum Administrator
Milano, Italy
Offline Offline
Sr. Member
*****
Karma: 22
Posts: 291
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

C
Logged

C.

Offline Offline
Jr. Member
**
Karma: 1
Posts: 66
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks a lot.
Logged

Pages: [1]   Go Up
Jump to: