Skip to content
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

microblaze: Fix atomic boolean return value. #21

Conversation

alpsayin
Copy link

@alpsayin alpsayin commented Mar 13, 2023

In atomic_compare_and_swapsi, fix boolean return value. Previously, it contained zero if successful and non-zero if unsuccessful.

Fixes Zephyr SDK Issue zephyrproject-rtos/sdk-ng#646.
Patch file taken and applied from: https://github.com/Xilinx/meta-xilinx/blob/master/meta-microblaze/recipes-devtools/gcc/gcc-12/0009-Patch-microblaze-Fix-atomic-boolean-return-value.patch

CC @keith-packard

Copy link
Member

@stephanosio stephanosio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @keith-packard already pointed out, it would be good to pull in all the Microblaze patches in https://github.com/Xilinx/meta-xilinx/tree/master/meta-microblaze/recipes-devtools/gcc/gcc-12

@alpsayin
Copy link
Author

alpsayin commented Apr 7, 2023

I apologise I disappeared without notice, I've been busy with work.
I'll make use of the holidays now and start applying. I have some catching up to do...

@alpsayin
Copy link
Author

alpsayin commented Apr 16, 2023

Good news is -as far as I could test- all picolibc tests except printf_scanf and test-raise pass.
I believe it's the way I configured the qemu or the way we configured the monitor is causing scanf issues.
I tested with below with https://github.com/alpsayin/picolibc/tree/alpsayin-microblaze-hacks

for test in $(find test -type f -executable -print); do echo $test; ../scripts/run-microblazeel $test ; done

I'll first take a look into what's happening with printf_scanf and test-raise (signal) and then carry on with refactoring all the patches into a (this?) PR.

@alpsayin
Copy link
Author

printf_scanf was a non-issue, my mistake. raise issue is as below:

picolibc/picolibc#460

In atomic_compare_and_swapsi, fix boolean return value.
Previously, it contained zero if successful and non-zero
if unsuccessful.

Signed-off-by: Kirk Meyer <kirk.meyer@sencore.com>
Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>

Fixes Zephyr SDK Issue #646. Patch file taken and applied from:
https://github.com/Xilinx/meta-xilinx/blob/master/meta-microblaze/recipes-devtools/gcc/gcc-12/0009-Patch-microblaze-Fix-atomic-boolean-return-value.patch

Signed-off-by: Alp Sayin <alpsayin@gmail.com>
In atomic_compare_and_swapsi, add side effects to prevent incorrect
assumptions during optimization. Previously, the outputs were
considered unused; this generated assembly code with
undefined side effects after invocation of the atomic.

Signed-off-by: Kirk Meyer <kirk.meyer@sencore.com>
Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>

Conflicts:
	gcc/config/microblaze/microblaze.md

Attempts to fix picolibc Issue #460. Patch file taken and applied from:
https://github.com/Xilinx/meta-xilinx/blob/master/meta-microblaze/recipes-devtools/gcc/gcc-12/0008-Patch-microblaze-Fix-atomic-side-effects.patch

Signed-off-by: Alp Sayin <alpsayin@gmail.com>
@alpsayin alpsayin force-pushed the zephyr-gcc-12.2.0-microblaze-atomic-cas branch from a35ad90 to b4654fb Compare April 18, 2023 21:16
@alpsayin
Copy link
Author

alpsayin commented Oct 1, 2023

Closing in favour of #24

@alpsayin alpsayin closed this Oct 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants