Xtensa-esp32-elf/bin/ld: final link failed: bad value

Hello

Building an project I get the following error. Looking into tte .pio/build/esp32-devkitc/ folder I can find a diybms_controller_firmware_espressif32_esp32-devkitc.map file but no .elf.

Linking .pio/build/esp32-devkitc/diybms_controller_firmware_espressif32_esp32-devkitc.elf
/Users/Sebastian/.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/esp32-devkitc/diybms_controller_firmware_espressif32_esp32-devkitc.elf] Error 1

Does anybody has an idea what is the problem? I’m on OS X 10.15.7

Relevant part of platformio.ini

[env]
framework = arduino
; 4MB FLASH DEVKITC
platform = espressif32
;platform  = https://github.com/platformio/platform-espressif32.git#feature/arduino-upstream

board = esp32dev
monitor_speed = 115200
monitor_port=COM4
monitor_filters = log2file, esp32_exception_decoder
board_build.flash_mode = dout
board_build.filesystem = littlefs
extra_scripts =
        pre:buildscript_versioning.py
        pre:prebuild_compress.py
        pre:prebuild_generate_integrity_hash.py
        pre:prebuild_generate_embedded_files.py
        pre:bmp2array4bit.py
        post:extract_bootloader.py

upload_speed=921600
upload_port=COM4

platform_packages =
   toolchain-xtensa32 @ ~2.80400.0
   platformio/tool-esptoolpy @ ~1.30100
   framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.3
   

(yes I know, I need to change the upload_port once compiling works)

Thanks in advance for your help
Sebastian

If you want a setup with Arduino-ESP32 2.0.3, best to remove that and change

to

platform = espressif32@5.0.0

per releases. Does that work better?

@maxgerhardt that worked. Thank you very much :slight_smile: