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

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

[avr-gcc-list] Strings in flash


From: Ron
Subject: [avr-gcc-list] Strings in flash
Date: Mon, 1 Aug 2005 17:12:20 +1000

I know this method for initialising an array of strings in flash works:

typedef struct
{
    char    text[24];
} EXAMPLE;

EXAMPLE Example[] __attribute__((progmem)) =
{
    {
        "The first text message"
    },{
        "The second"
    }
};

EXAMPLE p;

int main(void)
{
    memcpy_P(&p, &Example[0], sizeof(EXAMPLE)); 

    return 0;
}

However, when the strings are a variety of sizes, space is wasted. Is
there some way to declare the array instance so I can use the type
definition one would normally use in ram, ie:

typedef struct
{
    char*   text;
} EXAMPLE;

I am sure this has come up before but could not find a direct reference.

Ron





reply via email to

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