Associate III
August 12, 2019
Question
Cannot use printf with floats on a Cube generated System Workbench project for STM32F429i discovery board.
- August 12, 2019
- 14 replies
- 4890 views
Used cube to generate a project with default settings for STM32F429I disco board plus CMSIS V2 RTOS and USART 2 half duplex transmit only . Generated the code for System Workbench.
I retargeted _write() and provided __io_putchar(). I added -u _printf_float to the linker flags.
In the StartDefaultTask I added
float fVal = 345.678;
printf("Hello World\r\n");
printf("fVal %f\r\n",fVal);
Output
Hello World
fVal . !
Issues
With -specs = nosys.specs -specs= nano.specs -u _printf_float - printf causes a hard fault.
With specs = nosys.specs -specs -u _printf_float - 1st printf OK 2nd printf produces incorrect output
