Pumpkin, Inc.

Pumpkin User Forums

OSStopTask problem

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

OSStopTask problem

Postby richardac » Wed Jul 17, 2002 3:30 am

I also have seen the problem reported by James regarding OSStopTask() not stopping a task. As you suggested I tried debugging via a source code build, and discovered that the problem was located in the call to OSTaskUsed() from within OSStopTask(). As I have located all Salvo variables in bank1 (17C766 PIC)then OSTaskUsed() is expecting an address in that bank. What is actually being passed is the address used in OSStopTask() for the parameter tcbP, passed via the w register and assigned to temporary storage in bank0.

Hence the referencing,

state = (*tcbPP)->status.bits.state;

fails to find the correct address in bank1, returning an error on evaluation of state. As a workaround I modifed the argument type for OSTaskUsed() to OStypeTcbP, changing the code,

state = (tcbP)->status.bits.state;

and it works fine.

Seems like an issue that should have been raised by others. Am I missing something?

Richard Cunningham

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

richardac
 
Posts: 3
Joined: Tue Jul 16, 2002 11:00 pm

Re: OSStopTask problem

Postby aek » Wed Jul 17, 2002 7:53 am

Hi Richard.

quote:
As I have located all Salvo variables in bank1 (17C766 PIC)then OSTaskUsed() is expecting an address in that bank.

Keep in mind that the 8-bit addresses for objects in each PIC17 bank are identical -- it's a question of what the compiler is doing a priori to set up the bank bits that creates the proper effective address.

That said, it seems very odd that this particular derefencing would be a problem, as *tcbPP is used elsewhere in the code w/out trouble.

In which module (name and line number) does

code:
state = (*tcbPP)->status.bits.state

occur? I've grep'd the current version here for *tcbPP and can't find this particular occurrence ... Also, are you using the latest version?

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

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

Re: OSStopTask problem

Postby richardac » Wed Jul 17, 2002 8:10 am

The version I am currently using is 2.2.1. The particular line appears in task.c in the function

OStypeErr OSTaskUsed ( OStypeTcbPP tcbPP )

which is line 310 in my source file.


quote:
Originally posted by aek:
Hi Richard.

code:
state = (*tcbPP)->status.bits.state

occur? I've grep'd the current version here for *tcbPP and can't find this particular occurrence ... Also, are you using the latest version?


richardac
 
Posts: 3
Joined: Tue Jul 16, 2002 11:00 pm

Re: OSStopTask problem

Postby aek » Wed Jul 17, 2002 8:18 am

Hi Richard.

quote:
The version I am currently using is 2.2.1

Please upgrade to v3.0.4 by downloading it from our website. I'm sending you instructions on how to do it separately ...

Budget 1-3 hours on the v2 to v3 transition -- just some minor edits will be required.

Regards,

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

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

Re: OSStopTask problem

Postby aek » Wed Jul 17, 2002 8:21 am

Hi Richard.

P.S. You were the very last purchaser of v2.2.1

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

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

Re: OSStopTask problem

Postby richardac » Wed Jul 17, 2002 10:06 am

Just had a look at OSTaskUsed() in v3.0.4 and it is now using the modification I made to v2.2.1. So for anyone else looking in here, the upgrade will solve this problem.

Keep up the good work.

Richard.

quote:
Originally posted by aek:
Hi Richard.

P.S. You were the very last purchaser of v2.2.1


richardac
 
Posts: 3
Joined: Tue Jul 16, 2002 11:00 pm


Return to Coding

Who is online

Users browsing this forum: No registered users and 2 guests

cron