Error on Build (Windows): AttributeError: 'SConsEnvironment' object has no attribute 'ElfToBin'

When Building on Windows 10, with VSCode, using built in PIO

CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/heltec_wifi_kit_8.html
PLATFORM: Espressif 8266 2.3.3 > Heltec Wifi kit 8
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash      
PACKAGES:
 - tool-esptool 1.413.0 (4.13)
 - tool-esptoolpy 1.20800.0 (2.8.0)
 - toolchain-xtensa 1.40802.0 (4.8.2)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
AttributeError: 'SConsEnvironment' object has no attribute 'ElfToBin':
  File "C:\Users\me\.platformio\penv\lib\site-packages\platformio\builder\main.py", line 156:
    env.SConscript("$BUILD_SCRIPT")
  File "C:\Users\me\.platformio\packages\tool-scons\script\..\engine\SCons\Script\SConscript.py", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\me\.platformio\packages\tool-scons\script\..\engine\SCons\Script\SConscript.py", line 286:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\me\.platformio\platforms\espressif8266\builder\main.py", line 218:
    target_firm = env.ElfToBin(
======================================================================================== [FAILED] Took 0.43 seconds ========================================================================================
The terminal process terminated with exit code: 1

platformio.ini contents:

[env:heltec_wifi_kit_8]
platform = espressif8266
board = heltec_wifi_kit_8
;upload_protocol = esptool

Similar questions have pointed to multiple instances of PIO but PIO isn’t present in the system python.

Any ideas?

1 Like

You have not selected a framework in the PlatformIO, so it probably hasn’t registered any internal handlers for the compilation process. If you want to use Arduino, just add

framework = arduino

to the platformio.ini, together with a main.cpp with the minimal functions setup() and loop() of course.

Or are you attempting to do a bare-metal build for the ESP8266 without any frameworks?

1 Like

That was exactly it and in retrospect that should have been obvious… Many thanks! (Trying to migrate my experimental workflows from the regular Arduino IDE to PIO)

Maybe this needs a more helpful error?