PIO hates me! (Multiple ESP32 issue)

Ok first a little background… I’m coming from the Arduino IDE, and have this project that uses 3 microcontrollers: two M5Stack M5Dials (ESP32-S3 processor) and the third is a generic ESP32-S3 dev board.

I first brought the M5Dial project over (same project for both dial boards) and with some difficulty got it to compile and upload. Here’s the platform.ini for that project:

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[platformio]
default_envs = m5stack-stamps3

[env:m5stack-stamps3]
platform = espressif32
board = m5stack-stamps3
framework = arduino
;platform_packages = tool-esptoolpy@https://github.com/tasmota/esptool/releases/download/v4.7.4/esptool.zip								;Compiles but board stuck in boot loop
;platform_packages = tool-esptoolpy@https://github.com/tasmota/esptool/releases/download/v4.8.1/esptool.zip								;Compiles but board stuck in boot loop
platform_packages = framework-arduinoespressif32@https://github.com/espressif/arduino-esp32/archive/refs/tags/2.0.14.zip				;Worked before, now wont compile
;platform_packages = framework-arduinoespressif32@https://github.com/espressif/arduino-esp32/archive/refs/tags/3.0.7.zip				;Does not work

lib_deps = 
	m5stack/M5Dial
	m5stack/M5Unified
	m5stack/M5GFX
    ;m5stack/M5Dial@^1.0.2			;Same as arduino IDE 1/2025
    ;m5stack/M5Unified@^0.1.11		;Arduino IDE was at 0.2.2 1/2025
    ;m5stack/M5GFX@^0.1.11			;Arduino IDE was at 0.2.3 1/2025
	adafruit/Adafruit SHT31 Library
	adafruit/Adafruit VEML7700 Library
	adafruit/Adafruit BusIO
    yiannisbourkelis/Uptime Library

upload_speed = 921600
monitor_speed = 115200

;board_build.flash_mode = qio
;board_upload.flash_size = 8MB
board_build.partitions = default_8MB.csv
;board_upload.maximum_size = 8388608
board_build.filesystem = spiffs

build_flags = 
	-D ARDUINO_USB_CDC_ON_BOOT=1
	;-D SS=7			;These came from https://community.platformio.org/t/unable-to-compile-m5stack-factory-arduino-examples/36936/10 but appear not to be needed
	;-D MOSI=6
   	;-D MISO=5
   	;-D SCK=4

;upload_port = COM[68]
upload_port = COM8

Then I brought over the one for the generic ESP32-S3 dev board, and have been working on getting it to compile. But along the way I happened to try recompiling my M5Dial project and it suddenly would not compile!

First, the platformio.ini for the dev board project:

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:esp32-s3-devkitm-1]
platform = espressif32
board = esp32-s3-devkitm-1
framework = arduino

upload_speed = 921600
monitor_speed = 115200

lib_deps = 
    rtclib
    Arduino_JSON
    ESPAsyncWebServer
    yiannisbourkelis/Uptime Library
    uTimerLib
    EMailSender
upload_port = COM11

This is what the output looks like when the M5Dial project successfully compiles (the 2nd time after successfully compiling once - for the first compile the output of course is much longer):

Processing m5stack-stamps3 (platform: espressif32; board: m5stack-stamps3; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/m5stack-stamps3.html
PLATFORM: Espressif 32 (6.9.0) > M5Stack StampS3
HARDWARE: ESP32S3 240MHz, 320KB RAM, 8MB 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 @ 2.0.14 
 - tool-esptoolpy @ 1.40501.0 (4.5.1) 
 - toolchain-riscv32-esp @ 8.4.0+2021r2-patch5 
 - toolchain-xtensa-esp32s3 @ 8.4.0+2021r2-patch5
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 45 compatible libraries
Scanning dependencies...
Dependency Graph
|-- M5Dial @ 1.0.2
|-- M5Unified @ 0.2.2
|-- M5GFX @ 0.2.3
|-- Adafruit SHT31 Library @ 2.2.2
|-- Adafruit VEML7700 Library @ 2.1.6
|-- Adafruit BusIO @ 1.17.0
|-- Uptime Library @ 1.0.0
|-- WiFi @ 2.0.0
|-- OpenFontRender @ 1.2.0
|-- TFT_eSPI @ 2.5.43
|-- LittleFS @ 2.0.0
|-- uTimerLib @ 1.7.2
|-- Preferences @ 2.0.0
|-- SPI @ 2.0.0
Building in release mode
Retrieving maximum program size .pio\build\m5stack-stamps3\firmware.elf
Checking size .pio\build\m5stack-stamps3\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]  14.9% (used 48772 bytes from 327680 bytes)
Flash: [===       ]  31.2% (used 1044409 bytes from 3342336 bytes)

After that, all I have to do is switch my PIO project environment to the other project (the first time I do this it installs some stuff), and then switch the environment back to the M5Dial project. The output then looks like this:

Processing m5stack-stamps3 (platform: espressif32; board: m5stack-stamps3; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/m5stack-stamps3.html
PLATFORM: Espressif 32 (6.9.0) > M5Stack StampS3
HARDWARE: ESP32S3 240MHz, 320KB RAM, 8MB 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 @ 2.0.14 
 - tool-esptoolpy @ 1.40501.0 (4.5.1) 
 - toolchain-riscv32-esp @ 8.4.0+2021r2-patch5 
 - toolchain-xtensa-esp32s3 @ 8.4.0+2021r2-patch5
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 45 compatible libraries
Scanning dependencies...
Dependency Graph
|-- M5Dial @ 1.0.2
|-- M5Unified @ 0.2.2
|-- M5GFX @ 0.2.3
|-- Adafruit SHT31 Library @ 2.2.2
|-- Adafruit VEML7700 Library @ 2.1.6
|-- Adafruit BusIO @ 1.17.0
|-- Uptime Library @ 1.0.0
|-- WiFi @ 2.0.0
|-- OpenFontRender @ 1.2.0
|-- TFT_eSPI @ 2.5.43
|-- LittleFS @ 2.0.0
|-- uTimerLib @ 1.7.2
|-- Preferences @ 2.0.0
|-- SPI @ 2.0.0
Building in release mode
Generating partitions .pio\build\m5stack-stamps3\partitions.bin
Compiling .pio\build\m5stack-stamps3\lib82e\SPI\SPI.cpp.o
Compiling .pio\build\m5stack-stamps3\libe8d\Wire\Wire.cpp.o
Compiling .pio\build\m5stack-stamps3\libdaa\WiFi\WiFi.cpp.o
Archiving .pio\build\m5stack-stamps3\libe8d\libWire.a
Archiving .pio\build\m5stack-stamps3\lib82e\libSPI.a
Compiling .pio\build\m5stack-stamps3\libdaa\WiFi\WiFiAP.cpp.o
Compiling .pio\build\m5stack-stamps3\libdaa\WiFi\WiFiClient.cpp.o
Compiling .pio\build\m5stack-stamps3\libdaa\WiFi\WiFiGeneric.cpp.o
Compiling .pio\build\m5stack-stamps3\libdaa\WiFi\WiFiMulti.cpp.o
Compiling .pio\build\m5stack-stamps3\libdaa\WiFi\WiFiSTA.cpp.o
Compiling .pio\build\m5stack-stamps3\libdaa\WiFi\WiFiScan.cpp.o
Compiling .pio\build\m5stack-stamps3\libdaa\WiFi\WiFiServer.cpp.o
Compiling .pio\build\m5stack-stamps3\libdaa\WiFi\WiFiUdp.cpp.o
Compiling .pio\build\m5stack-stamps3\lib83b\FS\FS.cpp.o
Compiling .pio\build\m5stack-stamps3\lib83b\FS\vfs_api.cpp.o
Compiling .pio\build\m5stack-stamps3\lib678\SPIFFS\SPIFFS.cpp.o
xtensa-esp32s3-elf-g++: error: CreateProcess: No such file or directory
Compiling .pio\build\m5stack-stamps3\lib664\LittleFS\LittleFS.cpp.o
*** [.pio\build\m5stack-stamps3\lib678\SPIFFS\SPIFFS.cpp.o] Error 1
xtensa-esp32s3-elf-g++: error: CreateProcess: No such file or directory
*** [.pio\build\m5stack-stamps3\lib664\LittleFS\LittleFS.cpp.o] Error 1

I can fix the problem by going to the PlatformIO menu and uninstalling the Espressif32 platform. But shouldn’t these two projects be able to coexist?

Edited to add: the directories referenced in the errors when the project won’t compile exist, but have nothing in them. I also tried “Clean” and “Full clean”, neither fixes the issue.

Edit #2: you’ll notice the platformio.ini file for the M5Dial references version 2.0.14 of the arduino-esp32 board package. That is what M5Stack uses in their latest device support package. In the Arduino IDE I was using version 3.0.7 of the arduino-esp32 board package.

If I add

platform_packages = framework-arduinoespressif32@https://github.com/espressif/arduino-esp32/archive/refs/tags/2.0.14.zip

… to platformio.ini in the dev board project, the two projects seem able to coexist. But I’d much rather use a newer support package for the dev board if possible.

Long story short: Espressif32 Arduino 3.x is not supported officially by PlatformIO. But there is a community fork called pioarduino wich support the latest Espressif32 Arduino Core (3.1.1 at the moment of writing)

Try

platform = https://github.com/pioarduino/platform-espressif32/releases/download/53.03.11/platform-espressif32.zip

and remove platform_packages

Check this version table for more info

Unfortunately there is no “default” ESP32-S3 but many different variations available. Check this repo for the most common variations and their PlatformIO settings.

Thanks! That’s a lot of good info.

Someone on another forum actually suggested pioarduino but I’m a little unclear on what it is… does it replace PlatformIO? Does it support processors other than ESP32? ESP32 is what I’m mostly working on right now, but I do want the ability to work with other platforms.

Sigh… that didn’t seem to work. I assume I was to make those changes in the dev board (as opposed to M5Dial) project?

After doing so and switching to that project, I end up with this:

If I uninstall the Espressif 32 v53.3.11 platorm, the M5dial project will once again compile.

Oh and I tried switching to pioarduino, but that doesn’t seem to have helped either.

It is a platform you can use in PlatformIO.
For a description what a platform means see Development Platforms — PlatformIO latest documentation

Since pioarduino provides Espressif32 Arduino Core 3.x which is based on ESP-IDF 5.3 also the newer ESP32 series chips like C6 and H2 are supported.
See espressif/arduino-esp32/supported-chips

That’s totoally ok.
In contrast to ArduinoIDE you can specify the platform version and the libraries used versions per project. But platforms are installed globally.

If a platform is missing, PlatformIO will install the missing platform for you.

So you can have different platform versions in different projects:

Project A

platform = espressif32 @ 6.9.0

Project B

platform = https://github.com/pioarduino/platform-espressif32/releases/download/53.03.11/platform-espressif32.zip

(that means “use the espressif32 platform from this specific location” - if not installed yet, download & install the platform)

If no specific version is specified in your projects like so:

platform = espressif32

PlatformIO will pick the version with the highest number.
In case pioarduino 53.03.11 is installed it will be picked automatically because 53.0.3.11 > 6.9.0

If you want to force your M5dial project to Arduino version 2.0.14 you have to use platform = espressif32 @ 6.6.0 - See platform-espressif32 versions · GitHub

Thanks so much… that fixed the problem!

My concern was that the newer platform version might have been using the same folders as the old one, and overwritten files with newer versions or something like that.

But as soon as I specified the specific platform version for the M5Dial project, it started compiling with no issues.

1 Like