Looking for a clean way to depend on recent versions of framework arduino in a library

I’m trying to find a reasonably clean way to use newer versions of framework-arduinoespressif32

I received a bug report from a user of my library (Frugal-IoT), and it turned out their clean installation of PlatformIO, fully updated, gets espressif32 at 6.11.0 which gets framework-arduinoespressif32 version ~3.20017.0

I wasn’t seeing that bug since somewhere along the line I’d installed https://github.com/pioarduino/platform-espressif32.git#55.03.20 and my PlatformIO was defaulting to use that.

I was hoping there was a clean way to say that my library depended on the 3.3.2 framework (which includes a bug fix I submitted), but it seems that the line
``
platform=https://github.com/pioarduino/platform-espressif32.git#55.03.32
``

Has to be added by every USER of the library. - which is going to massively increase the chance of failure.

The weird thing is that 3.20017.0 doesnt seem to even get the versions that were live in Feb 2025 (when 3.2.0 was tagged). e.g. arduino-esp32/libraries/WiFi/src/WiFiType.h is missing WL_STOPPED which was added on 11 Nov 23, two years previously to 3.2.0 being tagged, but this fix is not in 3.20017.0

A user of my library wasted a day on this, and now I have, before figuring out what is going on - its totally non-trivial to debug given that you can’t just specify a framework in a platformio.ini file, you have to have previously downloaded that framework via the platform.

What I’d like to see - but is probably too much to hope for.

  • A way to mark a library as dependent on a certain framework or later (not via a GitHub link)
  • A way to put something like `platform_packages = framework-arduinoespressif32@3.3.2` and have it find and install that package independent of the espressif32 version
  • The default - fully updated - platform IO include fixes that have been in framework-arduino-espressif32 since November 2023 and ideally track the latest version at https://github.com/pioarduino/platform-espressif32

If no version is specified (platform = espressif32) the installed platform version with the highest number will be used. If you have used pioarduino in the past, this always be the highest version (“6.12.0” < “55.03.20”).

“3.20017.0” means “Espressif Arduino 2.0.17”! See here for an detailed overview of PlatformIO’s and pioarduino’s Espressif32-Platform versions and their respective Espressif32 Arduino Framework versions.
But all you can reference here is “arduino”. You can’t distinguish between PlatformIO’s and pioarduino’s Espressif Arduino.

This can be acheived by using the framework setting in library.json

This must be specified in the platformio.ini per project. It is not possible for a library to set this. Also this won’t work for the Espressif Arduino 3.x Framewok. That’s the reason why the community-fork “pioarduino” exists.

Please see Support Arduino ESP32 v3.0 based on ESP-IDF v5.1 · Issue #1225 · platformio/platform-espressif32

Thanks @sivar2311 -especially for that overview of the versioing, this is seriously non obvious, non obvious enough that two of us wasted a day each trying to fix the bug, and when we couldn’t figure it out, ChatGPT gave consistently wrong answers.

Why on earth doesn’t “update” do the logical thing and get you the most recent version - i.e. if 6.12.0 < 55.03.20 why doesn’t “update” get you “55.03.20” !

I’m pretty sure that almost everyone installing PIO for fresh is going to run into the problem of running on seriously out of date code while thinking they are running on the current latest version. - which is exactly what this user did - assert they absolutely had the latest version of everything,

Could you say more on using the framework setting in library.json, my library works on both esp8266 and ESP32, and I don’t see how I can tell it to use a particular version of the Arduino, those docs suggest that all I can do is "frameworks": "arduino”, Here is my library.json in case it helps.

Sorry - the nuance is part of what makes this so hard for even developers using PIO for a while to figure out. I’m not clear when you say “Also this won’t work for the Espressif Arduino 3.x Framework. That’s the reason why the community-fork “pioarduino” exists.” I’m not sure I know what the Espressif Arduino 3.x framework is, if it isn’t the stuff on pioarduino.

I am (now) using the pioarduino fork, or rather I’m trying to tell all users of the library to use it, but can’t figure out how to do this without an expectation that at least 50% will fail and have to call or message me.

I’ve posted a comment on your link, but really this nonsense is probably why a lot of less experienced developers are still using Arduino IDE, it’s 100x easier to get going. Using Arduino IDE feels like having one hand tied behind your back, but for simple tasks they are much more likely to succeed.

I’m not sure who controls PlatformIO but I’d happily move to a fork of it that fixed this nonsense, and suggest library users do the same!

What do you mean by “Update”? I was talking about specifiying the version to be used in the projects platformio.ini:

Unspecified version:

platform = espressif32

vs. specified (PlatformIO) version

patform = espressif32 @ 6.12.0

vs. external Platform (pioarduino)

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

That’s true, and unfortunately very confusing for new users. But the same issues would happen to someone who is using the ArduinoIDE with an outdated Espressif32 Arduino Framework (2.x). These people also need to install a newer version. In case of PlatformIO / pioarduino, this “update” is done by specifying one of the available pioarduino’s versions in the platformio.ini.

As written before, you cannot speficy the framework version to be used! All you can specify is the required framework (“arduino” in this case) and the platform (“esp8266”, "esp32).

So you should change your platform setting to "platforms" : ["esp8266", "esp32"] "platforms" : ["espressif8266", "espressif32"] as your library is made only for these platforms.

The settings platform = espressif32 @ 6.12.0 and platform_packages = framework-arduinoespressif32@3.3.2 in a PlatformIO project are not enough to make Espressif’s Arduino Framework 3.x work! If you want to use Espressif’s Arduino Framework 3.x you have to use the pioarduino fork.

Here is what I would do:

  • Create a section “PlatformIO” in the library’s readme with instructions
  • Create a PlatformIO example with a sample platformio.ini

Thanks again.

Sorry if I was unclear - by update I meant any of going to PlatformIo->Home->Platforms->Update or at the command line pio platform update orpio package update i.e. as with much debugging of bug reports, the first step is to get the reporter to update everything and try again.

Copilot/ChatGPT had suggested platform=https://github.com/platformio/platform-espressif32/releases/download/v54.3.20/platform-espressif32.zip but that generated 404’s since that specific Zip is no longer there, and we wasted a bunch of time trying to figure out a valid URL since https://github.com/platformio/platform-espressif32/releases/download is unreadable.

But the same issues would happen to someone who is using the ArduinoIDE with an outdated Espressif32 Arduino Framework (2.x).

I’ve never experienced those kind of failures on Arduino - it prompts to update, and in fact when I checked just now it prompted to upgrade to 3.3.2 automatically.

In PlatformIO the implication is that there are three ways to update, (as listed above), none of which actually get the current version. You have to magically know that you have to add the specific GitHub link to your platformio.ini

So you should change your platform setting to "platforms" : ["esp8266", "esp32"] as your library is made only for these platforms.

Understood, thanks for the suggestion and will do that in the next release. I had thought your suggestion was that there was some way to tweak the framework in library.json to force it to use the 3.3.2 version, but I understand now that is impossible.

If you want to use Espressif’s Arduino Framework 3.x you have to use the pioarduino fork.

OK - and if I understand correctly the text use the pioarduino fork means each user doing platform = https://github.com/pioarduino/platform-espressif32.git#55.03.32

• Create a section “PlatformIO” in the library’s readme with instructions * Create a PlatformIO examlpe with a sample platformio.ini

Sure I’m about to update the library’s /wiki page, and will point there from the README, I’ll also update all the examples (which are all PlatformIO) - in the next library release. It might work, though I’m not sure of the chances of people following this process when creating their own apps that use the library - especially since its the opposite of what most online resources, and ChatGPT etc tell them to do.

Hopefully there will be some success in getting whoever controls PlatformIO (is that Espressif) to support Arduino 3.x properly, but it sounds (from the conversation on the link you pointed me at in an earlier comment) that this has been going on for a few years with no success.

Rule #1: Don’t trust AI :wink:

The correct way would be

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

as it is stated in the pioarduio readme

or when specifiying a fixed version number like this:

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

(see the my list of available versions from the post before)

An apology - when you said to use the pioarduino fork, I thought you meant using that platform line to refer to use `platform-espressif32.git#55.03.32` Only when someone else responded to a query I made elsewhere did I understand there is a separate PIO extension, that replaces PlatformIO - that was not clear in what you said above, and hadn’t turned up in any searches either I or the user had done trying to solve this problem !

Yes, I also mean the platform-espressif32 by pioarduino. Unfortunately there is also a VS Code extention with the exact same name which is a bit confusing.

Personally I’m using VS-Code + PlatformIO Extension + pioaruino’s platform-espressif32.

Sorry, we crossed in the post.

Rule #1: Don’t trust AI :wink:

:slight_smile: Absolutely, but sometimes when you are completely stuck, nothing logically works, and searches turn up no useful help, its worth trying it.

I had never seen the pioarduino readme, I wasn’t trying to get ‘pioarduino’ which I presumed was just the name for an org maintaining one of the many parts of the complexity that make up the libraries needed.

Out of interest, why do you use PlatformIO extension versus PioArduino extension ?

I have been using PlatformIO for several years and have never needed to be independent of PlatformIO.

Understood and thanks for all your help - new version of the library just pushed :slight_smile:

Note - addign
``
platforms: [ “esp8266”, “esp32” ]
```
Caused it to ignore the library, not sure why so I put it back to platforms: “*”

Sorry for confusing you. The correct values would be “espressif32” and “espressif8266”.

1 Like