# Floating point support

The ARM C Compiler generates ARM Floating Point instructions to perform floating point operations.

The ARM's floating point instruction set is supported either by an attached floating-point coprocessor (hardware coprocessors 1 and 2) or by an instruction emulator entered from the undefined instruction trap.

Normally the floating point instruction emulator is installed by the environment in which the program is executing. However, for a completely standalone application the program can install the floating point emulator itself. This is described in the following paragraphs.

The ARM Floating Point instruction set Emulator (FPE) is supplied with the ARM C system as a linkable object file. Its environmental dependencies are all via a stub, supplied as an assembly language source. This stub file, fpestub, documents how to attach an FPE to the invalid instruction trap location (address 0x4).

It is intended that the FPE and the fpestub be linked together with whatever else is required to make a standalone module on the target hardware. The fpestub contains two entries for initialisation (attachment to the invalid instruction trap vector) and finalisation (removal from the invalid instruction trap vector). These should be called on activation and deactivation, respectively, of the standalone module.

For testing purposes, the FPE, fpestub and a test application can be linked together to make a single, standalone application. The application must call __fp_initialise before using any floating point instructions, and __fp_finalise before exiting.