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

Linking fails with latest arduino-esp32 #334

Closed
margau opened this issue Apr 26, 2020 · 6 comments
Closed

Linking fails with latest arduino-esp32 #334

margau opened this issue Apr 26, 2020 · 6 comments

Comments

@margau
Copy link

margau commented Apr 26, 2020

Hello together,
with the latest arduino-esp32, I'm getting linker errors with platform-espressif32.
Compilation in Arduino with the same arduino-esp32 works fine (https://pastebin.com/Z6XaJUUz).
The errors with PIO: https://pastebin.com/q96pXzrm

The environment:

[env:demo_env]
platform = espressif32
board = esp-wrover-kit
upload_protocol = esptool
monitor_speed = 115200
framework = arduino
monitor_filers = esp32_exception_decoder
platform_packages =
      framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git

OS is Linux Mint 19.3

This does not happen when using the default framework-arduinoespressif32. Unfortunately, due to #298 that's not a solution for me.

Best regards
margau

@szechyjs
Copy link

szechyjs commented Apr 26, 2020

I too am seeing this issue.

/Users/jared/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: section .dram0.data loaded at [0000000000000000,0000000000002e0f] overlaps section .iram0.vectors loaded at [0000000000000000,00000000000003ff]
/Users/jared/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: section .flash.rodata loaded at [0000000000000000,0000000000019eff] overlaps section .dram0.data loaded at [0000000000000000,0000000000002e0f]
/Users/jared/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: section .flash.text loaded at [0000000000000000,00000000000a9216] overlaps section .flash.rodata loaded at [0000000000000000,0000000000019eff]
/Users/jared/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: section .iram0.text loaded at [0000000000000400,0000000000014576] overlaps section .flash.text loaded at [0000000000000000,00000000000a9216]
...
vflash.c:(.text+0xc7): dangerous relocation: windowed longcall crosses 1GB boundary; return may fail: memset
vflash.c:(.text+0xf2): dangerous relocation: windowed longcall crosses 1GB boundary; return may fail: memcpy
/Users/jared/.platformio/packages/framework-arduinoespressif32@src-537c58760dafe7fcc8a1d9bbcf00b6f6/tools/sdk/lib/libbtdm_app.a(vflash.o): In function `r_flash_write':
vflash.c:(.text+0x11e): dangerous relocation: windowed longcall crosses 1GB boundary; return may fail: memcpy
/Users/jared/.platformio/packages/framework-arduinoespressif32@src-537c58760dafe7fcc8a1d9bbcf00b6f6/tools/sdk/lib/libbtdm_app.a(bt_util_buf.o): In function `r_bt_util_buf_init':
bt_util_buf.c:(.text+0x6f): dangerous relocation: windowed longcall crosses 1GB boundary; return may fail: memset
collect2: error: ld returned 1 exit status
*** [.pio/build/esp32dev/firmware.elf] Error 1

Edit: it appears that using any version from git results in this error. The current default version is framework-arduinoespressif32 3.10004.200129 (1.0.4) which is commit 4638628873a061c36faffebe4d146d13f960076d. If I set the following I get the same error...

platform_packages =
    framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#4638628873a061c36faffebe4d146d13f960076d

@margau
Copy link
Author

margau commented Apr 27, 2020

Good morning,
I have the suspection that the compiler is not called in the right direction when using the git version.
I compared the output of "pio run --verbose".
With "default" framework-arduinoespressif32 (successfull):

Scanning dependencies...
No dependencies
Building in release mode
xtensa-esp32-elf-g++ -o .pio/build/demo_env/src/main.cpp.o (...)

With git version (fails):

Scanning dependencies...
No dependencies
Building in release mode
xtensa-esp32-elf-g++ -o .pio/build/demo_env/firmware.elf -(...)

This seems like some build steps are missing when using the git version.

@margau
Copy link
Author

margau commented Apr 27, 2020

Some digging in the history suggests, that the problem maybe was introduced with 4c2b338

@margau
Copy link
Author

margau commented Apr 27, 2020

I'm relatively sure to have found the problem:
The ldscript in the board.json-build-section moved from the global ldscript into the arduino-specific ldscript. For manually targeted git-checkouts, the "arduino"-section seems not to match. Manually adding "ldscript": "esp32_out.ld", into the json of the build board makes everything work fine.

A fix would probably contain the "arduino"-section of the build config also getting applied for arduino-git-checkouts. Trying to look into it.

@margau
Copy link
Author

margau commented Apr 27, 2020

Another Update: Workaround is adding board_build.ldscript = esp32_out.ld (or other ldscript) manually to the build-env - the root cause (config.build.arduino.ldscript not used when using framework-arduinoespressif32 as custom platform package) I haven't found yet.

@valeros, could you take a look at this part of configuration?
Thanks!

@valeros
Copy link
Member

valeros commented Apr 27, 2020

Hi @margau ! There is a pending PR espressif/arduino-esp32#3735 with changes required to work with the upstream Arduino for ESP32. You can try to add that two lines from the PR to the freshly pulled package and should work.

@valeros valeros closed this as completed Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants