C51 returns the following error:
*** ERROR C249: 'DATA': SEGMENT TOO LARGE
Rather than switching to the COMPACT or LARGE memory model I would like to manually declare some variables into xdata. I would however like to know what the compiler is actually putting in the data segment and what is taking up the most space. Is there some way I can get this information in the absence of the .MAP file?
Thanks,
Stijn
About the linker: it doesn't come into play. The compiler (C51) returns the error and only generates an .LST file, so I have nothing to run the linker on.
I have yet to see the compiler return "data segment too large", but quite often seen the linkr do it
Well given the error number/format it certainly looks to be a compiler generated error, so one might assume it's trying unsuccessfully to juggle some resources to make the C work. The Keil description of this error lacks any real useful insight to it's source.
Break the source into smaller pieces, observe if the error points at a particular line, or can be otherwise isolated in the .LST or bisection.
Given the special needs of the 8051 processor, it's quite easy for the compiler to spot a single object file that alone adds more data than what may fit. Why wait for the linker to confirm? It's even likely that Keil has one-byte offset values in the object file format and already there knows that they have no free offset values to assign to the pre-linked data object offsets.
When porting code from other compilers, it's meaningful to locate arrays and larger structs and tag them for XDATA storage and leave DATA for smaller variables.