Startup Files - 2024.2 English

Vitis Unified Software Platform Documentation: Embedded Software Development (UG1400)

Document ID
UG1400
Release Date
2024-11-13
Version
2024.2 English

The compiler includes pre-compiled startup and end files in the final link command when forming an executable. Startup files set up the language and the platform environment before your application code executes. Start up files typically do the following:

  • Set up any reset, interrupt, and exception vectors as required.
  • Set up stack pointer, small-data anchors, and other registers. Refer to the following table for details.
  • Clear the BSS memory regions to zero.
  • Invoke language initialization functions, such as C++ constructors.
  • Initialize the hardware subsystem. For example, if the program is to be profiled, initialize the profiling timers.
  • Set up arguments for the main procedure and invoke it.

Similarly, end files are used to include code that must execute after your program ends. The following actions are typically performed by end files:

  • Invoke language cleanup functions, such as C++ destructors.
  • Deinitialize the hardware subsystem. For example, if the program is being profiled, clean up the profiling sub-system.

The following table lists the register names, values, and descriptions in the C runtime files.

Table 1. Register Initialization in C Runtime Files
Register Value Description
r1 _stack-16 The stack pointer register is initialized to point to the bottom of the stack area with an initial negative offset of 16 bytes. The 16 bytes can be used for passing in arguments.
r2 _SDA2_BASE _SDA2_BASE_ is the read-only small data anchor address.
r13 _SDA_BASE_ _SDA_BASE is the read-write small data anchor address.
Other registers Undefined Other registers do not have defined values.

The following subsections describe the initialization files used for various application modes. This information is for advanced users who want to change or understand the startup code of their application.

For MicroBlaze, there are two distinct stages of C runtime initialization. The first stage is primarily responsible for setting up vectors, after which it invokes the second stage initialization. It also provides exit stubs based on the different application modes.