[atomic][IAR]修复IAR编译报警 函数“__LDREX”隐式声明 (#7733)

This commit is contained in:
程蒙蒙 2023-06-29 00:04:06 +08:00 committed by GitHub
parent 077e984175
commit 33f5de4411
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -10,6 +10,9 @@
#include <rtthread.h> #include <rtthread.h>
#if defined (__IAR_SYSTEMS_ICC__) /* for IAR Compiler */
#include <intrinsics.h>
#endif
/** /**
\brief LDR Exclusive (32 bit) \brief LDR Exclusive (32 bit)
\details Executes a exclusive LDR instruction for 32 bit values. \details Executes a exclusive LDR instruction for 32 bit values.
@ -27,7 +30,7 @@
#elif defined (__IAR_SYSTEMS_ICC__) /* for IAR Compiler */ #elif defined (__IAR_SYSTEMS_ICC__) /* for IAR Compiler */
_Pragma("inline=forced") __intrinsic rt_atomic_t __LDREXW(volatile rt_atomic_t *ptr) _Pragma("inline=forced") __intrinsic rt_atomic_t __LDREXW(volatile rt_atomic_t *ptr)
{ {
return __LDREX((unsigned long *)ptr); return __LDREX((unsigned int *)ptr);
} }
#elif defined (__GNUC__) /* GNU GCC Compiler */ #elif defined (__GNUC__) /* GNU GCC Compiler */
__attribute__((always_inline)) static inline rt_atomic_t __LDREXW(volatile rt_atomic_t *addr) __attribute__((always_inline)) static inline rt_atomic_t __LDREXW(volatile rt_atomic_t *addr)
@ -58,7 +61,7 @@ __attribute__((always_inline)) static inline rt_atomic_t __LDREXW(volatile r
#elif defined (__IAR_SYSTEMS_ICC__) /* for IAR Compiler */ #elif defined (__IAR_SYSTEMS_ICC__) /* for IAR Compiler */
_Pragma("inline=forced") __intrinsic rt_atomic_t __STREXW(rt_atomic_t value, volatile rt_atomic_t *ptr) _Pragma("inline=forced") __intrinsic rt_atomic_t __STREXW(rt_atomic_t value, volatile rt_atomic_t *ptr)
{ {
return __STREX(value, (unsigned long *)ptr); return __STREX(value, (unsigned int *)ptr);
} }
#elif defined (__GNUC__) /* GNU GCC Compiler */ #elif defined (__GNUC__) /* GNU GCC Compiler */
__attribute__((always_inline)) static inline rt_atomic_t __STREXW(volatile rt_atomic_t value, volatile rt_atomic_t *addr) __attribute__((always_inline)) static inline rt_atomic_t __STREXW(volatile rt_atomic_t value, volatile rt_atomic_t *addr)