|ARM Technical Support Knowledge Articles|
Applies to: C51 C Compiler
Information in this article applies to:
I have a C function which contains some xdata static variables. When the device is reset I do not want the locations those variables are stored at to be initialized to 00H by the startup code. How can that be achieved?
The file STARTUP.A51 includes the code for initialization of data memory and is included with every project if required. By default the XDATA is not initialized however the STARTUP.A51 file allows this to be easily configured.
The easiest way to avoid initialization of static or global variables is by performing the following steps:
xdata static unsigned int foo _at_ 0xF3C1;
If you include all your static variables in a single structure then you can absolutely locate that structure rather than every single variable.
Note that you need to copy INIT.A51 to your project directory and modify it if you want to remove initialization of all global variables.
Article last edited on: 2006-10-24 13:43:36
Did you find this article helpful? Yes No
How can we improve this article?