Data, idata confusion?

Hi,

I have 2 pieces of software that both independently work correctly. When combined, however, they don't seem to get on. I think my problem is concerned with memory space corruption. ie. one module's data overwriting the other's.

Here are some excerpts from the appropriate .LST files:

MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   2404    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   1024    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      2     114
   IDATA SIZE       =     37    ----
   BIT SIZE         =      1       2
END OF MODULE INFORMATION.

MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    894    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----      23
   IDATA SIZE       =   ----      44
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.

MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    326    ----
   CONSTANT SIZE    =    328    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----      18
   IDATA SIZE       =   ----      36
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


Can anybody please explain for me the difference between static and overlayable memory allocations? I'd like to know from the above how I can tell if I have filled either the DATA or IDATA memory spaces. How would I be certain that I am experiencing memory space corruption? My processor is an AT89C51AC2.

Regards,
Murray R. Van Luyn.

Parents
  • Static variables are those given fixed locations. Like globals and variables declared static. the rest (automatic variables) only exist while the function that declares them is in use. Most C friendly CPUs use the CPU's hardware stack for these variables. the RAM is reused after the function is exited.
    Since the 8052 has a tiny stack Keil calculates the addresses for these variables and determines which can be located in the same location (Overlaying).

    The compiler will handle this unless you are using function pointers, recursion, or calling functions from main and an interrupt.

    A more like issue is that you ran out of RAM and the Stack is over writing the variables.

Reply
  • Static variables are those given fixed locations. Like globals and variables declared static. the rest (automatic variables) only exist while the function that declares them is in use. Most C friendly CPUs use the CPU's hardware stack for these variables. the RAM is reused after the function is exited.
    Since the 8052 has a tiny stack Keil calculates the addresses for these variables and determines which can be located in the same location (Overlaying).

    The compiler will handle this unless you are using function pointers, recursion, or calling functions from main and an interrupt.

    A more like issue is that you ran out of RAM and the Stack is over writing the variables.

Children
More questions in this forum