From aa2bbe91314982c4aa2724db251f2ceda0ba727f Mon Sep 17 00:00:00 2001 From: "DrZiplok@gmail.com" Date: Thu, 25 Nov 2010 02:59:15 +0000 Subject: [PATCH] A better workaround for the PSTR warning bug. This seems to work correctly. git-svn-id: https://arducopter.googlecode.com/svn/trunk@919 f9c3cf11-9bcb-44bc-f272-b75c42450872 --- libraries/FastSerial/examples/FastSerial/FastSerial.pde | 6 ++++++ libraries/FastSerial/vprintf.cpp | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/libraries/FastSerial/examples/FastSerial/FastSerial.pde b/libraries/FastSerial/examples/FastSerial/FastSerial.pde index 6e4421ee4b..4a9ae94b51 100644 --- a/libraries/FastSerial/examples/FastSerial/FastSerial.pde +++ b/libraries/FastSerial/examples/FastSerial/FastSerial.pde @@ -14,6 +14,12 @@ // #include +#undef PROGMEM +#define PROGMEM __attribute__(( section(".progmem.data") )) + +#undef PSTR +#define PSTR(s) (__extension__({static prog_char __c[] PROGMEM = (s); &__c[0];})) + // // Create a FastSerial driver that looks just like the stock Arduino // driver. diff --git a/libraries/FastSerial/vprintf.cpp b/libraries/FastSerial/vprintf.cpp index e52f972bfe..96d1efe030 100644 --- a/libraries/FastSerial/vprintf.cpp +++ b/libraries/FastSerial/vprintf.cpp @@ -48,6 +48,12 @@ extern "C" { #include "xtoa_fast.h" } +// workaround for GCC bug c++/34734 +#undef PROGMEM +#define PROGMEM __attribute__(( section(".progmem.data") )) +#undef PSTR +#define PSTR(s) (__extension__({static prog_char __c[] PROGMEM = (s); &__c[0];})) + #define GETBYTE(flag, mask, pnt) ({ \ unsigned char __c; \ asm ( \