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

ESP32S3 using very old toolchain #1435

Open
m-mcgowan opened this issue Aug 5, 2024 · 30 comments
Open

ESP32S3 using very old toolchain #1435

m-mcgowan opened this issue Aug 5, 2024 · 30 comments

Comments

@m-mcgowan
Copy link

m-mcgowan commented Aug 5, 2024

I have a PlatformIO project that I've been working on for several weeks. It's been working fine, but last week (around 1st August) the project stopped compiling.

xtensa-esp32s3-elf-g++: error: unrecognized command line option '-std=gnu++2b'; did you mean '-std=gnu++2a'?

This is the relevant part of platformio.ini

framework = arduino
platform = https://github.com/platformio/platform-espressif32.git
;platform_packages = espressif/toolchain-xtensa-esp32s3
board = esp32-s3-devkitm-1
build_type = debug
build_flags = ${env:arduino.build_flags}  -DARDUINO_USB_MODE -DARDUINO_USB_CDC_ON_BOOT

When building, the toolchain selected is an old version:

PACKAGES: 
 - framework-arduinoespressif32 @ 3.20017.0 (2.0.17) 
 - tool-esptoolpy @ 1.40501.0 (4.5.1) 
 - toolchain-riscv32-esp @ 8.4.0+2021r2-patch5 
 - toolchain-xtensa-esp32s3 @ 8.4.0+2021r2-patch5

I have tried uninstalling and reinstalling the latest version of toolchain-xtensa-esp32s3 but the PIO build continues to use the old version.

Running pio pkg update shows that all dependencies are already up to date.

I added

platform_packages = espressif/toolchain-xtensa-esp32s3

which then uses the latest version of the toolchain ([email protected]+20230208), and does build the .elf file, but results in many warnings like:

/Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/port/xtensa/include/freertos/portmacro.h:614:1: warning: ignoring attribute 'section (".iram1.24")' because it conflicts with previous 'section (".iram1.22")' [-Wattributes]
  614 | {

and during linking,

warning: .pio/build/esp32s3/firmware.elf has a LOAD segment with RWX permissions
pio --version
PlatformIO Core, version 6.1.15

python --version
Python 3.12.4

I've also deleted the ~/.platformio directory and the project's .pio directory but no change in behavior.

@m-mcgowan
Copy link
Author

I also have an environment that targets both arduino and esp-idf, which fails with this error:

CMake Warning at /Users/mat/.platformio/packages/framework-espidf/tools/cmake/crosstool_version_check.cmake:8 (message):
  Toolchain
  /Users/mat/.platformio/packages/toolchain-xtensa-esp32s3/bin/xtensa-esp32s3-elf-gcc
  version 12.2.0 is not the supported version 8.4.0.  Check Getting Started
  documentation or proceed at own risk.

Call Stack (most recent call first):
  /Users/mat/.platformio/packages/framework-espidf/components/esp_common/project_include.cmake:6 (gcc_version_check)
  /Users/mat/.platformio/packages/framework-espidf/tools/cmake/build.cmake:334 (include)
  /Users/mat/.platformio/packages/framework-espidf/tools/cmake/build.cmake:543 (__build_process_project_includes)
  /Users/mat/.platformio/packages/framework-espidf/tools/cmake/project.cmake:476 (idf_build_process)
  CMakeLists.txt:3 (project)


CMake Error at /Users/mat/.platformio/packages/framework-espidf/tools/cmake/crosstool_version_check.cmake:37 (message):
  

  Toolchain:
  /Users/mat/.platformio/packages/toolchain-xtensa-esp32s3/bin/xtensa-esp32s3-elf-gcc,
  crosstool-ng version esp-12.2.0_20230208 doesn't match supported version
  esp-2021r2-patch5

@Jason2866
Copy link
Contributor

It is not possible to freely choose the toolchain version.

@m-mcgowan
Copy link
Author

I understand. But then something must have changed in the package, because this was working fine a week ago - I'm building from a known good commit hash.

@valeros
Copy link
Member

valeros commented Aug 7, 2024

Hi @m-mcgowan, unfortunately, the toolchain version is tightly coupled to the framework version, so you cannot change it arbitrarily.

@valeros valeros closed this as not planned Won't fix, can't repro, duplicate, stale Aug 7, 2024
@m-mcgowan
Copy link
Author

I feel there's a miscommunication here and that this issue should be kept open. My build was working fine a week ago, with nothing unusual in the platformio.ini file. What used to be a good known build no longer works.

I have an environment for compiling the code for the arduino framework, and another environment that targets arduino and esp-idf. Both of these had been working fine, with C++23 support, but no longer do so. If I knew how to pin the versions of the packages/frameworks to what being selected as default prior to last week that would most likely provide a suitable workaround.

I have found a workaround that doesn't involve pinning versions, which, although far less than ideal, I am happy to share, but I feel this should be addressed at the source, either in this package, or in the espressif Arduino IDF component dependency, or whereever the fix is required. Notwithstanding that, at the very least, I would appreciate some help getting back to a reliable build by pinning versions of frameworks/packages.

I am not very familiar with the inner workings of the PIO frameworks, packages and toolchains, and despite my research of the changes in the past week I was not able to find a solution.

I am working on a project that has been in development for several months, for which I advocated PlatformIO. My workaround can support continued development, but I will not be able to release the software later this year with that workaround.

It is not possible to freely choose the toolchain version.

To be clear, I was not choosing the toolchain version and was just using the latest, which had C++23 (gnu++2b) support. platformio.ini has not changed in the meantime, yet the build is now broken with missing support for gnu++2b and the concepts headers. Since the source code hasn't changed, I can only assume it's something in the PIO frameworks/packages that has changed, or perhaps in the PIO core.

I would truly appreciate some help from anyone that knows the PIO ecosystem better than I do.

@valeros
Copy link
Member

valeros commented Aug 8, 2024

@m-mcgowan please share here your entire platformio.ini file.

@valeros valeros reopened this Aug 8, 2024
@brightproject
Copy link

brightproject commented Aug 8, 2024

My trouble.

platformio.ini

[env:esp32-s3-devkitc1-n16r8]
; platform = espressif32 @ 5.3.0
platform = espressif32 @ 6.6.0
board = esp32-s3-devkitc1-n16r8
framework = arduino
monitor_speed = 115200
monitor_port = COM6
upload_speed = 921600
upload_port = COM22
monitor_filters = esp32_exception_decoder

PLATFORM: Espressif 32 (6.6.0) > Espressif ESP32-S3-DevKitC-1-N16R8V (16 MB Flash Quad, 8 MB PSRAM Octal)
HARDWARE: ESP32S3 240MHz, 320KB RAM, 16MB Flash
DEBUG: Current (esp-builtin) On-board (esp-builtin) External (cmsis-dap, esp-bridge, 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.20014.231204 (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

@Jason2866
Copy link
Contributor

@brightproject Dont hijack this issue with something unrelated.

@m-mcgowan
Copy link
Author

@brightproject Dont hijack this issue with something unrelated.

I believe this is the same problem. The old toolchain is now being used, where it wasn't previously.

@m-mcgowan
Copy link
Author

m-mcgowan commented Aug 12, 2024

Here's a minimal example:

[env:esp32s3]
; This used to work just fine, but no longer recognizes -std=gnu++2b
framework = arduino
platform = espressif32
board = esp32-s3-devkitm-1
build_flags = -std=gnu++2b 
build_unflags = -std=gnu++11

[env:esp32s3_working]
; This works with some caveats:
; Warnings about IRAM sections
; gdb is not found out of the box (workaround is to manually copy from the gdb package to the esp32s3 package)
extends = env:esp32s3
platform_packages = espressif/tool-xtensa-esp-elf-gdb
	espressif/toolchain-xtensa-esp32s3

The esp32s3 environment used to work shortly before I opened this issue. The project relies on concepts, so the minimal source to test is

#include <concepts>

void setup() {}
void loop() {}

The esp32 environment, which used to compile, now fails with

xtensa-esp32s3-elf-g++: error: unrecognized command line option '-std=gnu++2b'; did you mean '-std=gnu++2a'?

Changing to gnu++2a removes the unrecognized option error, but the concepts header is not present in that version of the toolchain.

src/main.cpp:1:10: fatal error: concepts: No such file or directory
 #include <concepts>

So, the newer toolchain was being used by default previously, but for some reason has reverted to a much older version without gnu++2b and concepts support.

The esp32s3_working environment is my workaround, which does compile. Although many warnings are generated:

/Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/port/xtensa/include/freertos/portmacro.h:614:1: warning: ignoring attribute 'section (".iram1.24")' because it conflicts with previous 'section (".iram1.22")' [-Wattributes]
  614 | {
      | ^
/Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/port/xtensa/include/freertos/portmacro.h:343:30: note: previous declaration here
  343 | static inline bool IRAM_ATTR xPortCanYield(void);
      |                              ^~~~~~~~~~~~~
/Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/port/xtensa/include/freertos/portmacro.h:633:1: warning: ignoring attribute 'section (".iram1.25")' because it conflicts with previous 'section (".iram1.23")' [-Wattributes]
  633 | {
      | ^
/Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/port/xtensa/include/freertos/portmacro.h:385:36: note: previous declaration here
  385 | static inline BaseType_t IRAM_ATTR xPortGetCoreID(void);
      |                                    ^~~~~~~~~~~~~~
In file included from /Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/include/freertos/portable.h:51,
                 from /Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/include/freertos/FreeRTOS.h:63,
                 from /Users/mat/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal.h:34,
                 from /Users/mat/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-touch.h:28,
                 from /Users/mat/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-touch.c:19:
/Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/port/xtensa/include/freertos/portmacro.h:614:1: warning: ignoring attribute 'section (".iram1.24")' because it conflicts with previous 'section (".iram1.22")' [-Wattributes]
  614 | {
      | ^
/Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/port/xtensa/include/freertos/portmacro.h:343:30: note: previous declaration here
  343 | static inline bool IRAM_ATTR xPortCanYield(void);
      |                              ^~~~~~~~~~~~~
/Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/port/xtensa/include/freertos/portmacro.h:633:1: warning: ignoring attribute 'section (".iram1.25")' because it conflicts with previous 'section (".iram1.23")' [-Wattributes]
  633 | {
      | ^
/Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/port/xtensa/include/freertos/portmacro.h:385:36: note: previous declaration here
  385 | static inline BaseType_t IRAM_ATTR xPortGetCoreID(void);
      |                                    ^~~~~~~~~~~~~~
Compiling .pio/build/esp32s3_working/FrameworkArduino/stdlib_noniso.c.o
In file included from /Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/include/freertos/portable.h:51,
                 from /Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/include/freertos/FreeRTOS.h:63,
                 from /Users/mat/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal.h:34,
                 from /Users/mat/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-uart.c:15:
/Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/port/xtensa/include/freertos/portmacro.h:614:1: warning: ignoring attribute 'section (".iram1.24")' because it conflicts with previous 'section (".iram1.22")' [-Wattributes]
  614 | {
      | ^
/Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/port/xtensa/include/freertos/portmacro.h:343:30: note: previous declaration here
  343 | static inline bool IRAM_ATTR xPortCanYield(void);
      |                              ^~~~~~~~~~~~~
/Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/port/xtensa/include/freertos/portmacro.h:633:1: warning: ignoring attribute 'section (".iram1.25")' because it conflicts with previous 'section (".iram1.23")' [-Wattributes]
  633 | {
      | ^
/Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/port/xtensa/include/freertos/portmacro.h:385:36: note: previous declaration here
  385 | static inline BaseType_t IRAM_ATTR xPortGetCoreID(void);
      |                                    ^~~~~~~~~~~~~~
Compiling .pio/build/esp32s3_working/FrameworkArduino/wiring_pulse.c.o
Compiling .pio/build/esp32s3_working/FrameworkArduino/wiring_shift.c.o
In file included from /Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/include/freertos/portable.h:51,
                 from /Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/include/freertos/FreeRTOS.h:63,
                 from /Users/mat/.platformio/packages/framework-arduinoespressif32/cores/esp32/Arduino.h:33,
                 from /Users/mat/.platformio/packages/framework-arduinoespressif32/cores/esp32/wiring_private.h:31,
                 from /Users/mat/.platformio/packages/framework-arduinoespressif32/cores/esp32/wiring_pulse.c:18:
/Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/port/xtensa/include/freertos/portmacro.h:614:1: warning: ignoring attribute 'section (".iram1.24")' because it conflicts with previous 'section (".iram1.22")' [-Wattributes]
  614 | {
      | ^
/Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/port/xtensa/include/freertos/portmacro.h:343:30: note: previous declaration here
  343 | static inline bool IRAM_ATTR xPortCanYield(void);
      |                              ^~~~~~~~~~~~~
/Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/port/xtensa/include/freertos/portmacro.h:633:1: warning: ignoring attribute 'section (".iram1.25")' because it conflicts with previous 'section (".iram1.23")' [-Wattributes]
  633 | {
      | ^
/Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/port/xtensa/include/freertos/portmacro.h:385:36: note: previous declaration here
  385 | static inline BaseType_t IRAM_ATTR xPortGetCoreID(void);
      |                                    ^~~~~~~~~~~~~~
In file included from /Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/include/freertos/portable.h:51,
                 from /Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/include/freertos/FreeRTOS.h:63,
                 from /Users/mat/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal.h:34,
                 from /Users/mat/.platformio/packages/framework-arduinoespressif32/cores/esp32/wiring_shift.c:20:
/Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/port/xtensa/include/freertos/portmacro.h:614:1: warning: ignoring attribute 'section (".iram1.24")' because it conflicts with previous 'section (".iram1.22")' [-Wattributes]
  614 | {
      | ^
/Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/port/xtensa/include/freertos/portmacro.h:343:30: note: previous declaration here
  343 | static inline bool IRAM_ATTR xPortCanYield(void);
      |                              ^~~~~~~~~~~~~
/Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/port/xtensa/include/freertos/portmacro.h:633:1: warning: ignoring attribute 'section (".iram1.25")' because it conflicts with previous 'section (".iram1.23")' [-Wattributes]
  633 | {
      | ^
/Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/port/xtensa/include/freertos/portmacro.h:385:36: note: previous declaration here
  385 | static inline BaseType_t IRAM_ATTR xPortGetCoreID(void);
      |                                    ^~~~~~~~~~~~~~
In file included from /Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/include/freertos/portable.h:51,
                 from /Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/include/freertos/FreeRTOS.h:63,
                 from /Users/mat/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:1:
/Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/port/xtensa/include/freertos/portmacro.h:613:48: warning: ignoring attribute 'section (".iram1.24")' because it conflicts with previous 'section (".iram1.22")' [-Wattributes]
  613 | static inline bool IRAM_ATTR xPortCanYield(void)
      |                                                ^
/Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/port/xtensa/include/freertos/portmacro.h:343:30: note: previous declaration here
  343 | static inline bool IRAM_ATTR xPortCanYield(void);
      |                              ^~~~~~~~~~~~~
/Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/port/xtensa/include/freertos/portmacro.h:632:55: warning: ignoring attribute 'section (".iram1.25")' because it conflicts with previous 'section (".iram1.23")' [-Wattributes]
  632 | static inline BaseType_t IRAM_ATTR xPortGetCoreID(void)
      |                                                       ^
/Users/mat/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/freertos/port/xtensa/include/freertos/portmacro.h:385:36: note: previous declaration here
  385 | static inline BaseType_t IRAM_ATTR xPortGetCoreID(void);
      |                                    ^~~~~~~~~~~~~~
Archiving .pio/build/esp32s3_working/libFrameworkArduino.a
Indexing .pio/build/esp32s3_working/libFrameworkArduino.a
Linking .pio/build/esp32s3_working/firmware.elf
/Users/mat/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/12.2.0/../../../../xtensa-esp32s3-elf/bin/ld: warning: .pio/build/esp32s3_working/firmware.elf has a LOAD segment with RWX permissions
Retrieving maximum program size .pio/build/esp32s3_working/firmware.elf
Checking size .pio/build/esp32s3_working/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]   5.5% (used 18032 bytes from 327680 bytes)
Flash: [=         ]   7.0% (used 235345 bytes from 3342336 bytes)
Building .pio/build/esp32s3_working/firmware.bin
esptool.py v4.5.1
Creating esp32s3 image...
Merged 2 ELF sections
Successfully created esp32s3 image.

The firmware built works as expected despite the compiler and linker warnings.

@Jason2866
Copy link
Contributor

Jason2866 commented Aug 12, 2024

If you want/need pin the platform version. This will use any version found on the system

platform = espressif32

better do like this (using latest version)

platform = espressif32 @ 6.8.1

@valeros
Copy link
Member

valeros commented Aug 12, 2024

@m-mcgowan please share also the beginning of the log where the configuration header is printed for the broken env [env:esp32s3].

@m-mcgowan
Copy link
Author

If you want/need pin the platform version. This will use any version found on the system

platform = espressif32

better do like this (using latest version)

platform = espressif32 @ 6.8.1

Thank you for that suggestion. I did try pinning the platform version, but couldn't return to the previous behavior using any of the released versions. I know this sounds crazy! That's why I'm so puzzled about what has changed.

@m-mcgowan
Copy link
Author

Here's fuller logs from the build:

With the old toolchain:

CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32-s3-devkitm-1.html
PLATFORM: Espressif 32 (6.8.1) > Espressif ESP32-S3-DevKitM-1
HARDWARE: ESP32S3 240MHz, 320KB RAM, 8MB Flash
DEBUG: Current (esp-builtin) On-board (esp-builtin) External (cmsis-dap, esp-bridge, 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.20017.0 (2.0.17) 
 - 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 33 compatible libraries
Scanning dependencies...
No dependencies
Building in debug mode
Compiling .pio/build/esp32s3/src/main.cpp.o
Building .pio/build/esp32s3/bootloader.bin
Generating partitions .pio/build/esp32s3/partitions.bin
esptool.py v4.5.1
Creating esp32s3 image...
Merged 1 ELF section
Successfully created esp32s3 image.
src/main.cpp:1:10: fatal error: concepts: No such file or directory
 #include <concepts>
          ^~~~~~~~~~
compilation terminated.

With the new toolchain:

CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32-s3-devkitm-1.html
PLATFORM: Espressif 32 (6.8.1) > Espressif ESP32-S3-DevKitM-1
HARDWARE: ESP32S3 240MHz, 320KB RAM, 8MB Flash
DEBUG: Current (esp-builtin) On-board (esp-builtin) External (cmsis-dap, esp-bridge, 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.20017.0 (2.0.17) 
 - tool-esptoolpy @ 1.40501.0 (4.5.1) 
 - tool-xtensa-esp-elf-gdb @ 12.1.0+20221002 
 - toolchain-riscv32-esp @ 8.4.0+2021r2-patch5 
 - toolchain-xtensa-esp32s3 @ 12.2.0+20230208
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 debug mode
Retrieving maximum program size .pio/build/esp32s3_working/firmware.elf
Checking size .pio/build/esp32s3_working/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]   5.5% (used 18032 bytes from 327680 bytes)
Flash: [=         ]   7.0% (used 235345 bytes from 3342336 bytes)
======================== [SUCCESS] Took 1.56 seconds ========================

@Jason2866
Copy link
Contributor

Jason2866 commented Aug 15, 2024

@m-mcgowan To use toolchain-xtensa-esp32s3 @ 12.2.0+20230208 for Arduino core 2.0.17 is a not valid configuration. The only used and supported toolchain from espressif for Arduino core 2.0.17 is toolchain-xtensa-esp32s3 @ 8.4.0+2021r2-patch5 using every other toolchain is not supported and recommended. Your code needs to be changed to use only features from gcc version 8.4.0 when using Arduino core 2.0.17.
Not an Platformio issue. Platformio is setting up the build environment 100% correctly.

@valeros
Copy link
Member

valeros commented Aug 15, 2024

@m-mcgowan The default and recommended toolchain for the Arduino framework is v8.4.0 and it's NOT capable of compiling projects with -std=gnu++2b. Any custom overrides you make, including manually specifying a newer version of the toolchain (which has a different structure (e.g. missing GDB binaries)), you do at your own risk.

@m-mcgowan
Copy link
Author

Thank you, I understand that. The point here is that I didn't need any custom overrides or any changes to a simple platformio environment, and was able to target the code for g++2b. It had been working fine up until recently.

In practice, I have several environments, one targeting just arduino and the other a combination of arduino and esp-idf. Both of these were working (with no toolchain overrides) up until the time I opened this issue. The overrides are merely a workaround so that I'm not blocked until the underlying cause is resolved.

@m-mcgowan
Copy link
Author

@m-mcgowan To use toolchain-xtensa-esp32s3 @ 12.2.0+20230208 for Arduino core 2.0.17 is a not valid configuration. The only used and supported toolchain from espressif for Arduino core 2.0.17 is toolchain-xtensa-esp32s3 @ 8.4.0+2021r2-patch5 using every other toolchain is not supported and recommended. Your code needs to be changed to use only features from gcc version 8.4.0 when using Arduino core 2.0.17. Not an Platformio issue. Platformio is setting up the build environment 100% correctly.

I can appreciate this may not be a PlatformIO issue, and could well lie with the arduino core for esp32s3. I can open an issue in the core. What is puzzling me is that this WAS working perfectly, with no custom overrides, no compiler or linker warnings, but then suddenly stopped working shortly before I opened this issue.

I looked through the recent PIO changes and there were some changes in the espressif package around selecting the arduino toolchain, overriding versions etc. I will try pinning version numbers to see if I can get back to the state that was working previously, which hopefully will shed some light on what has changed.

@FunDeckHermit
Copy link

FunDeckHermit commented Aug 22, 2024

The latest version of framework-arduinoespressif32 on the PlatformIO registry is 3.20017 (LINK).
This version is 3 months old and corresponds with Version 2.0.17 of the arduino-esp32 and is based on ESP-IDF 4.4.

There is no newer version in the registry, so at the moment you're stuck.

@m-mcgowan
Copy link
Author

So puzzling that this has worked previously. But you're definitely onto something - when I installed the esp32 BSP in Arduino IDE, version 3.0.4, it does use the correct toolchains:

esp32:[email protected]_20231023

Full log below.

So who's chain (no pun intended) do I have to pull to get 3.0.4 updated in the platformIO registry? I'd be happy to help, if someone were to show me the ropes.

Tool esp32:[email protected] already installed
Tool esp32:[email protected] already installed
Tool arduino:[email protected] already installed
Downloading packages
esp32:esp32-arduino-libs@idf-release_v5.1-b6b4727c58
esp32:esp-x32@2302
esp32:esp-xs2@2302
esp32:esp-xs3@2302
esp32:[email protected]_20231023
esp32:esp-rv32@2302
esp32:[email protected]_20231023
esp32:[email protected]
esp32:[email protected]
esp32:[email protected]
Installing esp32:esp32-arduino-libs@idf-release_v5.1-b6b4727c58
Configuring tool.
esp32:esp32-arduino-libs@idf-release_v5.1-b6b4727c58 installed
Installing esp32:esp-x32@2302
Configuring tool.
esp32:esp-x32@2302 installed
Installing esp32:esp-xs2@2302
Configuring tool.
esp32:esp-xs2@2302 installed
Installing esp32:esp-xs3@2302
Configuring tool.
esp32:esp-xs3@2302 installed
Installing esp32:[email protected]_20231023
Configuring tool.
esp32:[email protected]_20231023 installed
Installing esp32:esp-rv32@2302
Configuring tool.
esp32:esp-rv32@2302 installed
Installing esp32:[email protected]_20231023
Configuring tool.
esp32:[email protected]_20231023 installed
Installing esp32:[email protected]
Configuring tool.
esp32:[email protected] installed
Installing esp32:[email protected]
Configuring tool.
esp32:[email protected] installed
Replacing platform esp32:[email protected] with esp32:[email protected]
Uninstalling esp32:[email protected]
Running pre_uninstall script.
Platform esp32:[email protected] uninstalled
Uninstalling arduino:[email protected], tool is no more required
Uninstalling esp32:[email protected], tool is no more required
Running pre_uninstall script.
Tool esp32:[email protected] uninstalled
Uninstalling esp32:[email protected], tool is no more required
Uninstalling esp32:[email protected], tool is no more required
Uninstalling esp32:[email protected], tool is no more required
Running pre_uninstall script.
Tool esp32:[email protected] uninstalled
Uninstalling esp32:[email protected], tool is no more required
Running pre_uninstall script.
Tool esp32:[email protected] uninstalled
Uninstalling esp32:[email protected]_20220823, tool is no more required
Running pre_uninstall script.
Tool esp32:[email protected]_20220823 uninstalled
Uninstalling esp32:[email protected]_20220823, tool is no more required
Running pre_uninstall script.
Tool esp32:[email protected]_20220823 uninstalled
Uninstalling esp32:[email protected], tool is no more required
Running pre_uninstall script.
Tool esp32:[email protected] uninstalled
Uninstalling esp32:[email protected], tool is no more required
Running pre_uninstall script.
Tool esp32:[email protected] uninstalled
Uninstalling esp32:[email protected], tool is no more required
Running pre_uninstall script.
Tool esp32:[email protected] uninstalled
Configuring platform.
Platform esp32:[email protected] installed

@dlbogdan
Copy link

see #1225

@45gfg9
Copy link

45gfg9 commented Aug 27, 2024

+1 for needing a newer version toolchain. The current [email protected]+2021r2-patch5, which is gcc 8.4.0, does not even have proper C++20 support. It fails to compile operator<=>. I see that I have toolchain-xtensa-esp32s3 installed in .platformio/packages, gcc 12.2.0, but I am not bothered to hack into configurations.

@dlbogdan
Copy link

Use this instead:

https://github.com/pioarduino/platform-espressif32

@m-mcgowan
Copy link
Author

Use this instead:

https://github.com/pioarduino/platform-espressif32

Thank you for pointing me to this, and a thank you to the project's maintainers. This is perfect!

@m-mcgowan
Copy link
Author

So, what is really strange, is that the project is now building again as it was a few weeks back. With the same platformio.ini as above, the default espressif32 package is now using the correct compiler versions.

[env:esp32s3]
framework = arduino
platform = espressif32
board = esp32-s3-devkitm-1
build_flags =  -fexceptions -std=gnu++2b 
   -DARDUINO_USB_CDC_ON_BOOT=1
build_unflags = -std=gnu++11

Build output

 *  Executing task: platformio run --environment esp32s3 

Processing esp32s3 (framework: arduino; platform: espressif32; board: esp32-s3-devkitm-1)
-------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
cpp_flags []
LINKFLAGS 
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32-s3-devkitm-1.html
PLATFORM: Espressif 32 (2024.8.10+sha.55f67ff) > Espressif ESP32-S3-DevKitM-1
HARDWARE: ESP32S3 240MHz, 320KB RAM, 8MB Flash
DEBUG: Current (esp-builtin) On-board (esp-builtin) External (cmsis-dap, esp-bridge, 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.0.4+sha.147836c 
 - tool-esptoolpy @ 4.7.6 
 - tool-mklittlefs @ 3.2.0 
 - tool-riscv32-esp-elf-gdb @ 12.1.0+20221002 
 - tool-xtensa-esp-elf-gdb @ 12.1.0+20221002 
 - toolchain-riscv32-esp @ 12.2.0+20230208 
 - toolchain-xtensa-esp32s3 @ 12.2.0+20230208

It's great that it's suddenly working again, but my fear is that it will suddenly stop working. I'm so confused! :-)

@45gfg9
Copy link

45gfg9 commented Aug 28, 2024

Do you have a dependencies.lock in your project root?

I was using platform version 6.6.0, platform = espressif32 in platformio.ini, IDF v4.4.6 shown in the lock file, everything was working fine. Then I decided to upgrade to latest platform, so I specified 6.8.1 in the platformio.ini, upgraded, then it broke one of my dependency library. Now I have to pin the version like platform = espressif32 @ 6.6.0, otherwise it would go latest again. I don't know how PlatformIO handles this, but if you do have a dependencies.lock I suspect that it changed at some time in between.

@sivar2311
Copy link

@m-mcgowan

But platform = espressif32 in your platformio.ini contradicts framework-arduinoespressif32 @ 3.0.4+sha.147836c in your log !?
Arduino 3.x is not available officially by PlatformIO.

There must be some leftovers on your system. Maybe you have used

platform_packages=
  framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.4
  framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.4/esp32-arduino-libs-3.0.1.zip

or pioarduino before?

@m-mcgowan
Copy link
Author

I hadn't used pioarduino before until today, and it's probably no coincidence that things started working after that. It looks like platformio is picking up the different platform than intended? There is no dependencies.lock file in the project. (Just the platformio.ini, and a .ino file)

I don't recognize the platform_packages, especially framework-arduinoespressif32-libs, so I don't believe I've overridden those at any point.

To try to remove any leftovers, I removed packages and platforms from ~/.platformio, and the project's .pio directory. Then the old errors resurfaced.

Thank you for these responses, I feel now there is at least some explanation of what is going on. I have saved the deleted folders from ~/.platformio - I'll try to find out which package/platform is making things work for me.

@Jason2866
Copy link
Contributor

The key is platform = espressif32 this setting tells it can use any installed version found.
This is a bad idea, since you never know which version is really used.

@brightproject
Copy link

If I specify the platform like this

platform = espressif32

Then the code build is successful

Processing ROUND_DISPLAY_LVGL (platform:
espressif32; board: esp32-s3-devkitc-1; framework: arduino)
--------------------------Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32-s3-devkitc-1.html
PLATFORM: Espressif 32 (51.3.4+develop.sha.2656164) > Espressif ESP32-S3-DevKitC-1-N8 (8 MB QD, No PSRAM)
HARDWARE: ESP32S3 240MHz, 320KB RAM, 8MB Flash
DEBUG: Current (esp-builtin) On-board (esp-builtin) External (cmsis-dap, esp-bridge, 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.0.4
  • framework-arduinoespressif32-libs @ 5.1.0+sha.33fbade6b8
  • tool-esptoolpy @ 4.7.5
  • tool-mklittlefs @ 3.2.0
  • tool-riscv32-esp-elf-gdb @ 11.2.0+20220823
  • tool-xtensa-esp-elf-gdb @ 11.2.0+20230208
  • toolchain-riscv32-esp @ 12.2.0+20230208
  • toolchain-xtensa-esp32s3 @ 12.2.0+20230208

If I specify the platform like this

espressif32@^6.9.0

Then the code build is unsuccessful

Processing ROUND_DISPLAY_LVGL (platform:
espressif32@^6.9.0; board: esp32-s3-devkitc-1; framework: arduino)
--------------------------Verbose mode can be enabled via -v, --verbose optio
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32-s3-devkitc-1.html
PLATFORM: Espressif 32 (6.9.0) > Espressif ESP32-S3-DevKitC-1-N8 (8 MB QD, No PSRAM)
HARDWARE: ESP32S3 240MHz, 320KB RAM, 8MB Flash
DEBUG: Current (esp-builtin) On-board (esp-builtin) External (cmsis-dap, esp-bridge, 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.20017.0 (2.0.17)
  • tool-esptoolpy @ 1.40501.0 (4.5.1)
  • toolchain-riscv32-esp @ 8.4.0+2021r2-patch5
  • toolchain-xtensa-esp32s3 @ 8.4.0+2021r2-patch5

That's why I often just specify it to get the latest version of the framework:

platform = https://github.com/pioarduino/platform-espressif32

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

8 participants