Skip to main content

 none
RT app with hard float? RRS feed

  • Question

  • It looks like the default settings for a real-time app (on the M4F cores) uses these options

    -mcpu=cortex-m4 -mfloat-abi=soft -mthumb

    What is the reason the soft floating point support is used by default rather than the hard float-abi option?

    How can I override the default setting to use hard float?

    Saturday, November 16, 2019 11:31 AM

Answers

  • I'm going to answer my own question.

    The default .cmake file is located in C:\Program Files (x86)\Microsoft Azure Sphere SDK\CMakeFiles

    You want to edit AzureSphereRTCoreToolchain.cmake and change this line:

    SET(CMAKE_C_FLAGS_INIT "-mcpu=cortex-m4")

    to:

    SET(CMAKE_C_FLAGS_INIT " -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16")

    • Marked as answer by Jeremy_K Sunday, November 17, 2019 10:48 PM
    Sunday, November 17, 2019 10:48 PM

All replies

  • if your compiler support hard float for cortex-M4 ... must work, try:

    -mfloat-abi=hard -mfpu=fpv4-sp-d16

    Saturday, November 16, 2019 1:38 PM
  • Yeah, that will work if I build it from the command line.

    But how do I override the default options using the CMake files?

    Sunday, November 17, 2019 6:24 AM
  • I'm going to answer my own question.

    The default .cmake file is located in C:\Program Files (x86)\Microsoft Azure Sphere SDK\CMakeFiles

    You want to edit AzureSphereRTCoreToolchain.cmake and change this line:

    SET(CMAKE_C_FLAGS_INIT "-mcpu=cortex-m4")

    to:

    SET(CMAKE_C_FLAGS_INIT " -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16")

    • Marked as answer by Jeremy_K Sunday, November 17, 2019 10:48 PM
    Sunday, November 17, 2019 10:48 PM
  • Hi Jeremy,

    Glad to hear that you have found a workaround. Appreciate for sharing the resolution, this would certainly benefit other community members.

    Monday, November 18, 2019 4:40 AM
    Moderator