This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

What is the purpose of the preprocessor define FLOAT_ABI_HARD in nRF52840 projects?

What is the purpose of the define FLOAT_ABI_HARD?  I'm seeing it defined in some nRF52840 projects.  I can't seem to find any documentation on it.

Parents Reply Children
  • Thanks.

    I suppose I should have elaborated.  (I had already done more than a quick google search before posting here.)  I'll be more specific and elaborate.

    I noticed this define in one version of our build, but not in another.

    I searched our entire source tree, including the nRF SDK and libraries (we're using V15.0.0).  I found no references.

    We're using KEIL as our toolchain.  I wondered if it might be some sort of compiler option.  I searched all the KEIL documentation I could find.  No references found.  I contacted KEIL support.  They also couldn't find any references.  They use command line options to select between hard and soft floats, not preprocessor defines.  A deep google search for the FLOAT_ABI_HARD identifier only found hits on Nordic web sites.  We decided it must be a Nordic thing.

    Finally I did a comparison of our binary image when compiled with and without the define.  There was no difference.  It doesn't seem to do anything.

    It looks like it should be OK to simply delete the define.  But, not knowing exactly what it's for, I thought I would try and ask here before doing so.

  • Hey,

    I also can't seem to find where this is being used except for one place, task manager.

    Check the sdk/components/libraries/experimental_task_manager folder. Inside the task_manager_core_x.s file, there seems to be a use of FLOAT_ABI_HARD macro.

    Other than that, I can't find where else it is used.

  • Hi.

    You should not remove this define.

    This is an implicit define in the ARM ABI definitions. Please read this link, he has explained it quite well.

    This define specifies which compiler options that are used when compiling a project. Nordic uses ARM processors which uses the hard floating points architecture.

    owl-wy7n said:
    I searched our entire source tree, including the nRF SDK and libraries (we're using V15.0.0).  I found no references.

     

    It is defined in the preprocessor symbol only, it is not used in the SDK, only in the ARM specific project settings. The compiler understands this.

    owl-wy7n said:
    It looks like it should be OK to simply delete the define.  But, not knowing exactly what it's for, I thought I would try and ask here before doing so.

     The problem with deleting this define is that even if you don't use the floating point units (FPU), the libraries in the SDK are built with this architecture, and you will get an conflicting CPU architecture and it will not work.

  • Hey,

    So, this preprocessor actually defines the architecture of the ARM processor in use and has nothing to do with the usage of FPU?

  • Hi.

    The floating arithmetic can be done both in the FPU or the CPU. On the CPU it takes many more instructions for processing the same information as in the FPU. The given preprocessor instructs the compiler on how to process your float arithmetic. The FPU is still there in the chip, the Application decides whether to use it or not or a combination by instructing the compiler using this preprocessor.

     Best regards,

    Andreas

Related