This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Stack Corruption issue

Hi,

   I am seeing one problem in my application.

I have two tasks, P1 and P2, P1 is having high priority that P2. P2 is triggered by Semaphore and P1 is triggered by Mailbox. Semaphore and Mail box both are posted in EDMA ISR. (Actually there are many tasks, only mentioned 2 of then which are creating problem for simplicity).

The issue is, i am seeing that Mail box is getting posted and it is reaching the max number of messages and Mail box full error is coming for the next msg post after reaching max msgs.

I could see from the Dump that:

1. P2 is executing

2. EDMA Interrupt occured

3. Mail box for P1 is posted

4. No switch happen to P1

5. Another EDMA interrupt came

6. Mail box for P1 is posted but no switch happned.

This is happening untill the Max msg is reached. The current running task is P2. In the IRP (stored for each interrup), i could see that this address is some Stack Address. So it is executing the Stack of P2 (this is not supposed to happen). So some where in P2, PC got corrupted.

My question is

1. Even though the PC got corrupted while exectuing the P2, soon after getting interrupt and mail box is posted for P1, it should switch to that task (P1) and execute it as P1 is higher priority that P2. But this is not happening, So i assume that the Task Context also might got corrupted which is stored in SystemStack (if i am correct).

Is this possibility is there or not?

2. Is there any way to interpret the Stack Content for task switch info. Where this information will be available? is it in SystemStack only, if so how it stores the TaskSwitch info in it.

3. Any way to Decode the stack contents and understand it, to know where exactly the present execution?

Thanks & Regards

Praveen Aruru

  • Hi Praveen --

    If you are not executing valid code (executing stack code) then all bets are off.   You need to figure out why your PC is corrupted.   You can use ROV tool to check the status of assorted SYS/BIOS state.   You can use the "BIOS->Scan for errors ..." tab to look for problems within BIOS.    I suspect that your stack has overflowed and you need to increase the stack size for your task(s).   The ROV Task view might help figure or the "Scan for errors ..." might help you find it.    BIOS also has checks at context switch time to make sure that the stacks are sane.

    Unfortunately, we don't currently support showing stack context on a per task basis.  This would be a welcome addition to ROV, but we don't currently support this.  CCS will show the stack trace for the currently running task or ISR.


    Couple other notes:

    If you call Mailbox_post() from an ISR, you need to make sure that the timeout parameter is '0'.

    If P2 is same or equal pirority to P1, then P1 will not preempt P2.   You should make P1 higher priority than P2.

    -Karl-