Karl Kobel

How do I store the lower half of a pointer in a ROM table?

Discussion created by Karl Kobel on Sep 9, 2009
Latest reply on Sep 11, 2009 by Karl Kobel

I am generating ROM tables, but the overall address table needs to use only lower 16 bits of the 32 bit pointer.

 

CodeWarrior 6.2 for Coldfire.

 

 

typedef struct {
    unsigned char command;
    unsigned char data;
    unsigned char flag;
} TableDefType;

const TableDefType Table1[]= {
// some data...

};

 

 

const TableDefType Table2[]= {
// some data...

};

 

const char * Addresses[] = {

                 (const char*)&Table1,     // these need to be 16 bit pointers
                 (const char*)&Table2,
};

 

I have also tried making the above table an array of 'short's, but the compiler won't convert the pointers.

 

Is there a low() pre-processor function?

If not, is there any other way to accomplish this?

 

Karl

Outcomes