Topic : Need Help with absolute allocation of const array

Forum : 8051

Original Post
Post Information Post
August 8, 2007 - 8:47pm
Guest

hello,

I am getting an Error C165 when I try to declare any variable as absolutely allocated.

I would like to locate the following array at the end of ROM in a SiLabs C8051F320 uC.

at 0x3DFA unsigned char SW_Ver_ROM[] =
{
0x80, // Major Release, MSB set for Prototype S/W
0x01, // Minor Release
0x07, // Year
0x08, // Month
0x08, // Day
0x13 // 24-Hr Hour
};

Thanks for your help.
Greg

Replies
Post Information Post
+1
0
-1
August 9, 2007 - 9:38am
Guest

Hi Greg, please try this :

code at 0x3DFA unsigned char SW_Ver_ROM[] =
{
  0x80,   //  Major Release, MSB set for Prototype S/W   
  0x01,   //  Minor Release   
  0x07,   //  Year
  0x08,   //  Month
  0x08,   //  Day 
  0x13    //  24-Hr Hour
};

You don't speficy the memory space where to place your variable. If your memory model is small or tiny, (small is by default), then the default memory space for variables is DATA. And 0x3DFA is an out-of-bounds address for the DATA space... It could work with XDATA or CODE, and in your case, it seems you want to place it in code. So just specify it !

regards
Lionel

+1
0
-1
August 9, 2007 - 9:44am
Guest

Try:

unsigned char code at 0x3DFA etc.

Better still, locate your array at 0x3DF9, because otherwise the last byte will be written in the location of the Flash Lock Byte. You don't want to do that :-)

Rob.

[edit]tags![/edit]

+1
0
-1
August 10, 2007 - 3:03pm
Guest

Thanks for the help, it worked just as it should.

Greg