Hi All:
I use Keil uVision3.I setup BL51 Locate: code range:0x80-0x3EFF Xdata range:0x3E00-0x3FFF,0xE000-0xE1FF
I want to compile a .c file like this:
BYTE xdata array1[2]; BYTE xdata UsbBuffer[512];
but I get some Error Message: *** ERROR L107: ADDRESS SPACE OVERFLOW SPACE: XDATA SEGMENT: ?XD?BULKEXT LENGTH: 0202H
If I remove array[2] and compile,It will be OK. I don't know why BL51 not Locate array[2] to another memory block(0x3E00-0x3FFF)?
you do not happen to use the large model?
It happen to use the large model too.
then the first thing 'grabbed' from the xdata are the local variables.
just for show, enlarge the area a bit so the error disappears and look at the map
If I define Global variable like this: BYTE xdata UsbBuffer[512]; memory map will be: TYPE BASE LENGTH RELOCATION SEGMENT NAME XDATA E000H 0200H UNIT ?XD?BULKEXT
If I define Global variable like this: BYTE xdata UsbBuffer[512]; BYTE xdata array1[2];
it will Error:*** ERROR L107: ADDRESS SPACE OVERFLOW SPACE: XDATA SEGMENT: ?XD?BULKEXT LENGTH: 0202H
If I change xdata range:0x3D00-0x3FFF,0xE000-0xE1FF, it will be OK. memory map will be: TYPE BASE LENGTH RELOCATION SEGMENT NAME XDATA 3D00H 0202H UNIT ?XD?BULKEXT
If I define like this:
BYTE xdata UsbBuffer[512]; //Global variable void TD_Poll(void){ BYTE xdata array1[2]; array1[0]=0; array1[1]=1; PA2=array1[0]; //LED1 PC1=array1[1]; //LED2 }
and xdata range is 0x3F00-0x3FFF,0xE000-0xE1FF,It will be OK,memory map like this: TYPE BASE LENGTH RELOCATION SEGMENT NAME XDATA 3F00H 0002H UNIT _XDATA_GROUP_ XDATA E000H 0200H UNIT ?XD?BULKEXT
why?it can place global variables and local variables on different memory block!
If I move UsbBuffer[512];
to local variable,it will overflow. If I change xdata range is 0x3D00-0x3FFF,0xE000-0xE1FF,it will add _XDATA_GROUP size and ?XD?BULKEXT disappear.
If I use _at_ keyword will OK. xdata range:0x3F00-0x3FFF, 0xE000-0xE1FF code like this:
BYTE xdata UsbBuffer[512]; BYTE xdata array[2] _at_ 0x3F00;
memory map: TYPE BASE LENGTH RELOCATION SEGMENT NAME XDATA 3F00H 0002H ABSOLUTE XDATA E000H 0200H UNIT ?XD?BULKEXT
but...why BL51 can't locate array[2] to another memory block(0x3E00-0x3FFF) by itself?
but...why BL51 can't locate array[2] to another memory block(0x3E00-0x3FFF) by itself? it can't because there are some loval variables there already.
I GUESS the linker does absolutes first, thus when using _at_ you force the locals to the other region. switching to small will probably fix the problem