Thread: setjmp/longjmp
View Single Post
  #1   Spotlight this post!  
Unread 25-01-2007, 11:40
dcbrown dcbrown is offline
Registered User
AKA: Bud
no team
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Hollis,NH
Posts: 236
dcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud of
Re: setjmp/longjmp

Quote:
You don't need any special features in the CPU to do it.
Ummm, actually you do. You really need to have access to the call (program address) stack. Many of the smaller implementations of the PIC architecture don't have program access to the call stack.

There are several commericially available RTOS packages available (PICOS, FreeRTOS, Salvo, Pumpkin, ...) for the PIC that support multi-tasks and some type of round-robin or priority task scheduling. The practical maximum for many of these implementations are 8-12 tasks. The context save area for the task needs to be about 100 bytes for call stack and hardware registers (like PROD, TAB*, FSR, ...) and data sections (.tmpdata, MATH_DATA). In addition, at least a small argument stack is required, so another chunk of memory - say a small 32 byte stack, plus local variable storage. This already puts a task memory structure up over 1/2 of a ram bank in size. This is easy to do, yes, but the costs in terms of chewing up the limited resources on-chip are fairly high.