I think you are refering to Arm mbed: Serial.printf() fails to emit floats when using platformio - #5 by valeros. These flags absolutely work. They are not STM32 specific, they are specific to arm-none-eabi-gcc’s C library, so it applies to all ARM targets.
If I do
[env:adafruit_feather_m0]
platform = atmelsam
board = adafruit_feather_m0
framework = arduino
build_flags = -Wl,-u_printf_float
monitor_speed = 115200
monitor_dtr = 1
with code
#include <Arduino.h>
void setup() { Serial.begin(115200); }
void loop() {
char charBuf[20] = {};
float seconds = 1.3f;
sprintf(charBuf, "Ping: %.2f (s)", seconds);
Serial.println(charBuf);
delay(1000);
}
I get
--- Miniterm on COM6 115200,8,N,1 ---
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
Ping: 1.30 (s)
Ping: 1.30 (s)
So, no problems & no additional function needed. Just enable it in the C library.
If that still doesn’t work for you, post your complete platformio.ini.