os_evt_wait_or(CHECK_EVENT_FLAGS, INFINITE_TIME); //Wait for an Event to occur rx_event = os_evt_get(); switch(rx_event) { case EVENT_INTERRUPT: if(chkflg) { dif = difftime(_gettime(), setalrm); if(!dif) *(tmp->flg) = 1; // on execution of this line (*tymval)--; if(*tymval == 0) chkflg = 0; } break;
the above code is a part of a task that sets a flag, whose address is passed in a structure using a mail box. dif is double. the alarm is generally set to 2 mins (120 secs) untill the dif > 1, things work well. when the dif = 1, the controller goes into hard fault.
i have read few articles and tried to follow the steps but could not come to any solution. www.ti.com/.../spma043.pdf
i use LPC17xx
No - I can still not see any code that shows us how you initialize your data and send any mail. All we can see is that you like pointers and very short variable names.
Get yourself a Joseph Yiu type Hard Fault handler, dump out the core and processor registers at the fault, and look at the assembler view code that is faulting.
Determine what memory is being accessed, why that might be out-of-range, and if stack related if that is a result of exceeding it's size, or from corruption elsewhere.
If it's fetch related, check any flash wait states or caching settings.