Getting hardfault with a simple application on cortex m4

himanshup2 wrote on Tuesday, March 21, 2017:

I am using cortex m4 along with gcc. I have create 4 threads in freeRTOS, 3 of which are periodic with periods of 10ms, 100ms and 1000 ms. My application runs all 4 threads for 1 instance and then experiences a hardfault.

Here is a log report generated with respective register values


HARDFAULT:ERROR:R0 R1 R2 R3 R12 : 0x0 0x20001950 0x10000 0x200020c8 0xa5a5a5a5
HARDFAULT:ERROR:LR PC PSR BFSR : 0x8 0x8 0x6000000b 0x200
HARDFAULT:ERROR:CFSR HFSR DFSR AFSR MMAR BFAR : 0x20000 0x40000000 0x0 0x0 0xe000ed34 0xe000ed38


I have tried changing the stack size for threads but that hasnt helped in anyway. Here is a link to freeRTOS config file :

And this is the main.c that I am using

Kindly help me out.

rtel wrote on Tuesday, March 21, 2017:

What happens if you take out the calls to Task_10ms(), Task_100ms(),
Task_1000ms()? Does the code continue to run then? You could replace
the calls with simple incrementing variables to see if the tasks are
still running.

If that does not help, what happens if you set configUSE_TICKLESS_IDLE to 0?