Collect2: error: ld returned 1 exit status *** [.pio/build/nodemcuv2/firmware.elf] Error 1

I want to use ESP32 for my app. When I compile this code with PlatformIO I get the following error:

  [env:nodemcuv2]
platform = https://github.com/Jason2866/platform-espressif32.git#feature/arduino-idf-v4.4
board = nodemcu-32s
framework = arduino
monitor_speed = 115200

I get this Error:

    |-- <ESP32 BLE Arduino> 2.0.0
Building in release mode
Linking .pio/build/nodemcuv2/firmware.elf
/Users/juliusschmid/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
*** [.pio/build/nodemcuv2/firmware.elf] Error 1

I don’t understand why I get this error message. Can someone help me and explain easily how I can fix the error?

This is an external, experimental platform using the newest version. As per Support for the latest Arduino v2.0 · Issue #619 · platformio/platform-espressif32 · GitHub, the new Arduino Core 2.0 version (which are based on ESO-IDF v4.x) are not officially supported in PlatformIO yet.

Per the comments in the linked issue it looks like you did not update esptool.py. Try the configuration as shown in Support for the latest Arduino v2.0 · Issue #619 · platformio/platform-espressif32 · GitHub, or wait for official PlatformIO support.

1 Like

After doing this I get this error:

    /Users/juliusschmid/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
*** [.pio/build/nodemcuv2/firmware.elf] Error 1

Is there any solution now or do I have to wait for the support?