You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add basic mutex (lock) and spin lock implementations in C11, C++11, AVR, and STM32
Keep in mind that in AVR I may need to use atomic access guards (turn off interrupts, critical section, restore interrupts), and in both AVR and STM32 (any single-core system) I need to add safety anti-deadlock mechanisms such as automatic deferral, timeout, and retry.
https://www.mikrocontroller.net/topic/358456 - mentions possible STM32 __LDREX() type C functions to mimic the assembly LDREX and STREX family of instructions which allow making mutexes
https://en.cppreference.com/w/c/atomic/ATOMIC_LOCK_FREE_consts - macros to see which atomic types in C are lock-free - THIS IS IMPORTANT TO ALLOW YOU TO assert in a library to ensure you're using truly lock-free types in any implementations you do for a spin lock!
Add basic mutex (lock) and spin lock implementations in C11, C++11, AVR, and STM32
Keep in mind that in AVR I may need to use atomic access guards (turn off interrupts, critical section, restore interrupts), and in both AVR and STM32 (any single-core system) I need to add safety anti-deadlock mechanisms such as automatic deferral, timeout, and retry.
References and research to get me started:
_Atomic
types": https://stackoverflow.com/a/73819087/4561887LDREX
andSTREX
(exclusive load and store instructions): https://stackoverflow.com/a/71626777/4561887__LDREX()
type C functions to mimic the assemblyLDREX
andSTREX
family of instructions which allow making mutexesGeneric User Guide" here!
__c11_atomic_exchange
22. https://en.cppreference.com/w/cpp/atomic/atomic_flag_test_and_set
23. https://en.cppreference.com/w/c/atomic/atomic_flag_test_and_set
Important sections to look at in the [Cortex -M4 Devices Generic User Guide
Generic User Guide](https://developer.arm.com/documentation/dui0553/b/?lang=en):
p83-84:
p32-33:
The text was updated successfully, but these errors were encountered: