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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

1,019 Views
kkobel
Contributor I

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

Labels (1)
0 Kudos
2 Replies

299 Views
kkobel
Contributor I

Thanks for the reply.

 

It's Codewarrior Development Studio for Microcontrollers V6.2

 

 

The reason is historic. There are language and printer tables that were 'compiled' (no code, just tables) using an 8 but compiler which I didn't have. I was trying to used CW for this task, and other than the 16/32 bit pointer issue, I was sucessful. I have used other compilers in the past that had some kind of built-in function to get the parts of an otherwise larger object. EI: low(object), or high(object).

 

Karl

0 Kudos

299 Views
CrasyCat
Specialist III

Hello

 

What are you attempting to do here?

Pointer are always encoded on 32-bit on Coldfire MCU. Why are you looking for 16-bit pointers?

 

Additionally which version of CodeWarrior are you using?

CodeWarrior for Coldfire V6.2 or CodeWArrior for MCU V6,2?

 

To retrieve that info:

  - Start the IDE

  - Select Help -> About Freescale CodeWarrior

  - Click on Installed Products

  - You should see in the dialog which product you are using.

 

CrasyCat

0 Kudos