[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Pointer to a function in a structure in flash?
From: |
E . Weddington |
Subject: |
Re: [avr-gcc-list] Pointer to a function in a structure in flash? |
Date: |
Mon, 27 Oct 2003 19:53:30 GMT |
>
> > Ok, how are you defining cmd_func_table? Does it reside
in
> > RAM or Flash? How are you initializing it?
>
> I want it all in Flash, strings, tables, pointers
struct ...
>
> This shows one complete entity:
>
> typedef struct /* define the struct 'cmd_entry' */
> {
> /* Pointer to string in flash: */
> PGM_P command;
>
> /* Pointer to function in flash returning an int,
passed a char
> pointer: */
> uint16_t (*function)(CONST char * tok_buf, CONST
char * tok_ptr);
> }str_func_entry;
>
> static CONST char FLASH baud_str[] PROGMEM = "BAUD";
>
> static uint16_t set_baud( CONST char * rate_ptr, CONST
char * tok_ptr )
> {
> ....
> }
>
> static FLASH str_func_entry cmd_func_table[] PROGMEM =
> {
> {baud_str, set_baud}
> }
>
>
The attached foo.c seems to build fine. Also attached is
foo.lst, the listing.
HTH
Eric
foo.c
Description: Text document
foo.lst
Description: Text document
Re: [avr-gcc-list] Pointer to a function in a structure in flash?, E . Weddington, 2003/10/27
Re: [avr-gcc-list] Pointer to a function in a structure in flash?,
E . Weddington <=
Re: [avr-gcc-list] Pointer to a function in a structure in flash?, E . Weddington, 2003/10/27
Re: [avr-gcc-list] Pointer to a function in a structure in flash?, E . Weddington, 2003/10/27
Re: [avr-gcc-list] Pointer to a function in a structure in flash?, E . Weddington, 2003/10/28
Re: [avr-gcc-list] Pointer to a function in a structure in flash?, E . Weddington, 2003/10/28