ESP32 C3 on windows - This program will not run on your device

Hello, i tried to compile ultra simple program for ESP32 C3 (literally no code) on windows but I am getting this:

Which means it tries to download incompatible toolchain?

my ini file:

[env:esp32-c3-devkitc-02]
platform = espressif32
board = esp32dev

; change microcontroller
board_build.mcu = esp32c3
framework = arduino

I also tried different boards but result is the same, board is custom but schematic is super simple:
https://i.imgur.com/Ed9G2SH.png

Huh I’ve never seen that before. I assume this is Windows 11? Which IDE is this?

Maybe the toolchain is just corrupted, please remove all folders of the form

  • C:\Users\<user>\.platformio\packages\toolchain-xtensa*
  • C:\Users\<user>\.platformio\.cache

And rebuild the project.

This is windows 10, IDE is clion

I removed cache and all toolchains
ran
pio pkg update
but error still remains

this is full log of pio run

╰ pio run
Processing esp32-c3-devkitc-02 (platform: espressif32; board: esp32dev; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (6.4.0+sha.a9b9d09) > Espressif ESP32 Dev Module
HARDWARE: ESP32C3 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-builtin, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa) 
PACKAGES:
 - framework-arduinoespressif32 @ 3.20011.230801 (2.0.11)
 - tool-esptoolpy @ 1.40501.0 (4.5.1)
 - toolchain-riscv32-esp @ 8.4.0+2021r2-patch5
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 33 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio\build\esp32-c3-devkitc-02\src\main.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\FrameworkArduino\Esp.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\FrameworkArduino\FirmwareMSC.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\FrameworkArduino\FunctionalInterrupt.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\FrameworkArduino\HWCDC.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\FrameworkArduino\HardwareSerial.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\FrameworkArduino\IPAddress.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\FrameworkArduino\IPv6Address.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\FrameworkArduino\MD5Builder.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\FrameworkArduino\Print.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\FrameworkArduino\Stream.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\FrameworkArduino\StreamString.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\FrameworkArduino\Tone.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\FrameworkArduino\USB.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\FrameworkArduino\USBCDC.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\FrameworkArduino\USBMSC.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\FrameworkArduino\WMath.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\FrameworkArduino\WString.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\FrameworkArduino\base64.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\FrameworkArduino\cbuf.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\FrameworkArduino\esp32-hal-adc.c.o
Compiling .pio\build\esp32-c3-devkitc-02\FrameworkArduino\esp32-hal-bt.c.o
Odmowa dost\xa9pu.
Compiling .pio\build\esp32-c3-devkitc-02\FrameworkArduino\esp32-hal-cpu.c.o
Compiling .pio\build\esp32-c3-devkitc-02\FrameworkArduino\esp32-hal-dac.c.o
*** [.pio\build\esp32-c3-devkitc-02\FrameworkArduino\Esp.cpp.o] Error 1
Odmowa dost\xa9pu.
Odmowa dost\xa9pu.
*** [.pio\build\esp32-c3-devkitc-02\FrameworkArduino\FunctionalInterrupt.cpp.o] Error 1
*** [.pio\build\esp32-c3-devkitc-02\FrameworkArduino\FirmwareMSC.cpp.o] Error 1
Odmowa dost\xa9pu.
*** [.pio\build\esp32-c3-devkitc-02\FrameworkArduino\HardwareSerial.cpp.o] Error 1
Odmowa dost\xa9pu.
*** [.pio\build\esp32-c3-devkitc-02\FrameworkArduino\HWCDC.cpp.o] Error 1
Odmowa dost\xa9pu.
Odmowa dost\xa9pu.
*** [.pio\build\esp32-c3-devkitc-02\FrameworkArduino\IPv6Address.cpp.o] Error 1
*** [.pio\build\esp32-c3-devkitc-02\FrameworkArduino\IPAddress.cpp.o] Error 1
Odmowa dost\xa9pu.
Odmowa dost\xa9pu.
Odmowa dost\xa9pu.
Odmowa dost\xa9pu.
Odmowa dost\xa9pu.
*** [.pio\build\esp32-c3-devkitc-02\FrameworkArduino\USBMSC.cpp.o] Error 1
*** [.pio\build\esp32-c3-devkitc-02\FrameworkArduino\WString.cpp.o] Error 1
*** [.pio\build\esp32-c3-devkitc-02\FrameworkArduino\USBCDC.cpp.o] Error 1
*** [.pio\build\esp32-c3-devkitc-02\FrameworkArduino\esp32-hal-cpu.c.o] Error 1
*** [.pio\build\esp32-c3-devkitc-02\FrameworkArduino\base64.cpp.o] Error 1
*** [.pio\build\esp32-c3-devkitc-02\FrameworkArduino\esp32-hal-bt.c.o] Error 1
*** [.pio\build\esp32-c3-devkitc-02\FrameworkArduino\esp32-hal-dac.c.o] Error 1
*** [.pio\build\esp32-c3-devkitc-02\FrameworkArduino\cbuf.cpp.o] Error 1
*** [.pio\build\esp32-c3-devkitc-02\FrameworkArduino\esp32-hal-adc.c.o] Error 1

Open a PlatformIO core CLI and execute:

cd C:\Users\<user>\.platformio\packages\toolchain-riscv32-esp\bin
.\riscv32-esp-elf-g++ --version

What’s the output?

My pio packages are moved to E:/.platformio

powershell says its not valid executable for this operating system (windows 10 pro 64bit)

E:/.platformio/packages/toolchain-riscv32-esp/bin 
╰ .\riscv32-esp-elf-g++.exe --version
Program 'riscv32-esp-elf-g++.exe' failed to run: Wybrany plik wykonywalny nie jest prawidłową aplikacją tego systemu op
eracyjnego.At line:1 char:1
+ .\riscv32-esp-elf-g++.exe --version
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.
At line:1 char:1
+ .\riscv32-esp-elf-g++.exe --version
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [], ApplicationFailedException
    + FullyQualifiedErrorId : NativeCommandFailed

in windows bash there is nothing outputted
image

And trying same thing in CMD results in this popup that says app will not work on your system

So its clearly not valid toolchain

If a major toolchain was broken on Windows we’d know about it faster. “Works on my machine”

pio system info

What’s the output?

my system info

╰ pio system info
--------------------------  ------------------------------------------
PlatformIO Core             6.1.11                                    
Python                      3.9.10-final.0                            
System Type                 windows_amd64
Platform                    Windows-10
File System Encoding        utf-8
Locale Encoding             cp1250
PlatformIO Core Directory   E:\.platformio
PlatformIO Core Executable  E:\.platformio\penv\Scripts\platformio.exe
Python Executable           E:\.platformio\penv\Scripts\python.exe
Global Libraries            0
Development Platforms       16
Tools & Toolchains          65
--------------------------  ------------------------------------------

Oh. Actually I just notice that your platformio.ini is very weird. You take a ESP32 base board and change the microcontroller to ESP32C3, I don’t think it’s possible that way.

Can you just use

[env:esp32-c3-devkitc-02]
platform = espressif32
board = esp32-c3-devkitc-02
framework = arduino

instead?

This is really interesting, this is what i originally had: esp32-c3-devkitc-02
which you can probably guess from the env: name

now that i cleaned up the project pio did download new toolchain
pio run -t clean -e esp32-c3-devkitc-02
pio run

Tool Manager: Installing espressif/toolchain-riscv32-esp @ 8.4.0+2021r2-patch5
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Tool Manager: toolchain-riscv32-esp@8.4.0+2021r2-patch5 has been installed!
Verbose mode can be enabled via `-v, --verbose` option

now both platformio.ini works (esp32-c3-devkitc-02 and esp32dev)! Not sure why i had some bogus toolchain installed but it was installed when i created project (originally i’ve chosen esp32-c3-devkitc-02).

Now no matter what i do, it downloads correct toolchain, really weird. So I cannot reproduce problem anymore