newlib fix is pending: riscv: configure.ac bug fix for misaligned access when __riscv_misaligned_slow
Thanks!
I can try and see if I can make a minimal example that recreates the race condition but I’ll be OOO this week so maybe next
The problem is related to
Problem is that RISC-V standard ABI requires unaligned support but on PolarFire it is guaranteed for unprivileged user and supervisor modes by machine level firmware misaligned access emulation in SBI (usually OpenSBI). But RTEMS runs in the machine mode and does not want to allow latency and visibility uncontrolled SBI code use/run. The code of NewLib, RTEMS and all other components and programs should be build with GCC option -mstrict-align. There can be some problem in third party low-level code if it expects misaligned loads over generated and computed pointers works. So such sequences enabled when RISC-V target is detected, specified by some defines, should be located and witched to behavior for MIPS or other architectures which do not allows misaligned abscesses. Other option is to include misaligned accesses emulation directly in RTEMS M-mode exception handler. But such approach lowers determinism and control over maximal letency.
yes you are correct, this is the proper solution. apparently the issue has been known/open for awhile: Add multilibs for E51 and U54 cores of the Microchip PolarFire SoC (#5286) · Issues · RTEMS / RTOS / RTEMS · GitLab
I’ll try to get this fixed for rtems 7. it still requires an RSB fix to patch gcc 15.2 since the multilib was added after the 15 release branch point.
The rtems change needed is: riscv: add mstrict-align for mpfs and beaglevfire (!1236) · Merge requests · RTEMS / RTOS / RTEMS · GitLab
The RSB change is: rtems/gcc: patch 15.2 for RISC-V multilibs mstrict-align (!241) · Merge requests · RTEMS / Tools / RTEMS Source Builder · GitLab
Hi Gedare,
After all the changes have been merged I can now confirm that it works to can build and run [riscv/mpfs64imafdc]. Thanks for the assistance.
Unfortunately updating to latest main branch does not fix the underlying race condition and whatever issue that is causing libbsd timer callouts etc to stop.
I will try to see if I can make a minimal example that recreates the race condition error. But for the other issue I still have no clue what is going on.