BL51: ERROR 107 (ADDRESS SPACE OVERFLOW)

Version 1
    Question: I receive the following linker error when I compile and link my program:  *** ERROR L107: ADDRESS SPACE OVERFLOW      SPACE:   DATA      SEGMENT: _DATA_GROUP_      LENGTH:  0014H

     

    Answer:

    The best way to resolve this type of problem is to find out what's consuming all the memory. Look in the map (*.M51) file and locate the link map. It appears as follows:

    LINK MAP OF MODULE:  C:\TEMP\ASDF (ASDFASDF)
                TYPE    BASE      LENGTH    RELOCATION   SEGMENT NAME
                -----------------------------------------------------
                * * * * * * *   D A T A   M E M O R Y   * * * * * * *
                REG     0000H     0008H     ABSOLUTE     "REG BANK 0"
                DATA    0008H     0065H     UNIT         ?DT?ASDFASDF
                IDATA   006DH     0001H     UNIT         ?STACK

    The error message...

    *** ERROR 107: ADDRESS SPACE OVERFLOW
        SPACE:   DATA
        SEGMENT: _DATA_GROUP_
        LENGTH:  0014H

    specifies that a 14h byte long segment named _DATA_GROUP_ can't fit in the remaining DATA space. Referring to the link map, the DATA space starts at 8h and has a single segment ?DT?ASDFASDF that occupies 65h bytes. Since the DATA space is 80h bytes max., we can calculate the space remaining as 80h - (8h+65h) = 80h - 6Eh = 12h. So, there are only 12h bytes left in the DATA space. Since the _DATA_GROUP_ is 14h bytes long, it can't fit in the remaining 12h bytes.

    If the memory space is DATA, you should look for the largest DATA segments. If they are static or global buffers, you may want to consider moving them to XDATA memory to conserve the DATA space.