Fixed compilation for gcc-4.6.2 with avr-lib-1.8.0 (thanks daid)

This commit is contained in:
Erik van der Zalm
2012-02-09 19:38:53 +01:00
parent 9173a5713b
commit 598eb1d4f1
3 changed files with 81 additions and 81 deletions

View File

@ -14,7 +14,7 @@
#include <string.h>
#include <inttypes.h>
#include <avr/delay.h>
#include <util/delay.h>
#include <avr/pgmspace.h>
#include <avr/eeprom.h>
#include <avr/wdt.h>
@ -58,8 +58,8 @@
// //#define PSTR (s ) ((const PROGMEM char *)(s))
// //# define MYPGM(s) (__extension__({static prog_char __c[] = (s); &__c[0];}))
// //#define MYPGM(s) ((const prog_char *g PROGMEM=s))
// //#define MYPGM(s) PSTR(s)
#define MYPGM(s) (__extension__({static char __c[] __attribute__((__progmem__)) = (s); &__c[0];})) //This is the normal behaviour
#define MYPGM(s) PSTR(s)
//#define MYPGM(s) (__extension__({static char __c[] __attribute__((__progmem__)) = (s); &__c[0];})) //This is the normal behaviour
//#define MYPGM(s) (__extension__({static prog_char __c[] = (s); &__c[0];})) //this does not work but hides the warnings
@ -69,8 +69,8 @@
#define SERIAL_PROTOCOLLNPGM(x) {serialprintPGM(MYPGM(x));SERIAL.write('\n');}
const prog_char errormagic[] PROGMEM ="Error:";
const prog_char echomagic[] PROGMEM ="echo:";
const char errormagic[] PROGMEM ="Error:";
const char echomagic[] PROGMEM ="echo:";
#define SERIAL_ERROR_START serialprintPGM(errormagic);
#define SERIAL_ERROR(x) SERIAL_PROTOCOL(x)
#define SERIAL_ERRORPGM(x) SERIAL_PROTOCOLPGM(x)