I just got my REV 5 Maple and have it plugged into a Gameduino and am trying to port a program that works fine on an Arduino.
Seem to have hit a snag when referencing data declared as extern. Here's a test program I wrote:
*** File TestCharset.pde ***
#include <GD.h>
#include "RobotRicCharacterSet.h"
#define RAM_CHR_SIZE 4096 // size of character set pixel data RAM
#define RAM_PAL_SIZE 2048 // size of character set palette data RAM
void setup( void ) {
PROGMEM prog_uchar *ptr;
// Initialise Gameduino.
GD.begin();
// Initialise character set pixel data RAM.
ptr = RobotRicCharacterSetPixelData;
// GD.copy( RAM_CHR, ptr, RAM_CHR_SIZE );
// Initialise character set pixel palette RAM.
ptr = RobotRicCharacterSetPaletteData;
// GD.copy( RAM_PAL, ptr, RAM_PAL_SIZE );
}
void loop( void ) {
}
*** File RobotRicCharacterSet.h ***
#include <GD.h>
extern PROGMEM prog_uchar RobotRicCharacterSetPixelData[];
extern PROGMEM prog_uchar RobotRicCharacterSetPaletteData[];
*** File RobotRicCharacterSet.cpp (edited for brevity) ***
#include <GD.h>
PROGMEM prog_uchar RobotRicCharacterSetPixelData[] = {
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // Character 0
0x00, 0x00, 0x15, 0x55, 0x1A, 0xAA, 0x1B, 0xFF, 0x1B, 0xFF, 0x1B, 0xEA, 0x1B, 0xE5, 0x1B, 0xE4, // Character 1
0x00, 0x00, 0x55, 0x55, 0xAA, 0xAA, 0xFF, 0xFF, 0xFF, 0xFF, 0xAA, 0xAA, 0x55, 0x55, 0x00, 0x00, // Character 2
0x00, 0x00, 0x55, 0x54, 0xAA, 0xA4, 0xFF, 0xE4, 0xFF, 0xE4, 0xAB, 0xE4, 0x5B, 0xE4, 0x1B, 0xE4, // Character 3
... and so on ...
0xBD, 0x7E, 0xC1, 0x43, 0xC6, 0x93, 0x5A, 0xA5, 0x5A, 0xA5, 0xC6, 0x93, 0xC1, 0x43, 0xBD, 0x7E, // Character 253 (ý)
0xBD, 0x7E, 0xC1, 0x43, 0xC6, 0x93, 0x5A, 0xA5, 0x5A, 0xA5, 0xC6, 0x93, 0xC1, 0x43, 0xBD, 0x7E, // Character 254 (þ)
0x3F, 0xFC, 0xFF, 0xFF, 0xFB, 0xEF, 0xFF, 0xFF, 0xFE, 0xBF, 0xDF, 0xF7, 0xF5, 0x5F, 0x3F, 0xFC, // Character 255 (ÿ)
};
PROGMEM prog_uchar RobotRicCharacterSetPaletteData[] = {
0xFF, 0x7F, 0xE0, 0x03, 0x1F, 0x7C, 0x00, 0x80, // Character 0
0x10, 0x00, 0x1F, 0x00, 0x1F, 0x42, 0x1F, 0x63, // Character 1
0x10, 0x00, 0x1F, 0x00, 0x1F, 0x42, 0x1F, 0x63, // Character 2
0x10, 0x00, 0x1F, 0x00, 0x1F, 0x42, 0x1F, 0x63, // Character 3
... and so on ...
0xFF, 0x7F, 0xE0, 0x03, 0x1F, 0x7C, 0x00, 0x00, // Character 253 (ý)
0xFF, 0x7F, 0xE0, 0x03, 0x1F, 0x7C, 0x00, 0x00, // Character 254 (þ)
0x00, 0x00, 0xE0, 0x03, 0xE0, 0x7F, 0x00, 0x7C, // Character 255 (ÿ)
};
As it stands the test program compiles OK. If I uncomment the lines calling GD.copy I get the message :
<BUILD>/TestCharset.cpp:19: undefined reference to `RobotRicCharacterSetPixelData'
<BUILD>/TestCharset.cpp:19: undefined reference to `RobotRicCharacterSetPaletteData'
What's going on? How come it can find them when I don't call GD.copy but it cannot when I do?
Note: GD.h is James Bowman's work from here : http://excamera.com/files/Gameduino_m.zip
The only clue I have is that the second parameter to copy is declared as prog_uchar *src rather than PROGMEM prog_uchar *src but I would not expect it to generate this error.
Any help appreciated.