1.8.5 Bare machine C with floating-point processing

If you want to use floating-point processing in an application without the C library, there are a number of requirements you must fulfill.

These requirements are:

  • Re-implement __rt_raise() if you are using the heap.
  • Not define main(), to avoid linking in the library initialization code.
  • Write an assembly language veneer that establishes the register state required to run C. This veneer must branch to the entry function in your application. The register state required to run C primarily comprises the stack pointer.

    The register state also consists of sb, the static base register, if Read/Write Position-Independent (RWPI) code applies.

  • Provide your own RW/ZI initialization code.
  • Ensure that your initialization veneer is executed by, for example, placing it in your reset handler.
  • Use the appropriate FPU option when you build your application.
  • Call _fp_init() to initialize the floating-point status register before performing any floating-point operations.

Do not build your application with the -mfpu=none option.

Certain floating-point modes when used with software floating-point support require a floating-point status word. This is enabled by default in ARM Compiler 6, but you can disable it with the armclang command-line option -ffp-mode=fast. In such cases, you can also define the function __rt_fp_status_addr() to return the address of a writable data word to be used instead of the floating-point status register. If you rely on the default library definition of __rt_fp_status_addr(), this word resides in the program data section, unless you define __user_perthread_libspace() (or in the case of legacy code that does not yet use __user_perthread_libspace(), __user_libspace() ).
Non-ConfidentialPDF file icon PDF versionARM 100073_0607_00_en
Copyright © 2014–2017 ARM Limited or its affiliates. All rights reserved.