Pumpkin, Inc.

Pumpkin User Forums

PIC18 and labels

Have an idea on how to make Salvo better? Post it here!

PIC18 and labels

Postby luben » Thu Feb 13, 2003 2:19 am

Hello,

When talking about PIC18 uP there is no sense to use labels in all OS_XXX services - the address could be fetched from the stack. Of course, to keep the style of PIC16 services the user could write some sensless label, that don't cares.

Regards
Luben

luben
 
Posts: 324
Joined: Sun Nov 19, 2000 12:00 am
Location: Sofia, Bulgaria

Re: PIC18 and labels

Postby aek » Thu Feb 13, 2003 9:24 am

Hi Luben.

Keep in mind that the label-based approach is faster than anything you can do with the PIC18's stack registers. So while it is a bother, it also gives the best performance.

In fact, Salvo's fastest context switches are with the label-based approach of PICC and PICC-18. Of course this also has a lot to do with the static overlay model used for parameters and local variables ...

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

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

Re: PIC18 and labels

Postby luben » Thu Feb 13, 2003 9:25 am

quote:
since each non-running task needs to have its last PC stored on the stack.

I think that it's not necessary to hold data in the stack - when returning the control to the kernel the program will read the current address and hold it in some variable. After that, when returning the control to the task the kernel fetches the address from this variable, add some value and jumps to this address.

Regards
Luben

luben
 
Posts: 324
Joined: Sun Nov 19, 2000 12:00 am
Location: Sofia, Bulgaria

Re: PIC18 and labels

Postby jtemples » Thu Feb 13, 2003 9:27 am

It seems that using the PIC's stack would impose an upper limit on the number of tasks that could exist in an application, since each non-running task needs to have its last PC stored on the stack.
jtemples
 
Posts: 45
Joined: Tue Jul 16, 2002 11:00 pm


Return to Feature Requests

Who is online

Users browsing this forum: No registered users and 2 guests