Technical Support

BL51: WARNING L16 (UNCALLED SEGMENT) ?C_INITSEG


Information in this article applies to:

  • C51 All Versions

QUESTION

I have written my own startup sequence, but now I keep getting the following linker warning:

*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
    SEGMENT: ?C_INITSEG

What is the problem?

ANSWER

The uncalled segment, ?C_INITSEG, is the name given to the global variable initialization code. This segment is automatically included when a program with initialized global or static variables. For example:

int i = 5;   // this generates an INITSEG table entry

int test (void)  {
  return (i);
}

RAM variable initializations generate table entries in the ?C_INITSEG segment. ?C_INITSEG is called at the end of the startup code to initialize global variables. Then, the main C function is invoked.

It seems that the ?C_INITSEG segment was included in the program linkage but was never invoked. There are several ways to solve this problem:

  1. If you use modified STARTUP code, make sure that you call ?C_START at the end of the CPU initialization. This executes the function that reads the ?C_INITSEG and then calls main. Source code for this function is provided in the file INIT.A51.
  2. You may use a separate function that initializes all your variables. For example:
    void init (void)  {
      i = 5;
    }
    

MORE INFORMATION

SEE ALSO

FORUM THREADS

The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Friday, November 16, 2007


Did this article provide the answer you needed?
 
Yes
No
Not Sure