Having issues with a Heltec board trying to build and upload a basic example.
I’m getting the following error?
Linking .pio\build\heltec_wireless_stick\firmware.elf
.pio\build\heltec_wireless_stick\lib166\libESP32_LoRaWAN.a(rtc-board.S.o): In function `TimerGetTimerValue':
D:\61722\Documents\Arduino\hardware\heltec\esp32\libraries\ESP32_LoRaWAN\src/rtc-board.c:120:(.text.TimerGetTimerValue+0x31): dangerous relocation: call8: call target out of range: __udivdi3
.pio\build\heltec_wireless_stick\lib166\libESP32_LoRaWAN.a(rtc-board.S.o): In function `TimerGetElapsedAlarmTime':
D:\61722\Documents\Arduino\hardware\heltec\esp32\libraries\ESP32_LoRaWAN\src/rtc-board.c:120:(.text.TimerGetElapsedAlarmTime+0x32): dangerous relocation: call8: call target out of range: __udivdi3
.pio\build\heltec_wireless_stick\lib166\libESP32_LoRaWAN.a(rtc-board.S.o): In function `TimerComputeElapsedTime':
D:\61722\Documents\Arduino\hardware\heltec\esp32\libraries\ESP32_LoRaWAN\src/rtc-board.c:134:(.text.TimerComputeElapsedTime+0x32): dangerous relocation: call8: call target out of range: __udivdi3
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\heltec_wireless_stick\firmware.elf] Error 1
Indeed, I’m getting the same behavior with all-updated versions.
Linking .pio\build\heltec_wireless_stick\firmware.elf
.pio\build\heltec_wireless_stick\lib815\libESP32_LoRaWAN.a(rtc-board.S.o): in function `TimerGetTimerValue':
D:\\61722\\Documents\\Arduino\\libraries\\ESP32_LoRaWAN_VASR\\src\/rtc-board.c:95:(.text.TimerGetTimerValue+0x27): dangerous relocation: call8: call target out of range: __udivdi3
.pio\build\heltec_wireless_stick\lib815\libESP32_LoRaWAN.a(rtc-board.S.o): in function `TimerGetElapsedAlarmTime':
D:\\61722\\Documents\\Arduino\\libraries\\ESP32_LoRaWAN_VASR\\src\/rtc-board.c:108:(.text.TimerGetElapsedAlarmTime+0x3a): dangerous relocation: call8: call target out of range: __udivdi3
.pio\build\heltec_wireless_stick\lib815\libESP32_LoRaWAN.a(rtc-board.S.o): in function `TimerComputeElapsedTime':
D:\\61722\\Documents\\Arduino\\libraries\\ESP32_LoRaWAN_VASR\\src\/rtc-board.c:135:(.text.TimerComputeElapsedTime+0x32): dangerous relocation: call8: call target out of range: __udivdi3
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\heltec_wireless_stick\firmware.elf] Error 1
============================================= [FAILED] Took 15.54 seconds =============================================
Problem is, it stems from a proecompiled library libESP32_LoRaWAN.a and that cannot be easily recompiled or fixed up – not sure what to do here. Maybe moving the target call site closer to the library. But that requires a bit of magic. No, PlatformIO compiles this library, the source is at ESP32_LoRaWAN/rtc-board.S at master · HelTecAutomation/ESP32_LoRaWAN · GitHub. It likely needs to be compiled / linked with -mlongcalls or needs a slight assembly modifications with those four call8 __udivdi3 lines.