Printf() function doesn't print floating point values even after the override

Dear mbed community!

I try to print floating point values with printf() therefore I created an mbed_app.json file like it is advised in this topic:

here is the implementation:

and here is my test code:

The problem is that it doesn’t work, instead printing the floating point values it prints nothing:

My board is an ST Nucleo L432KC and I’m using the Platformio plugin with VS Code on Windows 10.

Could you help me what I’m doing wrong or what shall I do to make this work?

I really appriciate your help!


Nucleo-l432KC with MbedOS 6.8 with Online Compiler and result is OK.
Did you tried re-build/clean build?

BR, Jan

Hi Jan,

Yes, I tried, sadly doesn’t work either.

Hello Adam,

Try to move the mbed_app.json file into the src (or .vscode) folder. Maybe it helps.

Best regards, Zoltan

Hi Zoltan,

I tried your suggestions, but it didn’t work, if I move the json file from the root directory than it won’t override the default printf so the serial monitor prints %f instead of the floating point value.

I have no experience with the Platformio neither with NUCLEO-L432KC so it was just a tip, which doesn’t seem to work :frowning:

Have you tried the online compiler as suggested by Jan to check weather it works also for you?

Another alternative is to keep the default minimal printf library and enable floating point print with the following mbed_app.json :

    "target_overrides": {
        "*": {
            "target.printf_lib": "minimal-printf",
            "platform.minimal-printf-enable-floating-point": true,
            "platform.minimal-printf-set-floating-point-max-decimals": 2


The target ST Nucleo L432KC MCU set “c_lib” to “small” configuration by default in the targets.json.

Therefore, you have to set standard C library in your mbed_app.json.

    "target_overrides": {
        "*": {
            "target.c_lib": "std",
            "target.printf_lib": "std"

I hope this helps.



Hi Toyo,

Many thanks it works!

BTW that is very interesting behavior… I have same result from MbedStudio and also from Online compiler, without changing the c_lib configuration.

BR, Jan