Pages: [1]   Go Down
Author Topic: PROGMEM on Due  (Read 313 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 144
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Earth
Offline Offline
Sr. Member
****
Karma: 14
Posts: 331
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 144
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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:
(char * )pgm_read_word(&(menu_items[0]))
Logged

Earth
Offline Offline
Sr. Member
****
Karma: 14
Posts: 331
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: