The mb-gcc compiler requires the GNU C standard
library and the GNU math library. Vivado ships
precompiled versions of these libraries. 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 need to use, look in the following folder:
$XILINX_/gnu/microblaze/<platform>/microblaze-xilinx-elf/lib
Compiler flags and configurations for compiling the library determine filename encoding. 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. Double-precision floating-point can fail to fully use the optional single-precision floating-point features on MicroBlaze.
The newlib math libraries have alternate versions that implement these math functions using single-precision arithmetic. It is possible for single-precision libraries to make direct use of the MicroBlaze processor hardware floating point unit (FPU) and can therefore perform better.
If 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.