mirror of https://github.com/ArduPilot/ardupilot
AP_Common: PSTR def has specific version for avr-gcc 4.6 compatibility
* Also a small change in FastSerial/vprintf.cpp, which duplicates the PSTR definition * Won't effect others using earlier versions of avr-gcc
This commit is contained in:
parent
6b6e580a13
commit
def4ffbe86
|
@ -94,9 +94,15 @@ typedef struct {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# undef PSTR
|
# undef PSTR
|
||||||
|
/* Need const type for progmem - new for avr-gcc 4.6 */
|
||||||
|
# if __AVR__ && __GNUC__ == 4 && __GNUC_MINOR__ > 5
|
||||||
|
# define PSTR(s) (__extension__({static const prog_char __c[] PROGMEM = (s); \
|
||||||
|
(const prog_char_t *)&__c[0]; }))
|
||||||
|
#else
|
||||||
# define PSTR(s) (__extension__({static prog_char __c[] PROGMEM = (s); \
|
# define PSTR(s) (__extension__({static prog_char __c[] PROGMEM = (s); \
|
||||||
(prog_char_t *)&__c[0]; }))
|
(prog_char_t *)&__c[0]; }))
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
// a varient of PSTR() for progmem strings passed to %S in printf()
|
// a varient of PSTR() for progmem strings passed to %S in printf()
|
||||||
// this gets the gcc __format__ checking right
|
// this gets the gcc __format__ checking right
|
||||||
|
|
|
@ -52,7 +52,12 @@ extern "C" {
|
||||||
#undef PROGMEM
|
#undef PROGMEM
|
||||||
#define PROGMEM __attribute__(( section(".progmem.data") ))
|
#define PROGMEM __attribute__(( section(".progmem.data") ))
|
||||||
#undef PSTR
|
#undef PSTR
|
||||||
|
/* Need const type for progmem - new for avr-gcc 4.6 */
|
||||||
|
#if __GNUC__ == 4 && __GNUC_MINOR__ > 5
|
||||||
|
#define PSTR(s) (__extension__({static const prog_char __c[] PROGMEM = (s); &__c[0];}))
|
||||||
|
#else
|
||||||
#define PSTR(s) (__extension__({static prog_char __c[] PROGMEM = (s); &__c[0];}))
|
#define PSTR(s) (__extension__({static prog_char __c[] PROGMEM = (s); &__c[0];}))
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef GETBYTE
|
#ifdef GETBYTE
|
||||||
#undef GETBYTE
|
#undef GETBYTE
|
||||||
|
|
Loading…
Reference in New Issue