Thread suspension generates a Hard_Fault on STM32U5 with ThreadX
I am working on NUCLEO-U575ZI-Q. The code is generated with STM32CubeMX (using STM32CubeIDE) and the application uses ThreadX, which was added to the project using CubeMX.
When a thread call any function that would lead to a suspension of the thread, the function _get_ipsr() (file Middlewares\ST\threadx\ports\cortex_m33\gnu\inc\tx_port.h) is called and it directly triggers a Hard_Fault.
The error would trigger 100% of the time with some source code, and never with some other source code.
I am having this error for a while. I thought I found the solution before, but I was wrong and it was all just luck.
According to this link:
How to debug a HardFault on an ARM Cortex-M MCU | Interrupt (memfault.com)
There is a usage fault with the flag "UNALIGNED" raised. However please note that last time I had trouble with _get_ipsr(), the only flag set to 1 was in the "reserved" field of the usage fault register.
I still working on the issue but I am having trouble finding a solution. Do you have an idea on what could go wrong or how to solve this issue?
