We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I am using a TI TUSB3200 (8052 core + USB & audio I/O) and am having trouble with an L107 ADDRESS SPACE OVERFLOW error message when linking. I use the standard STARTUP.A51 with IDATALEN = 100H, as recommended for 8052. It is being linked in so I would assume the linker sees the IDATALEN declaration. Below is a link map of when I chop out enough variables so that the internal data segment is below 128 bytes. If I add any more variables, I get the Overflow error. I would understand if I was pushing the 256-byte limit but the linker seems to choke at the 128-byte boundry. I cannot imagine the stack is using all that extra data memory space.. Suggestions?
LINK MAP OF MODULE: .\Output\TUSB3200 (CODEC) * * * * * * * D A T A M E M O R Y * * * * * * * REG 0000H 0008H ABSOLUTE "REG BANK 0" DATA 0008H 000CH UNIT ?DT?MAIN DATA 0014H 000BH UNIT ?DT?USBENG 001FH 0001H *** GAP *** BIT 0020H.0 0002H.5 UNIT ?BI?DEVICE BIT 0022H.5 0000H.2 UNIT ?BI?USBENG BIT 0022H.7 0000H.2 UNIT ?BI?SOFTPLL BIT 0023H.1 0000H.1 UNIT ?BI?CODEC BIT 0023H.2 0000H.1 UNIT ?BI?MAIN BIT 0023H.3 0000H.1 UNIT _BIT_GROUP_ 0023H.4 0000H.4 *** GAP *** DATA 0024H 0022H UNIT ?DT?DEVICE DATA 0046H 0020H UNIT ?DT?USB DATA 0066H 000BH UNIT ?DT?SOFTPLL DATA 0071H 000AH UNIT _DATA_GROUP_ IDATA 007BH 0001H UNIT ?STACK * * * * * * * C O D E M E M O R Y * * * * * * *
Hi, I think 128 bytes is the upper limit for DATA. If you want to add more variable, they must be IDATA or XDATA. Your stack is fine. it only takes what's left over after all your variables. Best regard, Frank Hu
The equate IDATALEN in STARTUP.A51 is just code. It affects the initialization of the internal memory space. It has nothing to do with limits the linker may set on the size of your idata space. From the link map you posted, it seems that your data space (0-7FH) is nearly full. So, you only have 132 bytes of idata left (variables plus stack), starting from 07BH. If you have more than about 128 bytes of idata declared, then it would seem that the linker message is appropriate. Note that the idata space is the same as data space for addresses less than 80H. At 80H or above, direct addressing gets you into the SFR space, while indirect addressing gets you to an extra 128 bytes of RAM (in most 8051 variants). There's only 256 bytes of internal address space available; not 256 bytes of idata, plus 128 bytes of data, plus 128 bytes of SFRs.
Thanks for the replies. I understand the difference between the direct-addressed SFR space vs. indirect-addressed IDATA space above 80H. I guess to clarify my question, how do I get the C compiler to allocate my variables into the IDATA space without causing a link error? thanks Jeff
To place variables in idata, you must explicitly tell the compiler where you want the variable to go. For example:
idata unsigned int x[10];
That fixed it. Thanks! Jeff