2023-12-17 03:43 AM
/**
******************************************************************************
* @file : main.c
* @author : Auto-generated by STM32CubeIDE
* @brief : Main program body
******************************************************************************
* @attention
*
* Copyright (c) 2023 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
#include <stdint.h>
#include <stdio.h>
#if !defined(__SOFT_FP__) && defined(__ARM_FP)
#warning "FPU is not initialized, but the project is compiling for an FPU. Please initialize the FPU before use."
#endif
int main(void)
{
printf("Hello world");
return 0;
}
// // //
Why does this warning show up every time I create a project. Is it something important, how do I get rid of it if I need to. I checked the settings and I initialized the FPU in properties.
Solved! Go to Solution.
2023-12-17 04:00 AM - edited 2023-12-17 04:43 AM
what did you set in the code generator in cube ?
your "main" looks totally wrong - not generated for a cube/HAL stm32 project.
should look like mine here:
so try: make new stm32 project, maybe for F407 - disco board (i suppose, you have this, as i do), change nothing, just generate code. then look, what it looks like...and only write your code between "user code begin...// ...end " comments.
+ printf ... you know, where it should print to? better just toggle a LED as a first test. not print...to nowhere.
+
read first :
https://www.st.com/resource/en/user_manual/um2609-stm32cubeide-user-guide-stmicroelectronics.pdf
2023-12-17 04:00 AM - edited 2023-12-17 04:43 AM
what did you set in the code generator in cube ?
your "main" looks totally wrong - not generated for a cube/HAL stm32 project.
should look like mine here:
so try: make new stm32 project, maybe for F407 - disco board (i suppose, you have this, as i do), change nothing, just generate code. then look, what it looks like...and only write your code between "user code begin...// ...end " comments.
+ printf ... you know, where it should print to? better just toggle a LED as a first test. not print...to nowhere.
+
read first :
https://www.st.com/resource/en/user_manual/um2609-stm32cubeide-user-guide-stmicroelectronics.pdf
2023-12-17 05:25 AM - edited 2023-12-17 05:26 AM
How many times it must be told repeatedly to not post a code as an image? Here is a list of damage done by doing so:
Also the written text is meant to be read by others. Therefore at least the most basic things like capital letters and sentences should be used reasonably. By writing hardly readable flow of words, you are disrespecting the time and effort required by other people.
2023-12-17 06:58 AM - edited 2023-12-17 06:58 AM
Code to enable should be in SystemInit(), that way main() won't fault if you have float or double auto variables in there. Or constructors using floats.
2023-12-17 08:07 AM
The tool settings allow the compiler to generate FPU instructions but you still need to enable it within the code itself.
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
SCB->CPACR |= ((3UL << 10 * 2) |
(3UL << 11 * 2)); /* set CP10 and CP11 Full Access */
#endif