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

Solving L107 _DATA_GROUP Overflows

This is only my second project with Keil, so I am not an expert, but I have Please read the manual'ed. :) The code I'm working on was released by the manufacturer of the system, which includes an embedded 8051. The original code worked, but was poorly written and lacked functionality. As I am making changes, I find that I hit CODE and DATA overflows. I can solve CODE overflows by moving code to other code banks and simplifying things. DATA overflows are a little more difficult.

The Memory Model is "Small: variables in DATA" and the Code Rom Size is "Large: 64K program". I'd prefer not to mess with these, as I have to give the code back working and reasonably like how I got it. The main source file (which is not overlayed) has a small allocation of RAM/dataspace, most of it being used by the ROM code that I can't modify. I've gotten rid of local variables and used XDATA wherever possible. Suddenly, after days of development (and probably 100 builds), I've overflowed DATA by 9 bytes somehow.

*** ERROR L107: ADDRESS SPACE OVERFLOW
    SPACE:   DATA
    SEGMENT: _DATA_GROUP_
    LENGTH:  0009H

My RAM map looks like:

            * * * * * * *   D A T A   M E M O R Y   * * * * * * *
            REG     0000H     0008H     ABSOLUTE     "REG BANK 0"
            DATA    0008H     0018H     ABSOLUTE
            BIT     0020H.0   000FH.5   ABSOLUTE
            BIT     002FH.5   0000H.2   UNIT         _BIT_GROUP_
                    002FH.7   0000H.1                *** GAP ***
            DATA    0030H     0045H     ABSOLUTE
            IDATA   0075H     0006H     UNIT         ?ID?RAMPROG
                    007BH     0001H                  *** GAP ***
            DATA    007CH     0002H     ABSOLUTE
            DATA    007EH     0002H     ABSOLUTE
            IDATA   0080H     0043H     ABSOLUTE
                    00C3H     000DH                  *** GAP ***
            IDATA   00D0H     0030H     ABSOLUTE

I'm assuming that the ABSOLUTE DATA allocations are for C function arguments and local variables -- except that I have now very little/few of either. In fact, the module's compiler output says:

MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   8573    ----
   CONSTANT SIZE    =    284    ----
   XDATA SIZE       =   ----      16
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----      10
   IDATA SIZE       =      6    ----
   BIT SIZE         =   ----       2
END OF MODULE INFORMATION.

which actually shows less DATA, IDATA and CONSTANTs used than when I first started. So I guess the question is:

1. If I've eliminated EVERY SINGLE local variable in the code, and
2. Reduced the C function parameters to just a small number, all BYTE data types.

what's left to do to eliminate the DATA overflow?

Parents Reply Children
  • the linker allocates variables in blocks = segments.

    Thus if you have a DATA segment that is larger than the available DATA space, the linker inserts IDATA there.

    The trick is to spread the data variables into several modules when you are squeezed.

    here is one case of mine where the linker used space below 0x80 (bdata to 0x20) for IDATA
    I used assembler to avoic the compiler assigning an identical segment name (maybe you can do it in C, I did not investigate)

    ;;////////////////////////////////////////////////////////////////////
    ;;
    ;;  FILE:     SXZDATA.A51
    ;;
    ;;  Copyright TwinVision N.A., 2007
    ;;
    ;;  Overcome the Keil inability to save DATA parts in gropus lexx than "hole"
    
    
    $NOMOD51
    
               PUBLIC GCDXdestListBeg
               PUBLIC GCDXdestListEnd
               PUBLIC GCDXprmsListBeg
               PUBLIC GCDXprmsListEnd
               PUBLIC GCDXcurrListBeg
               PUBLIC GCDXcurrListEnd
               PUBLIC GCDXothListBeg
               PUBLIC GCDXothListEnd
    
    ?DT?zdataf SEGMENT DATA
    
               RSEG ?DT?zdataf
    
    
    GCDXdestListBeg: ds 2
    GCDXdestListEnd: ds 2
    GCDXprmsListBeg: ds 2
    GCDXprmsListEnd: ds 2
    GCDXcurrListBeg: ds 2
    GCDXcurrListEnd: ds 2
    GCDXothListBeg:  ds 2
    GCDXothListEnd:  ds 2
    
               end
    

    Erik