From 3ac85980898cdac9f91d16de6e302dbd0a4d8407 Mon Sep 17 00:00:00 2001 From: Jack Wilsdon Date: Thu, 31 Oct 2024 14:36:51 +0000 Subject: [PATCH 1/2] Fix RP2040 build without configASSERT defined --- .../ThirdParty/GCC/RP2040/include/portmacro.h | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/portable/ThirdParty/GCC/RP2040/include/portmacro.h b/portable/ThirdParty/GCC/RP2040/include/portmacro.h index bf91eda36f..15982403fa 100644 --- a/portable/ThirdParty/GCC/RP2040/include/portmacro.h +++ b/portable/ThirdParty/GCC/RP2040/include/portmacro.h @@ -213,10 +213,14 @@ static inline void vPortRecursiveLock( uint32_t ulLockNum, static uint8_t ucOwnedByCore[ portMAX_CORE_COUNT ]; static uint8_t ucRecursionCountByLock[ portRTOS_SPINLOCK_COUNT ]; - configASSERT( ulLockNum < portRTOS_SPINLOCK_COUNT ); + #ifdef configASSERT + configASSERT( ulLockNum < portRTOS_SPINLOCK_COUNT ); + #endif uint32_t ulCoreNum = get_core_num(); uint32_t ulLockBit = 1u << ulLockNum; - configASSERT( ulLockBit < 256u ); + #ifdef configASSERT + configASSERT( ulLockBit < 256u ); + #endif if( uxAcquire ) { @@ -224,7 +228,9 @@ static inline void vPortRecursiveLock( uint32_t ulLockNum, { if( ucOwnedByCore[ ulCoreNum ] & ulLockBit ) { - configASSERT( ucRecursionCountByLock[ ulLockNum ] != 255u ); + #ifdef configASSERT + configASSERT( ucRecursionCountByLock[ ulLockNum ] != 255u ); + #endif ucRecursionCountByLock[ ulLockNum ]++; return; } @@ -235,14 +241,18 @@ static inline void vPortRecursiveLock( uint32_t ulLockNum, } __mem_fence_acquire(); - configASSERT( ucRecursionCountByLock[ ulLockNum ] == 0 ); + #ifdef configASSERT + configASSERT( ucRecursionCountByLock[ ulLockNum ] == 0 ); + #endif ucRecursionCountByLock[ ulLockNum ] = 1; ucOwnedByCore[ ulCoreNum ] |= ulLockBit; } else { - configASSERT( ( ucOwnedByCore[ ulCoreNum ] & ulLockBit ) != 0 ); - configASSERT( ucRecursionCountByLock[ ulLockNum ] != 0 ); + #ifdef configASSERT + configASSERT( ( ucOwnedByCore[ ulCoreNum ] & ulLockBit ) != 0 ); + configASSERT( ucRecursionCountByLock[ ulLockNum ] != 0 ); + #endif if( !--ucRecursionCountByLock[ ulLockNum ] ) { From fbdacd1704efaaa485e9e62992f3f4312d5a6787 Mon Sep 17 00:00:00 2001 From: Rahul Kar Date: Thu, 31 Oct 2024 16:24:59 +0000 Subject: [PATCH 2/2] Add small formatting change --- portable/ThirdParty/GCC/RP2040/include/portmacro.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/portable/ThirdParty/GCC/RP2040/include/portmacro.h b/portable/ThirdParty/GCC/RP2040/include/portmacro.h index 15982403fa..06246ebc1e 100644 --- a/portable/ThirdParty/GCC/RP2040/include/portmacro.h +++ b/portable/ThirdParty/GCC/RP2040/include/portmacro.h @@ -215,12 +215,12 @@ static inline void vPortRecursiveLock( uint32_t ulLockNum, #ifdef configASSERT configASSERT( ulLockNum < portRTOS_SPINLOCK_COUNT ); - #endif + #endif /* configASSERT */ uint32_t ulCoreNum = get_core_num(); uint32_t ulLockBit = 1u << ulLockNum; #ifdef configASSERT configASSERT( ulLockBit < 256u ); - #endif + #endif /* configASSERT */ if( uxAcquire ) { @@ -230,7 +230,7 @@ static inline void vPortRecursiveLock( uint32_t ulLockNum, { #ifdef configASSERT configASSERT( ucRecursionCountByLock[ ulLockNum ] != 255u ); - #endif + #endif /* configASSERT */ ucRecursionCountByLock[ ulLockNum ]++; return; } @@ -243,7 +243,7 @@ static inline void vPortRecursiveLock( uint32_t ulLockNum, __mem_fence_acquire(); #ifdef configASSERT configASSERT( ucRecursionCountByLock[ ulLockNum ] == 0 ); - #endif + #endif /* configASSERT */ ucRecursionCountByLock[ ulLockNum ] = 1; ucOwnedByCore[ ulCoreNum ] |= ulLockBit; } @@ -252,7 +252,7 @@ static inline void vPortRecursiveLock( uint32_t ulLockNum, #ifdef configASSERT configASSERT( ( ucOwnedByCore[ ulCoreNum ] & ulLockBit ) != 0 ); configASSERT( ucRecursionCountByLock[ ulLockNum ] != 0 ); - #endif + #endif /* configASSERT */ if( !--ucRecursionCountByLock[ ulLockNum ] ) {