**** Advance Notice ****

This site will be closed on 31 December 2015,

Important Information for users of NXP LPCXpresso

This site is for users of Code Red branded products.

NXP LPCXpresso users should visit the LPCXpresso FAQ's for up-to-date information relevant to that product.

Cortex-M4 Floating Point Support

Most ARM-based systems have historically not implemented any form of floating point in hardware. This means that any floating point operations contained in your code will be converted into calls to library functions that then implement the required operations in software.

However many Cortex-M4 based MCUs incorporate a single precision floating point hardware unit. Note that not all Cortex-M4 based MCU implement floating point in hardware, so please check the documentation provided by the MCU vendor to confirm if the MCU you are using does.

Also be aware that the optional Cortex-M4 floating point unit implements single precision operations (C/C++ float) only. Thus if your code makes use of double precision floating point (C/C++ double), then any such floating point operations contained in your code will still be converted into calls to library functions that then implement the required operations in software.

Floating Point variants

When a hardware floating point unit is implemented, ARM define that it may be used in one of two modes.

Currently Code Red's only provides support for SoftABI usage, and only supplies libraries that use SoftABI. Libraries that support HardABI are planned for implementation in a future release.

When you use a project wizard for a Cortex-M4 where a hardware floating point unit may be implemented, there will be an option to enable the use of the hardware within the wizard's options. Selecting this will make the appropriate changes to the compiler, assembler and linker settings to cause SoftABI code to be generated. It will also enable code within the startup code generated by the wizard that will turn the floating point unit on.

Note though that in some MCU families, some MCUs may not provide hardware floating point, even though most of the members of the family do. Thus it is a good idea to double check the documentation, even if the project wizard in Code Red's IDE for the family that you are targeting suggests that hardware floating point is available.


Please note that even though the project wizard will create Cortex-M4 projects configured to use the SoftABI mode of hardware floating point, it is possible to manually modify the compiler/assembler/linker settings in Project Properties to cause a switch to the use of HardABI mode. This will result in link time errors, as appropriate HardABI library variants are not currently provided by Code Red.

CM4_FloatingPoint (last edited 2012-09-12 13:05:21 by CrSupportAb)