[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] AVR gcc port
From: |
Theodore A. Roth |
Subject: |
Re: [avr-gcc-list] AVR gcc port |
Date: |
Sun, 18 Jan 2004 09:34:20 -0800 (PST) |
On Sun, 18 Jan 2004, J.C. Wren wrote:
> Assuming one has the structure below, how does one declare the text
> in the structure to be placed in .text instead of .data? I've figured
> out how to obtain .text placement for strings passed in functions, but
> that (as expected, based on the macro definition) gives errors for text
> in structures.
>
> --jc
>
> typedef struct commandList_s
> {
> PGM_P command;
> void (*handler) (void);
> PGM_P help;
> }
> commandList_t;
>
> //
> //
> //
> PROGMEM commandList_t commandList [] =
> {
> { "?", cmd_help, "This help list" },
> { "version", cmd_version, "Display version" },
> { NULL, NULL, NULL }
> };
Here's a structure I use in one of my projects:
struct menuitem
{
FP_MenuItemHandler handler; /**< Function called to handler selected
item. */
const char * PROGMEM desc; /**< Text description of menu item. Must point
to a string in program space. */
};
The struct lives in program space (.text) and when needed is copied to
sram.
Hope that helps.
Ted Roth
Re: [avr-gcc-list] AVR gcc port, Joerg Wunsch, 2004/01/19