CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Preemptive multitasking

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
PAVLOS



Joined: 14 Apr 2008
Posts: 1

View user's profile Send private message

Preemptive multitasking
PostPosted: Tue Apr 15, 2008 12:57 am     Reply with quote

Hello people
I try to write a Preemptive multitasking rtos for the PIC18f252 using PCWH ver 4.0013.
I 'd like to get information if possible, about the location where the compiler
stores information about the functions like local variables, return address, start address.
Matro
Guest







PostPosted: Tue Apr 15, 2008 1:32 am     Reply with quote

All variables are in RAM, return addresses are in the stack and start address is always 0x0000.
All these information are in the datasheet of the chip.

Matro.
RLScott



Joined: 10 Jul 2007
Posts: 465

View user's profile Send private message

Re: Preemptive multitasking
PostPosted: Tue Apr 15, 2008 6:16 am     Reply with quote

PAVLOS wrote:
Hello people
I try to write a Preemptive multitasking rtos for the PIC18f252 using PCWH ver 4.0013.
I 'd like to get information if possible, about the location where the compiler
stores information about the functions like local variables, return address, start address.

Are you interested in the local variables of library functions so that you can make those functions re-entrant for your RTOS? I don't think the location of those local variables are easy to get. And even if you did get them, what are you going to do with them? Are you going to copy all the possible local variables for library functions to a save area for each task every time there is a task switch? That would add a lot of time to the context switch.

Robert Scott
Real-Time Specialties
bwhiten



Joined: 26 Nov 2003
Posts: 151
Location: Grayson, GA

View user's profile Send private message

4.0013, thumbs down
PostPosted: Tue Apr 15, 2008 7:45 am     Reply with quote

I doubt very seriously you'll have any luck using a revision that early and that old. There are 58 releases since that one and some bugs still remain.
Maybe I'm too pessimistic in my old age Rolling Eyes

Edit: Also shows how small the world has become. From the Netherlands to Georgia, USA in the same minute Smile


Last edited by bwhiten on Tue Apr 15, 2008 8:39 am; edited 1 time in total
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue Apr 15, 2008 7:45 am     Reply with quote

Quote:
using PCWH ver 4.0013
That's an old and very unstable version. Use the old v3.249 or upgrade to at least v4.030 and save everybody a lot of time.

Edit: Two people posting the same comment simultaneously. That's multitasking. Cool
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue Apr 15, 2008 8:15 am     Reply with quote

Just wondering: Why do you want to write your own RTOS? You are aware that many RTOS-variants for the PIC are available on the internet and even CCS includes a free RTOS module with the compiler.
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

PostPosted: Tue Apr 15, 2008 9:29 pm     Reply with quote

AFAIK, most RTOSes for PICs have cooperative multitasking. Preemptive multitasking OS needs considerably more RAM.
_________________
Read the label, before opening a can of worms.
Ken Johnson



Joined: 23 Mar 2006
Posts: 197
Location: Lewisburg, WV

View user's profile Send private message

PostPosted: Wed Apr 16, 2008 6:39 am     Reply with quote

Just a comment (opinion):

PICs (prior to the later 16-bit devices) just don't have the hardware to support true multi-tasking.

I'm a very strong proponent of a simple, interrupt-driven, priority-based, pre-emptive multi-tasking executive for embedded systems, and use such in all but the simplest projects.

But, for PIC projects, I stick with the CCS single-compilation unit (which I really hate), and single-threaded execution.

Look at this in the Code Library:

http://www.ccsinfo.com/forum/viewtopic.php?t=32199

Maybe it'll be helpful.

Ken
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group