Nios II Custom Instruction User Guide

ID 683242
Date 4/27/2020
Document Table of Contents
Give Feedback

6.6. Building the FPH2 Example Software

The Software Build Tools (SBT) are used to create Intel® HAL-based Board Support Packages (BSP) and application and library makefiles for embedded software running on a Nios II. These tools come in command-line and Eclipse GUI-based forms.

When these tools are used to generate a BSP for a Nios II with the FPH2 component connected to that Nios II, the sw.tcl file in the component causes the BSP and any applications or libraries that use that BSP to be aware of the presence of the FPH2. In particular, sw.tcl performs the following functions:
  • Examines the system you created in Platform Designer, and determines the correct GCC flags for your floating point hardware.
  • Creates makefile rules to pass the -mcustom-<operation> options to GCC, so it knows to use the available FPH2 operations instead of the software emulation code to implement the specified floating point operations.
  • Creates makefile rules to pass the -fno-math-errno option to GCC, to eliminate the overhead of detecting NaN results and setting the errno variable for calls to sqrtf().
  • Adds #define macro declarations to system.h for the newlib math library routines that GCC does not reliably replace with custom instructions. For more information, refer to "C Macros for round(), fmins(), and fmaxs()".
  • Creates makefile rules to generate a correct version of newlib. Uses the GCC flags determined from your hardware system.
Note: If you modify your floating point hardware configuration, you must regenerate and rebuild your BSP to ensure that newlib is built correctly.