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

Can't compile...

I written this code and it compiles just fine. However, when I tried to include <stdio.h> library to use with my hyperterminal, it says that it compiled, but can not link. Here is the message that it gave me...

ERROR L107: ADDRESS SPACE OVERFLOW
SPACE: DATA
SEGMENT: _DATA_GROUP_
LENGTH: 0070H

My memory model is "Small: variables in DATA". When I changed it to compact or large, my program will compile and link, but it behaves differently when I put program it to the Philips 89C664..

thanks
Tommy

  • I written this code and it compiles just fine.

    So why is your title "Can't Compile?!" ;-)

    See the recent Thread, Differences between compiler versions

    When you include the extra functions, they require some space for parameters & their own internal variables as well as just code space - which is why you got the DATA space overflow in Small model.

    When you switch to COmpact or Large, your code starts using "External" [1] memory, MOVX instructions, and the DPTR.

    There could be a hardware fault with your XRAM, or a timing difference which causes your code to fail, something might be corrupting your DPTR(s), your Startup code might not be properly initialising your XRAM & revealing flaws like uninitialised variables in your code, you may have mis-used memory-specific pointers, etc, etc

    [1] "External" here means "outside the CPU core" - although it may be packaged within the IC, it is still outside the core & has to be addessed with MOVX.

  • The REAL problem here is that in SMALL memory model, you are limited to a total of 128 bytes of variable space, period.

    In large model, you are limited to 64K bytes of variables space.

    So, the following program:

    unsigned char array [121];
    
    void main (void)
    {
    }
    

    will compile and link just fine in LARGE model but not in SMALL model (the register bank of R0-R7 takes up the first 8 bytes of memory).

    You should probably take a look at a databook to get a better understanding of the architecture of the 8051.

    Jon