zephyrproject-rtos / sdk-ng

Zephyr SDK (Toolchains, Development Tools)
Apache License 2.0
179 stars 129 forks source link

microblaze: atomic compare-and-swap returns incorrect value #646

Open alpsayin opened 1 year ago

alpsayin commented 1 year ago

Microblaze toolchain's atomic compare-and-swap returns the inverse boolean value causing at least ungetc implementation in picolibc to hang. The issue was fixed in Xilinx's gcc via the below patch but this has not made it to upstream and thus not to zephyr-sdk. 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

keith-packard commented 1 year ago

I'm still seeing problems with atomic_exchange use in getc -- it fails to return the previously stored value as it should. Picolibc now has a stand-alone atomics test case that can be used to verify that atomics work as needed for picolibc.

alpsayin commented 1 year ago

Will be fixed with https://github.com/zephyrproject-rtos/gcc/pull/24