This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

howto see what's in the data segment

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

Parents Reply Children
  • 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.