Go Down

Topic: PROGMEM on Due (Read 343 times) previous topic - next topic

newhobby

Hi,

Is it true I can't use PROGMEM on Due?
What are my other options?
Put everything in RAM?
It does have a hefty 96K RAM, but my code is already made to work on AVR and it would be much simpler if I could somehow not have to code 2 different storage system.

Thanks,
RI

Collin80

It is true that there is no really good way to store changeable persistent data on the Due. However, if you were using PROGMEM then you probably were using it to store static information weren't you? In that case you can declare variables const to place them into flash memory. In fact, it appears that the 1.5.3 version of the Arduino IDE added compatibility so that you can use PROGMEM on the Due and it'll do the right thing. Have you tried it?

newhobby

Correct.
Static data.
Well, the code I'm using is not working.
I'm using array of progmem though.
I'll make a simple code to test the concept and post later.
Here are the declarations:
Code: [Select]

const prog_char MENU_1[] PROGMEM = "Menu 1";
const prog_char MENU_2[] PROGMEM = "Menu 2";
static PROGMEM const char *menu_items[] = {MENU_1,MENU_2};

And I was referring to them like this:
Code: [Select]

(char * )pgm_read_word(&(menu_items[0]))

Collin80

On the Due try pretending that the data is really in RAM when you read it.

Go Up