Keil Logo

Variable Initialization Code

The variable initialization files INITxxx.A51 contains the initialization routine for variables in the memory areas bit, data, idata, pdata, xdata, and far that were explicitly initialized. Variable initializations for the memory areas code and far const are directly inserted into the ROM image and do not require initialization by INITxxx.A51. The same is true for the memory type const xdata when you are using the XCROM directive.

Following is a list of the variable initialization files that are available.

The INIT_TNY.A51 file is a reduced version of INIT.A51 that may be used for projects that do not contain XDATA memory. You should use this file when you write code for single-chip devices, like the NXP LPC series, that contain variable initializations in data space.

Initialization File Description
INIT.A51 Generic initialization file for most 8051 devices.
INIT_TNY.A51 Reduced INIT.A51 used for projects that do not contain XDATA memory (for example NXP LPC devices).
INIT_MX.A51 Initialization file for NXP 80C51MX devices.

If your system is equipped with a watchdog timer, you can integrate a watchdog refresh into the initialization code using the watchdog macro. This macro needs to be defined only if the initialization takes longer than the watchdog cycle time. For example, if you are using an Infineon C515, the macro could be defined as follows:

WATCHDOG    MACRO
            SETB   WDT
            SETB   SWDT
            ENDM

If the C application contains variables in the far memory space that are initialized, you need to set the XBANK defined to 1in the initialization file.

  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.