Page 1 of 1

inifinite loop in salvoqins.c

PostPosted: Sat Oct 06, 2007 9:36 am
by samuel
My program is getting stuck in an infinite loop in salvoqins.c in the function

OStypeErr OSInsPrioQ( OStypeTcbP tcbP, OStypeTcbPP tcbPP ). In the code:

/* move through queue until we've reached the */
/* tcb with lower priority than the one we're */
/* inserting. */
while ((thisTcbP != NULL) && (prio >= thisTcbP->status.bits.prio))
{
prevTcbP = thisTcbP;
thisTcbP = thisTcbP->u2.nextTcbP;
}

I'm having a very hard time even isolating the problem. Do you have any ideas about what I should look for?


Re: inifinite loop in salvoqins.c

PostPosted: Sat Oct 06, 2007 10:00 am
by aek
It's likely that you have a situation where Salvo's objects have been corrupted. This can happen for a variety of reasons, one being a failure to prevent preemption (e.g. calling a Salvo service from an ISR that is not blocked in Salvo's critical sections).

------------------


Re: inifinite loop in salvoqins.c

PostPosted: Mon Oct 08, 2007 7:10 am
by samuel
This problem was due to destroying and creating tasks that are waiting on an events. I knew that doing this would not cause the task to be destroyed, but I didn't realize it could have effects like this. I corrected the problem by using an algorithm you posted earlier in another topic I posted titled 'OS_Destroy can not reuse TCBP' and everything works fine now. If I get a chance I will try to make a simpler example to see exactly where things go wrong.

Re: inifinite loop in salvoqins.c

PostPosted: Mon Oct 08, 2007 8:09 am
by aek
Thanks for the update.

All three of the current 4.0.2 Salvo releases -- ARM, MSP430 and PIC24/dsPIC -- use the "all-powerful" OSDestroyTask() function, albeit with a slightly new syntax (refer to the source code to see it). Your method is fine as well.

As new Salvo 4 distributions are created, they will also have this improved task-destroying function.

------------------