My project code area now is almost the chip size, so I want to move some global variable from Xdata to data to free some code area. But after I change some variable, the C51 compiler compalins the DATA overflow. I checked the .M51 file, the stack bottom is 0x8A, the chip idata ram is 256, so why the compiler can not automatically change some stack area to data area? Since I think the 0x8A stack is far from 0xFF. I just change one unsigned char variable.
cgha chris said:the chip idata ram is 256
But the DATA space is only half of that.
This is a physical feature of the hardware architecture - not specific to Keil:
https://www.keil.com/support/man/docs/c51/c51_le_intdatamem.htm
You need to search for the so-called "bible" for the 8051. It's getting harder to find - NXP (formerly Philips) no longer have it - but is still available; eg,
http://ecee.colorado.edu/~mcclurel/p8051arc.pdf
http://ecee.colorado.edu/~mcclurel/p8051hw.pdf
http://ecee.colorado.edu/~mcclurel/p8051pg.pdf
http://ecee.colorado.edu/~mcclurel/
Maybe time to consider a more modern architecture - without these restrictions ... ?
Thanks, I mixed the idata and data.