-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmake:reuse OpenAMP own CMake script for CMake build #12516
Conversation
15c8559
to
6677d12
Compare
f2bb8ea
to
b0d1c73
Compare
please talk with @CV-Bowen |
arm32 toolchain does not support 64-bit atomic, which may require special processing in this architecture, see: |
b0d1c73
to
b0a26c8
Compare
https://github.com/OpenAMP/libmetal/blob/3aee6be866b190d2e2b4997fedbd976a0c37c0c6/lib/io.h#L288-L292 please check latest patchset @anchao @raiden00pl @xiaoxiang781216 @CV-Bowen |
Check whether 64-bit atomic is supported Co-authored-by: xuxin19 <[email protected]> Co-authored-by: Bowen Wang <[email protected]>
b0a26c8
to
b9a82bc
Compare
ATOMIC_DETECT_CODE := detect_64_atomic.c | ||
ATOMIC_DETECT_BIN := detect_64_atomic_bin | ||
DETECT_ATOMIC_SUPPORT = \ | ||
echo '\#include <stdatomic.h>' > $(ATOMIC_DETECT_CODE); \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we avoid generate the temp file to test 64bit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we avoid generate the temp file to test 64bit?
I think this is related to the current toolchain, and there may be no better way. any suggestions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anchao do you have better idea?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GCC/CLANG( all GNU ) toolchains have built-in properties to indicate whether support atomic64:
(base) archer@archer:~/code/nuttx/n3/nuttx$ arm-none-eabi-gcc -Wstrict-prototypes -Wno-attributes -Wno-unknown-pragmas -Wno-psabi -fomit-frame-pointer -fno-common -Wall -Wshadow -Wundef -ffunction-sections -fdata-sections -g -mlittle-endian -march=armv7e-m -mtune=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -Wa,-mthumb -Wa,-mimplicit-it=always -isystem /home/archer/code/nuttx/n3/nuttx/include -D__NuttX__ -DNDEBUG -D__KERNEL__ -pipe -DMETAL_INTERNAL -dM -E - < /dev/null | grep SYNC
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
(base) archer@archer:~/code/nuttx/n3/nuttx$ clang -dM -E - < /dev/null | grep SYNC
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1
(base) archer@archer:~/code/nuttx/n3/nuttx$ gcc -dM -E - < /dev/null | grep SYNC
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1
Is it more elegant to check atomic64 use __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xuxin930 @xiaoxiang781216
If __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
is more reasonable, please contribute to the openamp community
diff --git a/openamp/libmetal/lib/io.h b/openamp/libmetal/lib/io.h
index ba416dd505..1de65739ec 100644
--- a/openamp/libmetal/lib/io.h
+++ b/openamp/libmetal/lib/io.h
@@ -30,7 +30,8 @@ extern "C" {
* @{
*/
-#ifdef __MICROBLAZE__
+#if defined(__MICROBLAZE__) || \
+ (defined(__GNUC__) && !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8))
#define NO_ATOMIC_64_SUPPORT
#endif
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change needs patch libmetal, the hack in cmake need keep until the next release of OpenAMP.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use the hot-fix for this patch? there are a lot of patch files in openamp subdirectory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, let's merge it first, and find the better method later. |
I confirm that this PR fixes #10401 |
Summary
nuttx_add_external_library
to reuse OpenAMP CMake scripts for CMake buildHAVE_STDATOMIC_H
with CMake64-bit
ATOMIC checks to both Makefile and CMakeImpact
Testing
CI test