Hello
I'm writing application for AT89S52 microcontroller and using SDCC to compile. Now I have come to a point where I can't declare anymore global variables or else ASLink will complain about being "unable to get 21 consecutive bytes in internal RAM for area DSEG". Here's the memory layout from a compilation that worked:
Internal RAM layout: 0 1 2 3 4 5 6 7 8 9 A B C D E F
0x00:|0|0|0|0|0|0|0|0|b|b|c|c|c|c|c|c| 0x10:|c|d|Q|Q|Q|Q|Q|Q|Q|Q|Q|Q|Q| | | | 0x20:|B|B|T|a|a|a|a|a|a|a|a|a|a|a|a|a| 0x30:|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a| 0x40:|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a| 0x50:|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a| 0x60:|a|a|a|a|a|a|a|a|a|a|a|e|e|e|e|e| 0x70:|e|e|e|e|e|e|e|e|e|e|e|e|e|e|e|e| 0x80:|I|I|I|I|I|I|S|S|S|S|S|S|S|S|S|S| 0x90:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S| 0xa0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S| 0xb0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S| 0xc0:|S|S|S|S|S| | | | | | | | | | | | 0xd0:| | | | | | | | | | | | | | | | | 0xe0:| | | | | | | | | | | | | | | | | 0xf0:| | | | | | | | | | | | | | | | | 0-3:Reg Banks, T:Bit regs, a-z:Data, B:Bits, Q:Overlay, I:iData, S:Stack, A:AbsoluteStack starts at: 0x86 (sp set to 0x85) with 122 bytes available.
Now, if I declare one more global char variable, I get this dreaded error although there seems to be plenty of free space at the end (stack size is set to 63 to make more room for DSEG). Why? Is it possible to move the I-segment so that it starts at say 0xA0 and S-segment (stack) at 0xA7?
I tried these command line options:
--stack-size 63 --stack-loc 0xA7 --no-pack-iram --data-loc 0x23
--idata-loc 0xA0
But now it gives me another error message: "Insufficient space in data memory. 21 bytes short."
I thought that there would be 0xA0-0x23 = 125 bytes long DSEG when using those command line options, but it doesn't seem to be the case?
TIA.