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

[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


Attachment: foo.c
Description: Text document

Attachment: foo.lst
Description: Text document


reply via email to

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