2018-11-20 12:16 AM
Each time I add __FPU_PRESENT and AMR_MATH_CM4 to symbols to get project compile properly, yet getting 30 warning about __FPU_PRESENT redefined.
Project is made straight-forward: configure pins, select TrueStuido, pressing "generate code". Opening project in TrueStudio, build. Getting errors, adding __FPU_PRESENT and AMR_MATH_CM4 to symbols, building again with warnings.
Solved! Go to Solution.
2018-11-26 11:44 PM
__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 */
JW
2018-11-20 02:56 PM
I ran into the same thing last week.
In the CMSIS 5 version of the processor file, there is a #define __FPU_PRESENT which is the redefinition the compiler is complaining about.
I'm using the STM32F411CE, so, for me, this file is called stm32f411xE.h and it is located at:
<your installation specific>\CMSIS\Device\ST\STM32F4xx\Include\stm32f4
If you include your version of stm32f411xE.h in your C code where it is necessary, then you won't need to add __FPU_PRESENT at the command line. You will still need to add ARM_MATH_CM4 because that is for CMSIS math.
Apparently, this is a change from CMSIS 4 and vendors haven't updated the tool chains for this change.
2018-11-22 07:58 AM
Hi @Georgy Moshkin ,
To more understand the faced issue, could you please precise the following:
Thanks
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2018-11-22 08:08 AM
It's ARM, not AMR
Pretty sure you don't need to define them explicitly, the compiler should be doing this if the Core and FPU settings are coherent with having hardware floating point support. ie cpu=cortex-m3 isn't going to get you there, neither will SoftFP settings.
Bringing in the normal .H files for the parts should allow this to work, look at the defines pushed into the compiler command line more critically.
2018-11-22 11:39 PM
Hi @Georgy Moshkin
Could you please attach your ioc it will be helpful to get the issue's root cause
2018-11-26 07:56 PM
I could not reproduce the problem, my old *.ioc are converted to TrueStudio projects and compile without errors.
2018-11-26 08:54 PM
The issue is that __FPU_PRESENT is now defined in the CMSIS device files. I've attached an example of the header file. Just search it for "__FPU_PRESENT".
In Georgy's case (and my case), when we defined __FPU_PRESENT on the compiler command line, there is a redefinition because it is also defined in the CMSIS device file.
2018-11-26 11:44 PM
__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 */
JW
2018-11-27 10:19 AM
Thank you! I've been wondering how this suddenly became an issue and your detective work completely answers it!
ST needs to add the guard back because it is creating an issue on Embedded Studio, too.