Pumpkin, Inc.

Pumpkin User Forums

inifinite loop in salvoqins.c

If you can't make Salvo do what you want it to do, post it here.

inifinite loop in salvoqins.c

Postby samuel » Sat Oct 06, 2007 9:36 am

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?

samuel
 
Posts: 22
Joined: Sun Oct 08, 2006 11:00 pm

Re: inifinite loop in salvoqins.c

Postby aek » Sat Oct 06, 2007 10:00 am

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).

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

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: inifinite loop in salvoqins.c

Postby samuel » Mon Oct 08, 2007 7:10 am

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.
samuel
 
Posts: 22
Joined: Sun Oct 08, 2006 11:00 pm

Re: inifinite loop in salvoqins.c

Postby aek » Mon Oct 08, 2007 8:09 am

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.

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

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm


Return to Coding

Who is online

Users browsing this forum: No registered users and 2 guests