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

enable long calls in asm (GIT8266O-682) #1107

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

d-a-v
Copy link

@d-a-v d-a-v commented Jun 26, 2021

When enabling ESP8266_WIFI_DEBUG_LOG_ENABLE, this linker error is raised:

.espressif/tools/xtensa-lx106-elf/esp-2020r3-49-gd5524c1-8.4.0/xtensa-lx106-elf/bin/../lib/gcc/xtensa-lx106-elf/8.4.0/../../../../xtensa-lx106-elf/bin/ld: esp-idf/freertos/libfreertos.a(xtensa_vectors.S.obj): in function `nmi_reentried':
ESP8266_RTOS_SDK/components/freertos/port/esp8266/xtensa_vectors.S:859:(.text+0x349): dangerous relocation: call0: call target out of range: wDev_ProcessFiq
collect2: error: ld returned 1 exit status

This pull request aims at fixing it.

I also tried this without success:

diff --git a/tools/cmake/toolchain-esp8266.cmake b/tools/cmake/toolchain-esp8266.cmake
index 565fbe9a..757b64fb 100644
--- a/tools/cmake/toolchain-esp8266.cmake
+++ b/tools/cmake/toolchain-esp8266.cmake
@@ -6,6 +6,7 @@ set(CMAKE_ASM_COMPILER xtensa-lx106-elf-gcc)
 
 set(CMAKE_C_FLAGS "-mlongcalls -Wno-frame-address" CACHE STRING "C Compiler Base Flags")
 set(CMAKE_CXX_FLAGS "-mlongcalls -Wno-frame-address" CACHE STRING "C++ Compiler Base Flags")
+set(CMAKE_ASM_FLAGS "-mlongcalls" CACHE STRING "ASM Compiler Base Flags")
 
 # Can be removed after gcc 5.2.0 support is removed (ref GCC_NOT_5_2_0)
 set(CMAKE_EXE_LINKER_FLAGS "-nostdlib -Wl,--gc-sections" CACHE STRING "Linker Base Flags")

But this change leads to this error:

.espressif/tools/xtensa-lx106-elf/esp-2020r3-49-gd5524c1-8.4.0/xtensa-lx106-elf/bin/../lib/gcc/xtensa-lx106-elf/8.4.0/../../../../xtensa-lx106-elf/bin/ld:esp8266.project.ld:58 cannot move location counter backwards (from 0000000040100021 to 0000000040100020)
collect2: error: ld returned 1 exit status

@CLAassistant
Copy link

CLAassistant commented Jun 26, 2021

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions github-actions bot changed the title enable long calls in asm enable long calls in asm (GIT8266O-682) Jun 26, 2021
@mincrmatt12
Copy link

To get this fully working, change the call0 in xtensa_vectors.S for debug exceptions into a normal jump:

--- a/components/freertos/port/esp8266/xtensa_vectors.S
+++ b/components/freertos/port/esp8266/xtensa_vectors.S
@@ -564,7 +564,7 @@ _DebugExceptionVector:
     wsr     a1,  EXCSAVE_2
     movi    a0,  1
     wsr     a0,  EXCCAUSE
-    call0   _xt_debug_exc
+    j   _xt_debug_exc
 
     .end        literal_prefix

@d-a-v
Copy link
Author

d-a-v commented Sep 9, 2021

@mincrmatt12 Are you going to make a PR or do you mean I should update mine ?

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

Successfully merging this pull request may close these issues.

3 participants