Keil Logo

GENERAL: NOT ALL GLOBAL VARIABLES ARE INITIALIZED


Information in this article applies to:

  • C166 All Versions
  • C251 All Versions
  • C51 All Versions

QUESTION

I have a complex project setup and my variable initialization seems to stop somewhere in the middle of my application. It seems that the initialization table end marker is incorrectly located and therefore the initialization is not fully executed.

I have included the C compiler run-time libraries in my project setup. When I take this out everything works perfectly. What is the reason for the behavior?

ANSWER

The linker invocation list is derived from the µVision project file list. When you include the run-time libraries in your project list, you must ensure that they are included after all other files (even STARTUP and INIT).

For the C51 Compiler, it is important that you add the INIT.A51 file as last file in the project. When you have a project that uses code banking, you should ensure that this is the last source file in your project.

The C compiler run-time library contains the end marker for the variable initialization table. The linker adds modules in the same sequence they appear in the project list. Therefore, if the library is included in the middle of your module list, the variable end table marker will be in the middle of the initialization table. Files that are included in the file list AFTER the library (or INIT.A51 file) will not be initialized.

We recommend that you do not add the C run-time library to a project since the linker automatically detects the required library and adds them correctly.

FORUM THREADS

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

Last Reviewed: Monday, May 10, 2004


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.