AnsweredAssumed Answered

Function Pointer in Struct causing ADuC7X2X to not execute program

Question asked by lmcquellin on Aug 15, 2017
Latest reply on Aug 16, 2017 by PatrickN

Hello,

 

I have recently started porting software from several micro-controller families to use the ADuC7 series exclusively.

 

In a command line interface library (based on the work of Anthony Massa and Michael Barr) I have a struct in the header file:

typedef struct
{
     char const    *name;
     void          (*function)(void);
} command_t;

extern command_t const cmd_tab[];

and a table of functions with corresponding labels in the .c file

 command_t const cmd_tab[COMMAND_TABLE_SIZE] =
{
          {"CMD",         cmd_all,},               
          {"DAQ",          cmd_daq,},               
          {"HELP",     cmd_help,},               
          {"$",          cmd_inst,},               
          {"ID",          cmd_id,},
          {NULL,      NULL }
};

This has been functional on numerous Atmel microcontrollers, as well as the Intel XScale PXA255. The ARM compiler in uVision does not return any warnings or errors during compiling and linking. Currently the table is not being used. Just having the table in the .c file with NULL or functions prevents the controller from starting when I call something such as cmd_line();. I am unsure if this is a compiler problem (I have used GNU GCC up to this point). Any advice would be appreciated.

 

Regards,

 

Liam

Attachments

Outcomes