|ARM Technical Support Knowledge Articles|
Applies to: C51 C Compiler
Information in this article applies to:
I have some static and global variables which I am initializing when I declare them. When I run my program the variables are not initialized.
On stepping through the startup code it appears that the first byte of ?C_INITSEG - where all the initial values are stored - is set to 00H and this causes the initialization code to terminate prematurely.
The module INIT.A51 contains the initialization table terminator (=0). If this module is explicitly linked to an application, it must be the last module included in the linkage so that the terminator is located at the end of the initialization table. Usually, the linker takes the INIT module out of the libraries and automatically locates it at the right position.
Some customers have reported this problem when using Microsoft Make. By converting their project to use uVision the problem was resolved. It appears that in the process of converting the project, the INIT.A51 file was excluded (and was automatically included from the library) or was placed at the end of the file list.
Include the module INIT.A51 in your project only if you have modified it. If you need it, drag it to the very bottom of the µVision project window. If you use a linker command file, specify the INIT.OBJ file as the last module.
Article last edited on: 2004-05-10 15:43:11
Did you find this article helpful? Yes No
How can we improve this article?