assigning constant data into code space

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

assigning constant data into code space

1,710 Views
stevec
Contributor III
I am porting an application over from the Keil C51 compiler. I am storing some constants in code space and the C51 code is

 void say(unsigned char word, unsigned char offset)
{
    unsigned long word_address;

    // word address high byte table
    code unsigned char addresstablehi[] = { 0x00,0x00,0x00,0x00,0x01,0x01,0x04,0x07 ,0x08 } ;
    .
    .
How do I perform this in CW.
The address table values are calculated by another program which produces a text file in the correct format so that I can cut and paste into the compiler, so I would hope the CW code would be similar.

Steve
Labels (1)
0 Kudos
3 Replies

221 Views
J2MEJediMaster
Specialist I
Doing I quick search on this forum, I found the following link which might get you started.

Also, it would probably help if you mentioned what version of CodeWarrior you're using and what MCU you're targeting.

---Tom

0 Kudos

221 Views
stevec
Contributor III
Thanks, I'm using CW 5.7 and using an MC9S08RE16.
0 Kudos

221 Views
CompilerGuru
NXP Employee
NXP Employee
Make your table static const.
For globals const alone is enough, but for locals you have to make them static (function static) too, otherwise CW will still allocate them on the stack.

Daniel

0 Kudos