ESP8266 how to choose firmware

Yes, this is possible. As you can see in the builder code

Your wanted option of

Thus corresponds to adding

build_flags = 
   -D PIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK221

in the platformio.ini.

If you execute the build in verbose mode (via VSCode “Verbose Build” or pio run -v) you can also double-check that by making sure the final linker command has

-L <arduino-esp8266 framework path>/tools/sdk/lib/NONOSDK221 

in it. It’s also a good idea to check if the macro was successfully defined from the build script, so e.g. do

#if NONOSDK221 == 1
Serial.println("Non-os SDK 2.2.1 is activated");
#else
Serial.println("Other SDK version activated...");
#endif
3 Likes