General Program Options - 2023.2 English

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

Document ID
UG1400
Release Date
2023-12-13
Version
2023.2 English
-msmall-divides
This option generates code optimized for small divides when no hardware divider exists. For signed integer divisions where the numerator and denominator are between 0 and 15 inclusive, this switch provides very fast table-lookup-based divisions. This switch has no effect when the hardware divider is enabled.
-mxl-gp-opt
If your program contains addresses that have non-zero bits in the most significant half (top 16 bits), then load or store operations to that address require two instructions.

The MicroBlaze processor ABI offers two global small data areas that can each contain up to 64 KB of data. Any memory location within these areas can be accessed using the small data area anchors and a 16-bit immediate value, needing only one instruction for a load or store to the small data area. This optimization can be turned on with the -mxl-gp-opt command line parameter. Variables of size less than a certain threshold value are stored in these areas and can be addressed with fewer instructions. The addresses are calculated during the linking stage.

Important: If this option is being used, it must be provided to both the compile and the link commands of the build process for your program. Using the switch inconsistently can lead to compile, link, or runtime errors.
-mno-clearbss
This option is useful for compiling programs used in simulation.

According to the C language standard, uninitialized global variables are allocated in the .bss section and are guaranteed to have the value 0 when the program starts execution. Typically, this is achieved by the C startup files running a loop to fill the .bss section with zero when the program starts execution. Optimizing compilers also allocates global variables that are assigned zero in C code to the .bss section.

In a simulation environment, the above two language features can be unwanted overhead. Some simulators automatically zero the entire memory. Even in a normal environment, you can write C code that does not rely on global variables being zero initially. This switch is useful for these scenarios. It causes the C startup files to not initialize the .bss section with zeroes. It also internally forces the compiler to not allocate zero-initialized global variables in the .bss and instead move them to the .data section. This option might improve startup times for your application. Use this option with care and ensure either that you do not use code that relies on global variables being initialized to zero, or that your simulation platform performs the zeroing of memory.

-mxl-stack-check
With this option, you can check whether the stack overflows when the program runs.

The compiler inserts code in the prologue of the every function, comparing the stack pointer value with the available memory. If the stack pointer exceeds the available free memory, the program jumps to a the subroutine _stack_overflow_exit. This subroutine sets the value of the variable _stack_overflow_error to 1.

You can override the standard stack overflow handler by providing the function _stack_overflow_exit in the source code, which acts as the stack overflow handler.