The mb-gcc
compiler requires the GNU C standard library and the GNU math
library. Precompiled versions of these libraries are shipped with Vivado. The CPU driver for MicroBlaze copies over the
correct version, based on the hardware configuration of MicroBlaze.
To manually select the library version that you would like to use, look in the following
folder:
$XILINX_/gnu/microblaze/<platform>/microblaze-xilinx-elf/lib
The filenames are encoded based on the compiler flags and configurations used to compile the library. For example, libc_m_bs.a is the C library compiled with hardware multiplier and barrel shifter enabled in the compiler.
The following table shows the current encodings used and the configuration of the library specified by the encodings.
Encoding | Description |
---|---|
_bs | Configured for barrel shifter. |
_m | Configured for hardware multiplier. |
_p | Configured for pattern comparator. |
Of special interest are the math library files (libm*.a). The C standard requires the common math library functions (sin()and cos(), for example) to use double-precision floating point arithmetic. However, double-precision floating point arithmetic may not be able to make full use of the optional, single-precision floating point capabilities in available for MicroBlaze.
The newlib math libraries have alternate versions that implement these math functions using single-precision arithmetic. These single-precision libraries might be able to make direct use of the MicroBlaze processor hardware floating point unit (FPU) and could therefore perform better.
If you are sure that your application does not require standard precision, and you want to implement enhanced performance, you can manually change the version of the linked-in library.
By default, the CPU driver copies the double-precision version (libm_*_fpd.a) of the library into your IP integrator project.
To get the single precision version, you can create a custom CPU driver that copies the corresponding libm_*_fps.a library instead. Copy the corresponding libm_*_fps.a file into your processor library folder (such as microblaze_0/lib) as libm.a.
When you have copied the library that you want to use, rebuild your application software project.