PlatformIO Community

How to use stm32duino build_opt.h in PlatformIO?

OK, reference to this article
I have got it how to set the build flags to instead of the build_opt.h file,
but there’s some error occurs like the example, if the code without “=”, it will be compiled failed.
How shoud I change the code to aovid this?
official build_opt.h wiki

I have no problems compiling a project with platformio.ini

platform = ststm32
board = nucleo_l476rg
framework = arduino
build_flags = 


#include <Arduino.h>

void setup() {

void loop() {
	Serial3.println("Hello world");
$ pio run 
Processing nucleo_l476rg (platform: ststm32; board: nucleo_l476rg; framework: arduino)
Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: ST STM32 6.1.0 > ST Nucleo L476RG
HARDWARE: STM32L476RGT6 80MHz, 128KB RAM, 1MB Flash
DEBUG: Current (stlink) On-board (stlink) External (blackmagic, jlink)
 - framework-arduinoststm32 4.10800.200207 (1.8.0) 
 - toolchain-gccarmnoneeabi 1.90201.191206 (9.2.1)
LDF: Library Dependency Finder ->
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 11 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/nucleo_l476rg/src/main.cpp.o
Linking .pio/build/nucleo_l476rg/firmware.elf
Checking size .pio/build/nucleo_l476rg/firmware.elf
Building .pio/build/nucleo_l476rg/firmware.bin
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   0.9% (used 1116 bytes from 131072 bytes)
Flash: [          ]   1.1% (used 11872 bytes from 1048576 bytes)
============== [SUCCESS] Took 3.34 seconds =====================

Make sure to separate build flags by newline.

i find the difference between us,
there are some spaces int the start of every newline, but i don’t have it
so i think the “return” is necessary and the spaces too
do you agree with me ?

Oh, you haven’t put a space before the newline-separated options. Yes that’s must, you must follow the format given in the docs.