Replies: 3 comments
-
AFAIK, they're not supported on the Pico. See https://forums.raspberrypi.com/viewtopic.php?t=340805 |
Beta Was this translation helpful? Give feedback.
-
Ack on that, thanks for the prompt reply. On a side note, I find it strange that they leave the subs in but no implementation... |
Beta Was this translation helpful? Give feedback.
-
The compiler just calls the stubs, which the OS author/CPU manufacturer should provide. It's definitely possible to write the atomic intrinsics yourself, but like the forum thread suggest there be dragons because you've not got real atomic ops and you have 2 cores running uncoordinated in parallel. It's probably harder than this, but maybe a simple "big atomic lock" could be used. Before doing any of those "atomic" operations you need to acquire the lock. So CAS or atomic-add, even though multi-step, would only ever occur on one core. You'd need to disable interrupts and under FreeRTOS disable task switching (or disable exceptions if that's even possible on Cortex-M0+) during the atomic operation, too. But without a really good test suite, I would hesitate to attempt it. There's just so many edge cases. :( FWIW, the Pico SDK provides good mutex/semaphore calls which you can use instead. |
Beta Was this translation helpful? Give feedback.
-
Hello,
I need to use std::atomic<> rather than craft my own...
fixes the issues with "qualified names not allowed" but the linker complains with:
undefined reference to __atomic_fetch_add_1
Am I supposed to install additional libraries? I am compiling on Debian linux, platformio...
some toolchains require the
-latomic
flag during link time, not sure what the requirements are for this port?Cheers and thanks!
Beta Was this translation helpful? Give feedback.
All reactions