Memory issue

Help
2005-01-27
2013-03-12
  • Jonny Bergdahl
    Jonny Bergdahl
    2005-01-27

    When I compile my project I get this mem file:

    Direct Internal RAM:
       Name             Start    End      Size     Max    
       ---------------- -------- -------- -------- --------
       REG_BANK_0       0x00     0x07         8        8  
       REG_BANK_1       0x08                  0        8  
       REG_BANK_2       0x10                  0        8  
       REG_BANK_3       0x18                  0        8  
       BSEG_BYTES       0x20                  0       16  
       DATA             0x08     0xcb       196      128  
       ---------------- -------- -------- -------- --------
       TOTAL:           0x00     0xcb       204      128  
    *** ERROR: Internal memory overlap starting at 0x80.
    *** ERROR: Insufficient space in data memory.   76 bytes short.

    Stack starts at: 0xcc (sp set to 0xcb) with 52 bytes available

    Other memory:
       Name             Start    End      Size     Max    
       ---------------- -------- -------- -------- --------
       INDIRECT RAM     0x80     0x97        24      128  
       EXTERNAL RAM     0x0000   0x004d      78      256  
       ROM/EPROM/FLASH  0x0000   0x6526   25895    65536  

    I have already moved all global variables to the idata segment, so where on earth is the 196 byte in the data segment coming from?

    Is there some way to see what actually is put in the data segment so I can find out whats wrong?

    Any help is appreciated!

    Regards;
    /jb

     
    • Maarten Brock
      Maarten Brock
      2005-01-27

      Apart from the .mem you also get a .map file. This contains the allocation data you want to see.

       
      • Jonny Bergdahl
        Jonny Bergdahl
        2005-01-27

        OK, I find the following line:
        Area                               Addr   Size   Decimal Bytes (Attributes)
        --------------------------------   ----   ----   ------- ----- ------------
        DSEG                               0000   0080 =    128. bytes (REL,CON)

              Value  Global
           --------  --------------------------------
        ...
             000E    _save_resultstruct_sum_1_1
             0012    _save_resultstruct_i_1_1
             0014    _save_resultstruct_sloc0_1_0
             0018    _save_resultstruct_sloc1_1_0
        ..etc....

        The function is defined as:
        void save_resultstruct (void)

        The first two are the local variables sum and i, but what are the other two?

        Regards;
        /jb

         
    • Maarten Brock
      Maarten Brock
      2005-01-28

      Those are so-called spil-locations. Whenever the compiler has generated code for an intermediate result and needs more register space for the rest of a calculation, it spills the intermediate result from the registers into a spil-location (sloc). Thereby freeing the registers and able to continue.

       
      • Jonny Bergdahl
        Jonny Bergdahl
        2005-01-28

        OK, seems I have got a lot to learn about this compiler. I thought that data would end up in the stack.

        Thanks!
        /jb