[SOLVED] How to resolve "__FPU_PRESENT is redefined" when CMSIS 5 CMSIS-CORE Library or CMSIS 5 CMSIS-DSP Library values are set to Yes

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] How to resolve "__FPU_PRESENT is redefined" when CMSIS 5 CMSIS-CORE Library or CMSIS 5 CMSIS-DSP Library values are set to Yes

    This applies to the ST processors. It may/may not apply to other vendors.

    When you set Project Options->Libraries->CMSIS 5 CMSIS-[CORE|DSP] Library to Yes, the build environment adds a -D__FPU_PRESENT to the c compiler command which ends up being a redefinition of __FPU_PRESENT which is in STM32F411xE.h and similar ST header files.

    To fix this, I looked at the <ProjectName>.ind file in the output directory which contains the list of files the linker is supposed to use. Found the CMSIS library file - in my case it was: arm_cortex_math_v7em_fpv4_sp_d16_hard_t_le_eabi.a and added the path to it: $(PackagesDir)/CMSIS_5/CMSIS/Lib/ES/arm_cortex_math_v7em_fpv4_sp_d16_hard_t_le_eabi.a to Project Options->Linker-Additional Input Files.

    Then I set Project Options->Libraries->CMSIS 5 CMSIS-[CORE|DSP] Library to use Inhereted value which is No. Since these options are set to No, the IDE doesn't add a -D__FPU_PRESENT to the c compiler command which resolves the redefinition issue.

    Until there is a way to tell the IDE to not define __FPU_PRESENT for CMSIS_5, please use this with caution.
  • Hello,

    Thank you for your report.
    It seems that the CMSIS DSP library has changed its behaviour from V4 to V5 which the ST packages are not compatible to.
    We will investigate this further and update the ST packages if needed.
    Until then we recommend using CMSIS 4 for the ST packages.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • There is a thread on the ST forum about this issue with other tool chains. Looks like ST got rid of the guard?

    waclawek.jan (Community Member)
    10 hours ago__FPU_PRESENT has always been defined in the CMSIS-mandated device headers, except that it used to be guarded. For example, this is from stm32f4xx.h from the SPL era
    #if !defined (__FPU_PRESENT)
    #define __FPU_PRESENT 1 /*!< FPU present */
    #endif /* __FPU_PRESENT */