ARM Technical Support Knowledge Articles

NOT ALL GLOBAL VARIABLES ARE INITIALIZED

Applies to: General Topics

Answer


Information in this article applies to:


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 uVision 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.

Article last edited on: 2004-05-10 15:37:10

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential