spark/core-firmware — pull request #187 by jacobrosenthal (2014-04-30 12:58:12+00:00)
Title: unroll F macro and restore print const __FlashStringHelper *

Make F and other Flash based functions work. Please test with the below. Note the inclusionion of Teensy's avr/pgmspace.h definitions. I dont know if you want to include them yourself or maintain that as an external include.

```cpp
#include "application.h"

//Teensy's /avr/pgmspace
#include

#define PROGMEM
#define PGM_P const char *
#define PSTR(str) (str)

typedef void prog_void;
typedef char prog_char;
typedef unsigned char prog_uchar;
typedef int8_t prog_int8_t;
typedef uint8_t prog_uint8_t;
typedef int16_t prog_int16_t;
typedef uint16_t prog_uint16_t;
typedef int32_t prog_int32_t;
typedef uint32_t prog_uint32_t;

#define strcpy_P(dest, src) strcpy((dest), (src))
#define strcat_P(dest, src) strcat((dest), (src))
#define strcmp_P(a, b) strcmp((a), (b))

#define pgm_read_byte(addr) (*(const unsigned char *)(addr))
#define pgm_read_word(addr) (*(const unsigned short *)(addr))
#define pgm_read_dword(addr) (*(const unsigned long *)(addr))
#define pgm_read_float(addr) (*(const float *)(addr))

#define pgm_read_byte_near(addr) pgm_read_byte(addr)
#define pgm_read_word_near(addr) pgm_read_word(addr)
#define pgm_read_dword_near(addr) pgm_read_dword(addr)
#define pgm_read_float_near(addr) pgm_read_float(addr)
#define pgm_read_byte_far(addr) pgm_read_byte(addr)
#define pgm_read_word_far(addr) pgm_read_word(addr)
#define pgm_read_dword_far(addr) pgm_read_dword(addr)
#define pgm_read_float_far(addr) pgm_read_float(addr)

const char TEST1[] PROGMEM = { "hello world" } ;

//wifi client->print has a buffer that so far we've been unable to locate
//under 154 (our identify size) for sure.. so sending char by char for now
void printlnF(PGM_P data)
{
char buffer[20];
strcpy_P(buffer, data);
Serial.println(buffer);
}

/* This function is called once at start up ----------------------------------*/
void setup()
{
Serial.begin(9600);
delay(5000);
Serial.println((F("Hello World")));
printlnF(TEST1);
}

/* This function loops forever --------------------------------------------*/
void loop()
{
//This will run in a loop
}
```