PlatformIO Community

How to use stm32duino build_opt.h in PlatformIO?

OK, reference to this article https://community.platformio.org/t/how-to-change-the-ram-size-in-platform/12554
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
iShot2020-04-18下午06.43.45
iShot2020-04-18下午06.42.37

I have no problems compiling a project with platformio.ini

[env:nucleo_l476rg]
platform = ststm32
board = nucleo_l476rg
framework = arduino
build_flags = 
	-DENABLE_HWSERIAL3
	-DPIN_SERIAL3_RX=PB11
	-DPIN_SERIAL3_TX=PB10

main.cpp

#include <Arduino.h>

void setup() {
	Serial3.begin(115200);
}

void loop() {
	Serial3.println("Hello world");
	delay(1000);
}
$ pio run 
Processing nucleo_l476rg (platform: ststm32; board: nucleo_l476rg; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/nucleo_l476rg.html
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)
PACKAGES: 
 - framework-arduinoststm32 4.10800.200207 (1.8.0) 
 - toolchain-gccarmnoneeabi 1.90201.191206 (9.2.1)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
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 ?
iShot2020-04-19下午01.01.37

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.