C51: AVOIDING STARTUP INITIALIZATION OF STATIC VARIABLES
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:
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.
The following Discussion Forum threads may provide information related to this topic.
Last Reviewed: Tuesday, October 24, 2006
of your data.