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

Uncalled Segment/DATA overflow


Does anyone know how to avoid a data segment overflow caused by the local data for uncalled functions being permanently allocated? Better still to prevent such functions being included in the final output at all?

I am using Keil C51 V6.

Thanks
Simon Fisher

  • Are they really not called, or just calls that the linker can't "See;" eg, Interrupt Service Routines?

    If they really aren't called, why are you building them!?

    Could you put your locals in PDATA or XDATA?

    Take a look at App Note 129, "Function Pointers in C51" and knowledge base article, "C51: Problems with function pointers overwriting variables"
    http://www.keil.com/support/docs/210.htm
    They include some examples on how to manually adjust the overlaying yourself


  • Sorry I didn't explain myself very well. I meant function that aren't actually used at all, and are there because more than one project uses the same source file, some functions being required by one project and not the other. The problem is that the local (auto) data in an uncalled function is being allocated out of DATA (not DATA_GROUP). It would also be nice if uncalled functions were not included in the ROM image at all.

  • How about some #ifs to prevent building functions not required for the particular project?

    Or maybe move the functions to separate files, so that each project only includes those files which it actually needs.

    Otherwise, my previous suggestions of moving the locals or manually adjusting the overlaying?

  • ...some functions being required by one project and not the other

    If you know what modules are going to use the specific function, can't you use pre-processing to enable or disable the function in question?

    #ifdef i_want_it
    //Yor fuction here
    #endif

    - Alex

  • If used frequently it is a good practice to build a custom library and header file. Then the linker will include only the required function modules, unused will not be initialized and included in your ROM file.