Skip to main content
Knowledgebase
Home
Renesas Electronics America - Knowledgebase

To use mathematical functions for RZ projects_e² studio

Last Updated:09/06/2017

Question:

How can I use mathematical functions for RZ projects on e² studio?

Answer:

Mathematical functions such as sin( ) are provided as a part of GNU Toolchain library.
FAQ 3000063 : GNU compilers for e² studio

Refer to this FAQ for details about GNU Toolchains available for RZ devices.
Besides the #include <math.h> declaration in your source code, the following configurations are required to use the math library, depending on toolchains.

[for GNURAM-NONE EABI Toolchain]
  Choose "math.h" at the time of creating a project, or enable "math.h" at configuration of "Header Files" in the Library Generator category.

[for GNU ARM Embedded Toolchain]
  To link libm.a (math library), configure the Linker option as follows.
  * Add "m" in the Libraries(-l) box.  (This corresponds to linker option "-lm".)
  * Specify "${TC_INSTALL}/arm-none-eabi/lib" in the Library search path (-L).

See this manual for details about GNU math library functions.
https://www.gnu.org/software/libc/manual/html_node/Mathematics.html

To utilize the hardware math processor (VFP), you also need VFP initialization code.
Sample code of initialization is available here.
(See the "vfp_init_asm.s" file for details about VFP.)
Suitable Products
e² studio
RZ Family
  • Was this article helpful?