This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

*** ERROR L107: ADDRESS SPACE OVERFLOW

Hello ,

If I add this function to my C program:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
int key_board()
{
int a = 0,b = 0,c = 0,d = 0,e = 0,f = 0,g = 0,h = 0;
int port = 0,r2 = 0,r3 = 0,r4 = 0,r5 = 0,r6 = 0;
LED_R = 0;
port = KEY_PORT;
a = port & 0x03;
if(a == 0) // SJMP no Key
{
return key = 0;
}
// Waite:
while (b != 0) //
{
entprell();
port = KEY_PORT;
b = port & 0x03;
}
//START_ZYKLUS:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I get the error message:

*** ERROR L107: ADDRESS SPACE OVERFLOW

SPACE: DATA
SEGMENT: _DATA_GROUP_
LENGTH: 001AH
Program Size: data=132.0 xdata=0 code=1133

Microcontroller AT89C51RC2 with Flash 32 KB

My compiler: Keil-C with C51.exe

How should I specify the data range in my program ?

Kind Regards

Juergen B.

  • Dear Juergen,

    as you can see in the memory summary, you try to allocate 132 bytes of data memory. An 8051 device only has 128 bytes in total and the stack and the register banks also needs to fit into this internal RAM. You need to move some of your variables into idata or xdata or pdata to free up some data memory. Please see our C compiler manual how to do that (https://developer.arm.com/documentation/101655/0961/Cx51-User-s-Guide/Language-Extensions/Memory-Types). As far as I remember, the AT89C51RC2 has some kb of on-chip xdata RAM, which needs to be enabled in the startup code.

    Hans

    • Hello Hans,

      many thanks for your response.

      The next morning I also thought about using too many variables.

      I actually just did that for clarity.

      Based on the variables a - h, I only need the variable a = ACC (Akku), and unsigned char r2- r6.

      After using only this variable I can compile my program.

      Program Size: data=115.0 xdata=0 code=932”.

      But my program is not finished yet.

      The background is: I want to convert assembly code into a C program.

      The variables r2-r6 should be used as registers R2-R6, analogous to my assembler program.

      Another question: can I also use the registers in my C program?

      I will take a look at the reference to the use of the other data types.

      Kind Regards

      Juergen

      0