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

C249 : 'DATA' : SEGMENT TOO LARGE

i obtain this message "C249 : 'DATA' : SEGMENT TOO LARGE" when i build my program; i dont know what's the problem can you give me the solution ?
thanks for your help.

  • The DATA memory space is limited to 128 bytes by the 8051 architecture. This error is telling you that you have more than 128 bytes allocated in DATA.

    You should note that this 128 byte area must contain your register banks and the stack in addition to any variables that you have declared.

    A quick fix for this error might be to change your memory model. The default SMALL memory model causes variables to be allocated from DATA. Changing this to another setting will cause the compiler and linker to allocate your variables from XDATA instead.

    Note: this will correct the compiler error, but you should read the sections of the manuals regarding memory spaces and memory models. Assiging variables to XDATA when building for a target that has no external RAM won't work, and not all 8051 derivitaves[sic] have the full 128 bytes of internal RAM.

    Good luck -

    Dave

  • Addendum: Also examine the possibility of changing your memory model for specific functions, especially infrequently-called functions that have large local variable requirements.

    Global variables are also to be avoided. Not only are they poor programming practice, but the space that is allocated for a global variable is not overlayed; that is, it is reserved all the time and makes for an ineffecient use of the 8051's already limited resources.