Page 1 of 1

ESP32-C6 linking failed

Posted: Sun Mar 10, 2024 7:30 pm
by Graveflo
I'm trying to compile simple test code that I have working on ESP32 and ESP32-S3, but when I try to compile it for ESP32-C6 I get a linking error that I do not fully understand. I am able to compile the "blink" example just fine for the C6, so this is not a consistent issue with the build system.

The error looks like this (I added a couple line breaks):

Code: Select all

/home/ryan/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld:
The gap between .flash.rodata and .flash.tls must not exist to produce the final bin image.
/home/ryan/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld:
The gap between .flash.tls and .eh_frame must not exist to produce the final bin image.
I tried looking for a good explanation of "The gap between X and Y must not exist to produce the final bin image" but I could not find anything useful. Does anyone know what could be causing this error?

The CMake files are the same for the working blink example and the failing project.
  1. cmake_minimum_required(VERSION 3.16)
  2.  
  3. include($ENV{IDF_PATH}/tools/cmake/project.cmake)
  4. project(blink)
The blink example uses `SRCS "blink_example_main.c"` instead
  1. idf_component_register(SRC_DIRS "nimcache"
  2.                        INCLUDE_DIRS ".")
  3. idf_build_set_property(C_COMPILE_OPTIONS -Wno-unused-label APPEND)
  4. idf_build_set_property(C_COMPILE_OPTIONS -Wno-discarded-qualifiers APPEND)
  5. idf_build_set_property(C_COMPILE_OPTIONS -Wno-ignored-qualifiers APPEND)
  6. idf_build_set_property(C_COMPILE_OPTIONS -Wno-error=unused-label APPEND)
  7. idf_build_set_property(C_COMPILE_OPTIONS -Wno-error=parentheses APPEND)
  8. idf_build_set_property(C_COMPILE_OPTIONS -Wno-error=implicit-function-declaration APPEND)
  9. idf_build_set_property(C_COMPILE_OPTIONS -Wno-error=maybe-uninitialized APPEND)
  10. idf_build_set_property(C_COMPILE_OPTIONS -Wno-error=nonnull APPEND)
  11. idf_build_set_property(C_COMPILE_OPTIONS -Wno-error=address APPEND)
  12. idf_build_set_property(C_COMPILE_OPTIONS -Wno-unused-but-set-variable APPEND)

Re: ESP32-C6 linking failed

Posted: Tue Mar 12, 2024 7:40 am
by ESP_jakob
Hi!

To debug these type of linker issues, it would be easiest for us if you can provide a minimal reproducing example. Would that be possible?

Re: ESP32-C6 linking failed

Posted: Wed Mar 13, 2024 7:28 am
by ESP_jakob
One more question: which IDF version - specifically, which commit - are you using?

Re: ESP32-C6 linking failed

Posted: Sun Jun 23, 2024 12:35 am
by grrrrr
I have the same issue with my ESP32-C6-DevKitC-1

step [4/6] Linking CX executable main.elf
FAILED: main.elf

followed by ..... and then finishing with
~/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20240530/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld: The gap between .flash.rodata and .eh_frame_hdr must not exist to produce the final bin image.

I am using idf --version => ESP-IDF v5.4-dev-1030-g0479494e7a

echo $TOOLCHAINS => org.swift.59202406131a

from export TOOLCHAINS=$(plutil -extract CFBundleIdentifier raw /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-06-13-a.xctoolchain/Info.plist)

which is the latest TRUNK download from swift.org
There is a later version : swift-6.0-DEVELOPMENT-SNAPSHOT-2024-06-21-a-osx.pkg
It results in the same errors / issues.