Most hardfault comes from the processor trying to access a peripheral which has not not been properly initialised. for instance , you forgot to enable the clock to a peripheral. Or accessing invalid memory or something you forgot to do. so step through the code and see where the fault comes from.
I’m not sure I’d agree with that… some of the many, many examples that can cause hard fault include:
* stack overflow
* pointer corruption
* uninitialized pointer (from OP’s picture I suspect this might be the case)
* handling for disabled exceptions, e.g.,unprivileged access, MPU, bus fault
Here the SCB’s HFSR (0xE000ED2C) will give you some hints. If you step through pvPortStartFirstTask(), I suspect that a pointer that you are responsible for isn’t set up correctly.
Goodl luck. Let us know if you discover the issue or if you have further clues/details