Arm mbed: Serial.printf() fails to emit floats when using platformio

Hello,

I’m using the latest version:

$ platformio --version
PlatformIO, version 2.10.1

which also has the latest mbed-platform (rev 14 - aka 121 in mbed versioning).

When I compile and run a very simple “hello world” type of program with the online mbed compiler (mbed org) I get this (expected) output:

Starting LED flashing every 0.200 sec
Exiting now - 3.142; 99; 2.768000

when using (exactly the same code) compiled with plaformio run, this is the output:

Starting LED flashing every  sec
Exiting now - ; 99;

so, float values are not emitted.

Does anyone have any idea why and a possible workaround?

The code is super-trivial and can be found here:
(this idiotic thing prevents me to place a link here - sorry have to disassemble it…)

gist github com / massenz / c38c34d6585bccc9d4104414b8a058a9

The link I was not allowed to post (LoL - it said “new users can only post 2 links” and I was not allowed to even post ONE!)

Hi @massenz! What is your board?

I am using the NXP LPC1768
https://developer.mbed.org/platforms/mbed-LPC1768/

Unfortunately, I don’t have this board to reproduce the issue, but could you please try to add next option to your platformio.ini:

build_flags = -Wl,-u,_printf_float,-u,_scanf_float

Thanks!

1 Like

oh, yeah, man!
that totally fixed it - thank you!!

:clap: :clap: :clap:

Lost 3h for searching what I’ve done wrong in my code, until I realised, it must be caused at compile level.
Thanks, worked like charm!!!

Hi @D3C0! What board do you work with? LPC1768?