Hi Matheus,

it seems you are using an Arm processor that does not implement the
atomic instructions LDREX and STREX.
This is the case for Arm Cortex-M0/M0+ line, which is based on the arm-v6m ISA.
In this case, you'd need to implement these functions by providing the
atomicity requirements with support from the OS.
Currently the ESP32-C3 chip provides this implementation, but it could
be made generic with by some work to the build system.
There is an open issue for this improvement:
https://github.com/apache/incubator-nuttx/issues/3483

Best regards,
Gustavo.

On Mon, May 31, 2021 at 7:53 AM Matheus Castello
<math...@castello.eng.br> wrote:
>
> Trying to use libcxx for port a project to Nuttx and I'm having the
> following errors:
>
> ```
> LD: nuttx
> arm-none-eabi-ld:
> /home/castello/projects/N/nuttx/staging/libxx.a(locale.o): in function
> `std::__1::locale::id::__init()':
> locale.cpp:(.text+0x1890): undefined reference to `__atomic_fetch_add_4'
> arm-none-eabi-ld:
> /home/castello/projects/N/nuttx/staging/libxx.a(memory.o): in function
> `std::__1::__shared_count::__add_shared()':
> memory.cpp:(.text+0x60): undefined reference to `__atomic_fetch_add_4'
> arm-none-eabi-ld:
> /home/castello/projects/N/nuttx/staging/libxx.a(memory.o): in function
> `std::__1::__shared_count::__release_shared()':
> memory.cpp:(.text+0x72): undefined reference to `__atomic_fetch_add_4'
> arm-none-eabi-ld:
> /home/castello/projects/N/nuttx/staging/libxx.a(memory.o): in function
> `std::__1::__shared_weak_count::__add_weak()':
> memory.cpp:(.text+0x9a): undefined reference to `__atomic_fetch_add_4'
> arm-none-eabi-ld:
> /home/castello/projects/N/nuttx/staging/libxx.a(memory.o): in function
> `std::__1::__shared_weak_count::__release_weak()':
> memory.cpp:(.text+0xc0): undefined reference to `__atomic_fetch_add_4'
> arm-none-eabi-ld:
> /home/castello/projects/N/nuttx/staging/libxx.a(memory.o): in function
> `std::__1::__shared_weak_count::lock()':
> memory.cpp:(.text+0x102): undefined reference to
> `__atomic_compare_exchange_4'
> ```
>
> I can already build it using the simulator but with arm-none-eabi I'm
> not having success. If anyone has any hints or light on what I'm doing
> wrong, I'll be very grateful :)
>
> BR,
> Matheus Castello



-- 
Gustavo Henrique Nihei

Reply via email to