pico-sdk icon indicating copy to clipboard operation
pico-sdk copied to clipboard

Runtime for C11 atomics missing

Open sgstreet opened this issue 1 year ago • 2 comments

The Pico-SDK does not provide an implementation of standard C11 atomic functions, this makes implementing multi-core algorithms more complicated and error prone while decreasing software potability from Cotrex-M3/4/7 code bases. Unfortunately the Cortex-M0+ does not provide LDREX and STREX instructions for multi-core lock-less atomic operations and thus most tool chains do not provide implementations.

The Pico-SDK should provide an implementation of the C11 atomic functions using interrupt masking for single core atomic read/write/modify operations combined with hardware spin locks to accommodate the RP2040 symmetric dual core design.

sgstreet avatar Feb 20 '24 19:02 sgstreet

PR inbound later today.

sgstreet avatar Feb 20 '24 19:02 sgstreet

@kilograham the PR is up and I'm looking forward to your thoughts.

sgstreet avatar Feb 20 '24 23:02 sgstreet