cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H743: sprintf not working in newlib_nano after upgrade from HAL 1.3 to 1.6

PMath.4
Senior III

Not a question but a statement. I've just upgraded a very large project from HAL V1.3 to V 1.6. The code uses sprintf in a couple of places. This worked fine under 1.3 using newlib_nano. Under 1.6 the same statement gives a NULL return. Swapping to newlib_standard fixes the issue. It appears that the version of newlib_nano distributed under 1.6 has changed and is no longer reliable, at least for floats.

1 ACCEPTED SOLUTION

Accepted Solutions
PMath.4
Senior III

Seems to be a CubeMX change - Just been through the project properties and the old version had "-u _printf_float" in Project -> Properties -> C/C++ Build -> Settings -> MCU Linker -> Miscellaneous.

The new version didn't. I'm pretty sure I didn't put it there

Anyway the solution is to put "-u _printf_float" in Project -> Properties -> C/C++ Build -> Settings -> MCU Linker -> Miscellaneous

View solution in original post

4 REPLIES 4
berendi
Principal

newlib is not part of HAL, it's distributed with the toolchain.

PMath.4
Senior III

Seems to be a CubeMX change - Just been through the project properties and the old version had "-u _printf_float" in Project -> Properties -> C/C++ Build -> Settings -> MCU Linker -> Miscellaneous.

The new version didn't. I'm pretty sure I didn't put it there

Anyway the solution is to put "-u _printf_float" in Project -> Properties -> C/C++ Build -> Settings -> MCU Linker -> Miscellaneous

newlib is not part of STMCubeMX either. There are no C/C++ build settings in CubeMX.

You mean STM32CubeIDE, don't you?

PMath.4
Senior III

"You mean STM32CubeIDE, don't you?"

No, I use Attolic, but the project was created by CubeMX which sets the project properties THUMB2, FP, etc.

I now understand the newlib library was "provided" by the toolchain but it is CubeMX that sets the default properties when you create a project from scratch