Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Platform, Toolchain, Compiler/GCC, C++ Versions #4509

Open
TripleWhy opened this issue Jan 21, 2025 · 11 comments
Open

Update Platform, Toolchain, Compiler/GCC, C++ Versions #4509

TripleWhy opened this issue Jan 21, 2025 · 11 comments

Comments

@TripleWhy
Copy link
Contributor

Is your feature request related to a problem? Please describe.
I'm always frustrated when I'm trying to work with the code.

Describe the solution you'd like
I would like to

  • use as few different platform, toolchain, compiler and c++ versions as possible,
  • upgrade the C++ version to at least C++17 for all environments,
  • upgrade to platform version to the latest working one,
  • upgrade the compiler to the latest possible version.

Describe alternatives you've considered
Keeping everything as is is an option. Upgrading only parts of the above are options.

Additional context
There are some things I have been wanting to work on for time, but I don't want to deal ancient compilers and c++ versions. Currently we are bound to C++11 (except for esp8266, which compiles using C++17). Additionally, some of the compilers are so old, they lack support some basic flags and pragmas, such as changing optimization level for specific functions.

So far, when asking about this, I have gotten some vague answers there used to be some issues with some combinations of boards and platform version, but never any specifics. So, I would like this issue to be used to document:
a) what those issues are exactly, so that they can be tested with newer versions of things.
b) what would need to happen for this to work. For example: Wait for bug x to be fixed; drop support for older board y; upgrade only compiler but not platform for environment z.

With this documented, it should then be possible to discuss and estimate the impact and amount of work that would be, as well as what parts can or cannot be upgraded.

@TripleWhy TripleWhy changed the title Update Platform, Toolchain, Compiler/GCC, C++ Version Update Platform, Toolchain, Compiler/GCC, C++ Versions Jan 21, 2025
@netmindz netmindz added this to the 0.16.0 candidate milestone Jan 22, 2025
@netmindz
Copy link
Collaborator

In general I'm in favour. One thing I would say is that because of the complex relationship between the various different parts of the platform I would advise caution from creating something too bespoke as franky many of the default options are riddled with bugs so we don't want to introduce more issues.

So for example, using a different compiler than expressif expect could cause all sorts of fun.

Therefore we need to prioritise upgrading to standard configurations first, which in turn will be limited by the libraries we use as there are many breaking changes between Arduino 2 and 3 and also esp-idf 4 and 5

@blazoncek
Copy link
Collaborator

I think that changing toolchain is the easiest and safest option. This will include new compiler and other tools.

@netmindz
Copy link
Collaborator

netmindz commented Jan 23, 2025

Recent discussion mentoring updates to C++

#4484 (comment)

@blazoncek
Copy link
Collaborator

Recent discussion mentoring updates to C++

I think that was exactly related to this issue (or this issue is a result from that discussion). ESP32 env uses ancient gcc and working around that (by forcing newer standards via compiler options) may be prone to bugs. Upgrading toolchain may get us newer compiler (for better or worse yet to be determined).

@TripleWhy
Copy link
Contributor Author

So for example, using a different compiler than expressif expect could cause all sorts of fun.

This is exactly the kind of vague comment I am trying to demystify here. What exactly are these sorts of fun? Without that knowledge, we can't really judge if anything improved with newer versions.

The last time I tried building wled using newer toolchains for esp32, everything seemed to work fine for what I was trying to do.

@DedeHai
Copy link
Collaborator

DedeHai commented Jan 23, 2025

This is exactly the kind of vague comment I am trying to demystify here. What exactly are these sorts of fun? Without that knowledge, we can't really judge if anything improved with newer versions.

espressif core libraries are written and tested using a specific toolchain I am guessing. From what I have seen in those libraries they are not programmed that well or at least not as thorough as they should be. So using a different toolchain some timings might change, which can lead to unexpected behaviour or non-working peripherals. This is the "all sorts of fun". You never know what you get. But in any case, it is worth a shot but since configurations and combinateions are almost endless, it may be hard to find edge cases.

@netmindz
Copy link
Collaborator

So, please forgive my ignorance, but first question

Do we get any of the newer options we are looking for in the V4 vs V3 platform? If not, does the latest V4 do any better Vs our current one?

(I'm keen to ensure we first eliminate the official options before using unsupported combinations of language versions, compiler versions etc)

@TripleWhy
Copy link
Contributor Author

Using IDF 4.4.4 upgrades gcc from 5.2.0 (July 16, 2015) to 8.4.0 (March 4, 2020) on esp32.

Does it add some of the missing flags/pragmas? IIRC, it does.
Does it upgrade from c++11 by default? No. AFAICT, at the time of writing, no upstream version does that.
Does it bring anything up to date, or even into the support window? No.
Does it upgrade to full c++17 support if used with -std=gnu++17? No, but it improves support.

@TripleWhy
Copy link
Contributor Author

According to discord, the ESPHome guys are actively trying to get away from platformio because apparently, they stopped publishing updates for ESP platforms. Is that a path we could/should look into, too?

Will try to find what and how they do/did it, later.

On a related note... do we actually need arduino?

@DedeHai
Copy link
Collaborator

DedeHai commented Jan 25, 2025

On a related note... do we actually need arduino?

yes, many commands and libraries depend on it.

@netmindz
Copy link
Collaborator

The fork I believe you are referring to is used to get Arduino Core V3 and ESP-IDF V5

Both of which contain breaking changes for the libraries that WLED is heavily dependent on.

We will however be using this platform when we come to add support for C6 and P4 chips. See MoonModules work in this area for more details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants