-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
ESP32-S2: Linker error undefined reference to `__sync_sub_and_fetch_4' (ESP32 is working) #5948
Comments
Thank you for reporting this. We have added a few missing atomic builtins in IDF release/v4.4 branch, but looks like some are still missing. Will fix this in IDF and then arduino-esp32 will pull in the fix in the next release. (Internal reference: IDF-4397) |
You are welcome ;) Could you give me a hint for a quick workaround which I could use? Or is this just not possible? |
You could try to implement the missing functions in a way similar to https://github.com/espressif/esp-idf/blob/master/components/newlib/stdatomic.c, and add them somewhere in your sketch. I think linker might be able to find them. If you defined these functions in a .cpp or .ino file, make sure you declare them as |
* Adds implementations of __{atomic,sync}_nand_fetch_n. These builtins were implemented for other operations but were not defined for NAND. * Adds implementation of __atomic_OP_fetch_n for all OPs. * Adds implementation of __sync_OP_and_fetch_n for all OPs. Reported in espressif/arduino-esp32#5948
The fix has been added to IDF |
* Adds implementations of __{atomic,sync}_nand_fetch_n. These builtins were implemented for other operations but were not defined for NAND. * Adds implementation of __atomic_OP_fetch_n for all OPs. * Adds implementation of __sync_OP_and_fetch_n for all OPs. Reported in espressif/arduino-esp32#5948
* Adds implementations of __{atomic,sync}_nand_fetch_n. These builtins were implemented for other operations but were not defined for NAND. * Adds implementation of __atomic_OP_fetch_n for all OPs. * Adds implementation of __sync_OP_and_fetch_n for all OPs. Reported in espressif/arduino-esp32#5948
Fix backported to IDF release/v4.4 in espressif/esp-idf@c8c65a2, it will be part of the next Arduino-esp32 release. |
* Adds implementations of __{atomic,sync}_nand_fetch_n. These builtins were implemented for other operations but were not defined for NAND. * Adds implementation of __atomic_OP_fetch_n for all OPs. * Adds implementation of __sync_OP_and_fetch_n for all OPs. Reported in espressif/arduino-esp32#5948
* Adds implementations of __{atomic,sync}_nand_fetch_n. These builtins were implemented for other operations but were not defined for NAND. * Adds implementation of __atomic_OP_fetch_n for all OPs. * Adds implementation of __sync_OP_and_fetch_n for all OPs. Reported in espressif/arduino-esp32#5948
Hardware:
Board: ESP32-S2 (WROVER / ESP32-S2-Saola-1)
Core Installation version: 2.0.1
IDE name: Arduino IDE 1.8.16
Flash Frequency: 80Mhz
PSRAM enabled: No
Upload Speed: 921600
Computer OS: Windows 10
Description:
I am trying to connect my ESP32-S2 to the Azure IoT Hub using ESP32_AzureIoT - Azure IoT Hub library for esp32 devices in Arduino.
BTW: Is there a better way to connect the ESP32-S2 to Azure IoT than using this library?
When using the device ESP32SDev Module, compile and linking works.
When using the device ESP32S2 Dev Module, I get a linker error:
I tracked this down to this file, which defines this:
If I change the contents of this file in a way, that DEC_REF is defined differently:
Then compiling and linking works.
This is what I assume happens with ESP32 (not ESP32S2), but to be honest I do not really know what I am doing here.
Which definition is chosen depends on some defines like __STDC_VERSION__, __STDC_VERSION__, __STDC_NO_ATOMICS__, ARDUINO_ARCH_SAMD, FREERTOS_ARCH_ESP8266, but I could not figure out where these definitions are set and whats the difference between ESP32 and ESP32-S2.
(Still, the sketch is not working and delivers this runtime error:
But I would like to follow this up when I the linker error is clarifed.)
Sketch:
The text was updated successfully, but these errors were encountered: