avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] array of structures with variables in flash


From: Kitts
Subject: [avr-gcc-list] array of structures with variables in flash
Date: Fri, 10 Jun 2005 15:07:50 +0530
User-agent: KMail/1.8

Hi All,

I have an array of structures in global space and would like access 
these structures from within my code. The structure is declared as 
follows:

struct {
        PGM_P name;
        const uint8_t no_of_param PROGMEM;
        PGM_P parameters;
}command[256];

On compile i get the warning;
"warning: `__progmem__' attribute ignored"

How do i declare variables (not strings) to be placed in ROM?

Now for the second part of my query (which is probably not avr specific 
but C in general), how do i declare the prototype for the above 
structure to be included all my project files?

I would like to use the index variable as an identification and do a one 
time initialisation. something like this;

#define XYZ 3

command[XYZ].name = PSTR("Something");
command[XYZ].no_of_param = 5;

While the above statements are going to be in the same file as the 
structure, say global.c, i want the structure to be accessible in other 
files like this;

length = strlen_P(command[XYZ].name);

Thanks in advance.
-- 
Cheers!
Kitts





reply via email to

[Prev in Thread] Current Thread [Next in Thread]