From 84e705e221fb7e93f51600aed2ba3827c4515d65 Mon Sep 17 00:00:00 2001 From: aineoae86-sys Date: Mon, 29 Jun 2026 23:43:01 +0800 Subject: [PATCH] Fix RP2040 task lock acquire ordering --- portable/ThirdParty/GCC/RP2040/include/portmacro.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/portable/ThirdParty/GCC/RP2040/include/portmacro.h b/portable/ThirdParty/GCC/RP2040/include/portmacro.h index d8173716eea..4e72bb07dc1 100644 --- a/portable/ThirdParty/GCC/RP2040/include/portmacro.h +++ b/portable/ThirdParty/GCC/RP2040/include/portmacro.h @@ -237,6 +237,11 @@ static inline void vPortRecursiveLock( BaseType_t xCoreID, } spin_lock_unsafe_blocking(pxSpinLock); } + else + { + /* spin_try_lock_unsafe() does not provide acquire ordering on the fast path. */ + __mem_fence_acquire(); + } configASSERT( ucRecursionCountByLock[ ulLockNum ] == 0 ); ucRecursionCountByLock[ ulLockNum ] = 1; ucOwnedByCore[ xCoreID ][ ulLockNum ] = 1;