-
On top of the previous hands-on of printf, let's add the following code into USER CODE Block 2 to print out message containing floating number:
/* USER CODE BEGIN 2 */ printf("TEST: pi = %f\n\r", 3.1415926); /* USER CODE END 2 */
-
"Build Project" --> "Debug As --> 2 STM32 C/C++ Application" to enter Debug Perspective.
-
Go back to the code added in step 1, there is a warning bug icon in front of the code and tells us to enable linker flag -u _printf_float:
-
Enable linker flag -u _printf_float:
-
Let's run "Build Project" --> "Debug As --> 2 STM32 C/C++ Application" to run the code again and you will see the result is a bit better (at least a floating number is printed out) but still wrong while in the meantime LD1 toggling is working well.
-
Open "STM32F746NGHX_FLASH.ld" in project folder and change _estack from 0x2004ffff to 0x20050000.
-
Let's run "Build Project" --> "Debug As --> 2 STM32 C/C++ Application" to run the code again and finally get the expected result:
Note: this issue has been widely discussed in ST Community: