Keil Logo

C51: Default Startup and Initialization Code


Information in this article applies to:

  • C51 Version 5.50a and later

QUESTION

I've compiled and linked my 8051 program. I noticed that there is some startup code and variable initialization code that's included in my program. Where did it come from?

ANSWER

The startup code is stored in the STARTUP.A51 file (found in the \C51\LIB directory).

The initialization code is stored in the INIT.A51 file (also found in the \C51\LIB directory).

These 2 files are executed before your main C function. Immediately after RESET, STARTUP is executed. STARTUP calls INIT which initializes your programs global variables. INIT then calls the main C function.

These 2 files are assembled and included in the Keil C library. If you do not copy and modify the STARTUP and INIT files and include them in your project, the linker automatically includes the default ones from the library.

SEE ALSO


Last Reviewed: Thursday, February 25, 2021


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  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.