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.
"I'm passing very little to my printf() functions"
Did you miss the point that C51 does not pass parameters on the stack...?
Hi Andy,
Ah, I think I have it. Does the 'linker listing file' have a .M51 extension? I think I've found the answer you may have been pointing to in the following excerpt:
LINK MAP OF MODULE: test_SD_Card (TEST) 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 0002H UNIT ?DT?DCFS16 IDATA 000AH 0006H UNIT ?ID?SD_CARD 0010H 0010H *** GAP *** BIT 0020H.0 0001H.1 UNIT _BIT_GROUP_ BIT 0021H.1 0000H.1 UNIT ?BI?DCFS16 0021H.2 0000H.6 *** GAP *** DATA 0022H 003AH UNIT _DATA_GROUP_ IDATA 005CH 0025H UNIT ?ID?DCFS16 IDATA 0081H 0025H UNIT _IDATA_GROUP_ IDATA 00A6H 0001H UNIT ?STACK * * * * * * * X D A T A M E M O R Y * * * * * * * XDATA 0000H 0400H UNIT ?XD?DCFS16
I think I get how the linker deals with overlayable storage from that. It looks to me as though everything is in order and that nothing is overlapping. So that's not my immediate problem with the apparently incompatible modules. Crumbs, I wonder what is then?
Hmm, I once tried to pass too many variables to a printf() funtion and bad things happened. I'm maybe getting confused with that having something to do with some tiny stack overflowing. It was a long time ago.
Thanks for the direction to the linker output, Andy. That's answered my immediate questions nicely.
The documentation will tell if printf() has limitations.
A printf() that does not use a general stack for the parameters will not be limited by the stack size. But it will have other limitations. For example number of registers and number of fixed memory locations that may be used.