-
Notifications
You must be signed in to change notification settings - Fork 176
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
examples: use atomic_flag type, __sync functions #221
Conversation
4279cdd
to
c3d2017
Compare
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.
Update copyrights?
Yes. Thank you. I will update the copyrights. Also, I found the same issues on the FreeRTOS side. The update is coming after internal testing and review. |
examples/system/generic/zynqmp_r5/zynqmp_amp_demo/ipi_shmem_demod.c
Outdated
Show resolved
Hide resolved
c3d2017
to
3165103
Compare
Hi Ed, Could you, please, take another look at this PR? Thank you. |
When I try to build this using gcc 10.3.1 from ARM, I get the following: cd /OpenAMP-Project/gh3/libmetal/build_r5/examples/system/generic/zynqmp_r5/zynqmp_amp_demo && /opt/arm/gcc-arm-none-eabi-10.3-2021.07/bin/arm-none-eabi-gcc -I/OpenAMP-Project/gh3/libmetal/build_r5/lib/include -I/OpenAMP-Project/gh3/libmetal/examples/system/generic/zynqmp_r5/zynqmp_amp_demo -mfloat-abi=hard -mcpu=cortex-r5 -mfpu=vfpv3-d16 -Wall -Werror -Wextra -flto -Os -I/home/mooring/build-oa/psu_cortexr5_0/include -o CMakeFiles/libmetal_amp_demod.elf.dir/shmem_atomic_demod.c.obj -c /OpenAMP-Project/gh3/libmetal/examples/system/generic/zynqmp_r5/zynqmp_amp_demo/shmem_atomic_demod.c Our current CI doesn't build for Xilinx hardware, so it won't detect this. Have I missed something, or do I need to run a later GCC? |
Digging a little deeper, this is due to libmetal using it's own atomic.h, instead of the GCC implementation. |
Use atomic_flag type and the GCC __sync built-in functions for atomic memory access. Initialize using ATOMIC_FLAG_INIT as a compound literal or a cast if scalar type depending on which atomic.h is used. The Linux client clears shared memory in ipi_shmem_echo(). Do not clear it again from the RPU in ipi_shmem_echod() to avoid a race. Signed-off-by: Sergei Korneichuk <sergei.korneichuk@amd.com>
0773da5
to
5e12d7c
Compare
Hi Ed. Thank you for catching this. Using ATOMIC_FLAG_INIT outside of a declaration requires a compound literal or a cast (if a scalar type is used) depending on which atomic.h is used. I have updated the PR. |
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.
Looks good now.
Use atomic_flag type and the GCC __sync built-in
functions for atomic memory access.
Signed-off-by: Sergei Korneichuk sergei.korneichuk@amd.com