Yes, this is possible. As you can see in the builder code
#
# SDK
#
if "PIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK3" in flatten_cppdefines:
env.Append(
CPPDEFINES=[("NONOSDK3V0", 1)],
LIBPATH=[join(FRAMEWORK_DIR, "tools", "sdk", "lib", "NONOSDK3V0")]
)
elif "PIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK221" in flatten_cppdefines:
#(previous default)
env.Append(
CPPDEFINES=[("NONOSDK221", 1)],
LIBPATH=[join(FRAMEWORK_DIR, "tools", "sdk", "lib", "NONOSDK221")]
)
elif "PIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190313" in flatten_cppdefines:
env.Append(
CPPDEFINES=[("NONOSDK22x_190313", 1)],
LIBPATH=[join(FRAMEWORK_DIR, "tools", "sdk", "lib", "NONOSDK22x_190313")]
)
elif "PIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_191024" in flatten_cppdefines:
This file has been truncated. show original
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