Keil Logo

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. If you have added STARTUP code (e.g. Startup.A51) to your project, make sure that it is the last OBJ file in the BL51/LX51 linker invocation. Only if you also add INIT.A51 to your project, the startup code must be the second last file followed by INIT. In µVision, the order of source files in the project window defines the order of OBJ files for the linker. Make sure that Startup.A51 and INIT.A51 are the last files.
  3. You may use a separate function that initializes all your variables. For example:

    void init (void)  {
      i = 5;
    }
    

MORE INFORMATION

SEE ALSO


Last Reviewed: Thursday, February 25, 2021


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.