I'm working on a freertos project which is running at Cortex-M4 and I'm being troubled by a problme - hard fault.
The following is my debugging process:
I dump the registers in the stack when the hardfault happens.
[Hard fault handler]R0 = 0x1d8R1 = 0x2001091fR2 = 0x398dcdR3 = 0x0R4:0x0R5:0xe4a0R6:0x0R7:0x20010928R8:0xa5a5a5a5R9:0xa5a5a5a5R10:0xa5a5a5a5R11:0xa5a5a5a5R12 = 0x0LR = 0x1ffe1987PC = 0x1ffe199aPSR = 0x61000000- FSR/FARBFAR = 0xe000ed38MMFAR = 0xe000ed34CFSR = 0x10000HFSR = 0x40000000DFSR = 0x0AFSR = 0x0- Misc LR/EXC_RETURN = 0xfffffffd
From the HFSR and CFSR, I can know that hardfault is caused by the "UNDEFINSTR" error.
And the PC is 0x0x1FFE199A,
Before executing 0x1FFE199A, the LDRD is executed which is due to one uint64_t variable is used. If I change the variable to uint32_t type and there is no "LDRD" instruction generated, and the programme can run well.
So I suspect, the issue I met is related with the "LDRD", but I don't know the rootcause?
One thing I want to say, the hardfault usually happens after the progaramm running for several hours, sometimes 1 hour, sometimes 5 hours....
I'm sure the stack is not fulled and the project is compiled by the arm-none-eabi-gcc（2 018-q4-major）.
Can any one give some suggestions for next setp debug?
Thanks a lot!
That's strange, the instruction looks fine.
It might be a chip defect that caused issue with instruction decode. Have you tried it with another board?
A chip defect is rather unlikely. Much more unlikely than a programming error!
Yes, I tried with another board, the issue still exists.
View all questions in Cortex-M / M-Profile forum