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.
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?