Answers checklist.
IDF version.
5.4
Operating System used.
Linux
How did you build your project?
Command line with idf.py
If you are using Windows, please specify command line type.
None
What is the expected behavior?
Successful build.
What is the actual behavior?
Linking error: undefined reference to '__atomic_test_and_set'
Steps to reproduce.
- create project using function
atomic_flag_test_and_set:
a. idf.py create-project
b. main/test.c
#include <stdatomic.h>
void app_main(void)
{
atomic_flag_test_and_set(0);
}
- set esp32c2 target OR enable PSRAM:
a. idf.py set-target esp32c2
b. CONFIG_SPIRAM=y
idf.py build
Build or installation Logs.
a. with esp32c2 target
~/.espressif/tools/riscv32-esp-elf/esp-14.2.0_20241119/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/14.2.0/../../../../riscv32-esp-elf/bin/ld: esp-idf/main/libmain.a(test.c.obj): in function `app_main':
~/test/main/test.c:5:(.text.app_main+0x8): undefined reference to `__atomic_test_and_set'
b. enabled PSRAM
~/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/main/libmain.a(test.c.obj):(.literal.app_main+0x0): undefined reference to `__atomic_test_and_set'
~/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/main/libmain.a(test.c.obj): in function `app_main':
~/test/main/test.c:5:(.text.app_main+0x7): undefined reference to `__atomic_test_and_set'
More Information.
- build on version 5.3 and earlier
- build with default settings
Answers checklist.
IDF version.
5.4
Operating System used.
Linux
How did you build your project?
Command line with idf.py
If you are using Windows, please specify command line type.
None
What is the expected behavior?
Successful build.
What is the actual behavior?
Linking error:
undefined reference to '__atomic_test_and_set'Steps to reproduce.
atomic_flag_test_and_set:a.
idf.py create-projectb.
main/test.ca.
idf.py set-target esp32c2b.
CONFIG_SPIRAM=yidf.py buildBuild or installation Logs.
a. with esp32c2 target
b. enabled PSRAM
More Information.